1 Data preparation


Load libraries:

## Clear workspace
rm(list=ls())
## Load libraries
library(readxl)
library(ggplot2)
library(cowplot)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggsignif)
library(RColorBrewer)
library(wesanderson)
library(gridExtra)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
library(lsmeans)
## Loading required package: emmeans
## The 'lsmeans' package is now basically a front end for 'emmeans'.
## Users are encouraged to switch the rest of the way.
## See help('transition') for more information, including how to
## convert old 'lsmeans' objects and scripts to work with 'emmeans'.
library(ggpubr)
## 
## Attaching package: 'ggpubr'
## The following object is masked from 'package:cowplot':
## 
##     get_legend
library(VennDiagram)
## Loading required package: grid
## Loading required package: futile.logger
## 
## Attaching package: 'VennDiagram'
## The following object is masked from 'package:ggpubr':
## 
##     rotate
library(extrafont)
## Registering fonts with R
font_import(pattern="arial")
## Scanning ttf files in C:\WINDOWS\Fonts ...
## Extracting .afm files from .ttf files...
## C:\Windows\Fonts\arial.ttf : ArialMT already registered in fonts database. Skipping.
## C:\Windows\Fonts\arialbd.ttf : Arial-BoldMT already registered in fonts database. Skipping.
## C:\Windows\Fonts\arialbi.ttf : Arial-BoldItalicMT already registered in fonts database. Skipping.
## C:\Windows\Fonts\ariali.ttf : Arial-ItalicMT already registered in fonts database. Skipping.
## Found FontName for 0 fonts.
## Scanning afm files in C:/Users/Thomas/Documents/R/win-library/3.6/extrafontdb/metrics
wf <- windowsFonts()


Import and prepare Supplementary Data S1 - S3:

## Population A
WholePopulationA <- read_excel("./Data/Supplementary_Data.xlsx", sheet="Data_S2", 
                                    na=c('-'), col_names=TRUE, skip = 1)
colnames(WholePopulationA) <- c("Individual", "Leaf", "Petiole", "Genotyped")

## Population B
WholePopulationB <- read_excel("./Data/Supplementary_Data.xlsx", sheet="Data_S3", 
                                    na=c('-'), col_names=TRUE, skip = 1)
colnames(WholePopulationB) <- c("Individual", "Leaf1", "Petiole1",
                                "Leaf2", "Petiole2", "Leaf3", "Petiole3",
                                "Genotyped")

## Parents
Parents <- read_excel("./Data/Supplementary_Data.xlsx", sheet="Data_S1",
                                    na=c('-'), col_names=TRUE, skip=1)
colnames(Parents) <- c("Accession", "Population", "Leaf", "Petiole")

## Whole screening Population A
AbsolutePopA <- WholePopulationA %>% 
                dplyr::select(Individual, Leaf, Petiole) %>%
                dplyr::mutate(Population = "A") %>%
                na.omit()
## Whole screening Population B
AbsolutePopB <- WholePopulationB %>% 
                dplyr::select(Individual, Leaf1, Petiole1) %>%
                dplyr::mutate(Population = "B") %>%
                dplyr::rename(Leaf = Leaf1, Petiole = Petiole1) %>%
                na.omit()

## Genotyped individuals only and exclude parents
GenotypedPopulationA <- WholePopulationA %>% 
                        dplyr::filter(Genotyped == "Yes" & Individual != "A1909" & Individual != "A1896") %>% 
                        dplyr::select(Individual, Leaf, Petiole) %>%
                        dplyr::mutate(Population = "A") %>%
                        na.omit()
## Genotyped individuals only and exclude parents
GenotypedPopulationB <- WholePopulationB %>%
                        dplyr::filter(Genotyped == "Yes" & Individual != "B1909" & Individual != "B1896") %>% 
                        dplyr::select(Individual, Leaf1, Petiole1, Leaf2, Petiole2, Leaf3, Petiole3) %>%
                        dplyr::mutate(Population = "B")


2 Parental performance


Comparison of parental lesion values in both mapping populations.


2.1 Population A


Leaf-assay:

## Leaf-assay
modLeaf <- lm(Leaf ~ Accession+Population+Accession:Population, data=Parents)
compLeaf <- lsmeans(modLeaf, specs="Accession", by="Population", contr="trt.vs.ctrl1")$contrasts
summary(as.glht(compLeaf, by=NULL, alternative="two.sided")) 
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Linear Hypotheses:
##                           Estimate Std. Error t value Pr(>|t|)    
## BRA1909 - BRA1896, A == 0   426.25      55.62   7.664 2.46e-09 ***
## BRA1909 - BRA1896, B == 0    88.87      65.60   1.355    0.329    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)


Petiole-assay:

## Petiole-assay
modPetiole<- lm(Petiole ~ Accession+Population+Accession:Population, data=Parents)
compPetiole <- lsmeans(modPetiole, specs="Accession", by="Population", contr="trt.vs.ctrl1")$contrasts
summary(as.glht(compPetiole, by=NULL, alternative="two.sided"))
## 
##   Simultaneous Tests for General Linear Hypotheses
## 
## Linear Hypotheses:
##                           Estimate Std. Error t value Pr(>|t|)    
## BRA1909 - BRA1896, A == 0   17.844      1.889   9.446   <1e-10 ***
## BRA1909 - BRA1896, B == 0    7.210      2.294   3.143   0.0061 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## (Adjusted p values reported -- single-step method)


2.2 Boxplots


Data preparation:

## Prepare data for plotting
## Boxplots for the leaf-comparison
ComparisonLeaves <- ggplot2::ggplot(Parents, aes(x=Population, y=Leaf))+
ggplot2::geom_boxplot(aes(fill=factor(Accession, levels=c("BRA1909","BRA1896"))),
                          outlier.shape= NA)+
ggplot2::geom_point(position=position_jitterdodge(jitter.width=0.15), 
                    aes(shape=factor(Accession, levels=c("BRA1909","BRA1896")),
                        size=factor(Accession, levels=c("BRA1909", "BRA1896")),
                        fill=factor(Accession, levels=c("BRA1909","BRA1896"))))+
ggplot2::scale_shape_manual(values=c(21,21), labels=c("BRA1909", "BRA1896"))+
ggplot2::scale_size_manual(values=c(3,3), labels=c("BRA1909", "BRA1896"))+
ggplot2::scale_fill_manual(values=c("deepskyblue3", "darkslategray3"), labels=c("BRA1909", "BRA1896"))+
guides(fill=guide_legend(title="Accession"),
       shape=guide_legend(title="Accession"),
       size=guide_legend(title="Accession"))+
ggplot2::scale_y_continuous(expand=c(0,0), limits=c(150,1500))+
ggsignif::geom_signif(y_position=c(1400, 550), xmin=c(0.8, 1.8), xmax=c(1.2,2.2), 
                      annotation=c("***", "n.s."), tip_length=0.01, textsize=6)+
ggplot2::labs(y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(axis.title.x=element_text(size=20, face="bold"),
      axis.title.y=element_text(size=20, face="bold"),
      axis.ticks.y=element_line(size=1),
      axis.ticks.x=element_line(size=1),
      axis.text.y=element_text(color="black", size=18, face="bold"),
      axis.text.x=element_text(color="black", size=18, face="bold"),
      panel.background = element_rect(fill="white"),
      panel.border = element_rect(linetype="solid", fill=NA),
      panel.grid.major=element_blank(),
      panel.grid.minor=element_blank(),
      legend.title=element_blank(),
      legend.position="none",
      plot.margin=unit(c(1,1,1,1), "cm"),
      legend.text=element_text(size=16, face="bold"),
      legend.background = element_blank())

## Boxplots for the petiole-comparison
ComparisonPetioles <- ggplot2::ggplot(Parents, aes(x=Population, y=Petiole))+
ggplot2::geom_boxplot(aes(fill=factor(Accession, 
                          levels=c("BRA1909","BRA1896"))),
                          outlier.shape= NA)+
ggplot2::geom_point(position=position_jitterdodge(jitter.width=0.15), 
                    aes(shape=factor(Accession, levels=c("BRA1909","BRA1896")),
                        size=factor(Accession, levels=c("BRA1909", "BRA1896")),
                        fill=factor(Accession, levels=c("BRA1909","BRA1896"))))+
ggplot2::scale_shape_manual(values=c(21,21), labels=c("BRA1909", "BRA1896"))+
ggplot2::scale_size_manual(values=c(3,3), labels=c("BRA1909", "BRA1896"))+
ggplot2::scale_fill_manual(values=c("deepskyblue3", "darkslategray3"), labels=c("BRA1909", "BRA1896"))+
guides(fill=guide_legend(title="Accession"),
       shape=guide_legend(title="Accession"),
       size=guide_legend(title="Accession"))+
ggplot2::scale_y_continuous(expand=c(0,0), limits=c(15,60))+
ggsignif::geom_signif(y_position=c(57, 40), xmin=c(0.8, 1.8), xmax=c(1.2,2.2), 
                      annotation=c("***", "**"), tip_length=0.01, textsize=6)+
ggplot2::labs(y="Petiole-lesion length [mm]")+
ggplot2::theme_bw()+
ggplot2::theme(axis.title.x=element_text(size=20, face="bold"),
      axis.title.y=element_text(size=20, face="bold"),
      axis.ticks.y=element_line(size=1),
      axis.ticks.x=element_line(size=1),
      axis.text.y=element_text(color="black", size=18, face="bold"),
      axis.text.x=element_text(color="black", size=18, face="bold"),
      panel.background = element_rect(fill="white"),
      panel.border = element_rect(linetype="solid", fill=NA),
      panel.grid.major=element_blank(),
      panel.grid.minor=element_blank(),
      legend.title=element_blank(),
      legend.text=element_text(size=15, face="bold"),
      legend.position=c(0.75,0.95),
      plot.margin=unit(c(1,1,1,1), "cm"),
      legend.background = element_blank())
## Combine plots
ComparisonParents  <- cowplot::plot_grid(ComparisonLeaves, ComparisonPetioles, align="hv")
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
## Warning: Removed 2 rows containing non-finite values (stat_signif).
## Warning: Removed 2 rows containing missing values (geom_point).


Plot:

## Plot
#png("./Figures/RAW/Parents_Comparison.png", width=3000, height=2100, res=300, type="cairo")
ComparisonParents

#dev.off()


3 Distribution


Plot:

## Prepare leaf-lesion distribution in Population A
HistogramLeafPopA <- ggplot2::ggplot(AbsolutePopA, aes(x = Leaf))+
ggplot2::geom_histogram(binwidth=20, color="black", fill="lightseagreen")+
ggplot2::labs(title="Population A", y="Frequency", x=" ")+
ggplot2::scale_y_continuous(expand=c(0,0), breaks=c(5, 10, 15, 20), limits=c(0,25))+
ggplot2::scale_x_continuous(expand=c(0,0), breaks=c(0, 200, 400, 600, 800, 1000, 1200, 1400), limits=c(0,1600))+
ggplot2::geom_segment(aes(x=587, y=15, xend=587, yend=17.5), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=587, y=18.5, size=5, label="BRA1896", fontface="bold")+
ggplot2::geom_segment(aes(x=1014, y=6, xend=1014, yend=8.5), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=1014, y=9.5, size=5, label="BRA1909", fontface="bold")+
ggplot2::theme_bw()+
ggplot2::theme(
    plot.title=element_text(size=17, face="bold", hjust=0.5),
    axis.title.y=element_text(size=15, face="bold"),
    axis.title.x=element_text(size=15, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=15, face="bold"),
    axis.text.x=element_text(color="black", size=15, face="bold"))
## Prepare petiole-lesion distribution in Population A
HistogramPetiolePopA <- ggplot2::ggplot(AbsolutePopA, aes(x = Petiole))+
ggplot2::geom_histogram(binwidth=2, color="black", fill="lightseagreen")+
ggplot2::labs(title="Population A", y=" ", x=" ")+
ggplot2::scale_y_continuous(expand=c(0,0), breaks=c(10, 20, 30, 40), limits=c(0,45))+
ggplot2::scale_x_continuous(expand=c(0,0), breaks=c(0, 10, 20, 30, 40, 50, 60), limits=c(0,70))+
ggplot2::geom_segment(aes(x=28.5, y=16, xend=28.5, yend=21.5), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=28.5, y=23.5, size=5, label="BRA1896", fontface="bold")+
ggplot2::geom_segment(aes(x=46, y=19, xend=46, yend=26), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=48, y=28, size=5, label="BRA1909", fontface="bold")+
ggplot2::theme_bw()+
ggplot2::theme(
    plot.title=element_text(size=17, face="bold", hjust=0.5),
    axis.title.y=element_text(size=15, face="bold"),
    axis.title.x=element_text(size=15, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=15, face="bold"),
    axis.text.x=element_text(color="black", size=15, face="bold"))
## Prepare leaf-lesion distribution in Population B
HistogramLeafPopB <- ggplot2::ggplot(AbsolutePopB, aes(x = Leaf))+
ggplot2::geom_histogram(binwidth=20, color="black", fill="darkslategray4")+
ggplot2::labs(title="Population B", y="Frequency", x=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::scale_y_continuous(expand=c(0,0), breaks=c(5, 10, 15, 20), limits=c(0,25))+
ggplot2::scale_x_continuous(expand=c(0,0), breaks=c(0, 200, 400, 600, 800, 1000, 1200, 1400), limits=c(0,1600))+
ggplot2::geom_segment(aes(x=288, y=20.5, xend=288, yend=23), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=288, y=24, size=5, label="BRA1896", fontface="bold")+
ggplot2::geom_segment(aes(x=377, y=15, xend=377, yend=18), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=450, y=19, size=5, label="BRA1909", fontface="bold")+
ggplot2::theme_bw()+
ggplot2::theme(
    plot.title=element_text(size=17, face="bold", hjust=0.5),
    axis.title.y=element_text(size=15, face="bold"),
    axis.title.x=element_text(size=15, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=15, face="bold"),
    axis.text.x=element_text(color="black", size=15, face="bold"))
## Prepare petiole-lesion distribution in Population B
HistogramPetiolePopB <- ggplot2::ggplot(AbsolutePopB, aes(x = Petiole))+
ggplot2::geom_histogram(binwidth=2, color="black", fill="darkslategray4")+
ggplot2::labs(title="Population B", y=" ", x="Petiole-lesion length [mm]")+
ggplot2::scale_y_continuous(expand=c(0,0), breaks=c(10, 20, 30, 40), limits=c(0,45))+
ggplot2::scale_x_continuous(expand=c(0,0), breaks=c(0, 10, 20, 30, 40, 50, 60), limits=c(0,70))+
ggplot2::geom_segment(aes(x=25.2, y=28, xend=25.2, yend=34), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=22, y=36, size=5, label="BRA1896", fontface="bold")+
ggplot2::geom_segment(aes(x=32.4, y=32, xend=32.4, yend=38), colour="black", 
                          arrow=arrow(length=unit(0.1,"inches"),ends="first", type="closed"),
                          size=0.1)+ 
ggplot2::annotate("text", x=38, y=40, size=5, label="BRA1909", fontface="bold")+
ggplot2::theme_bw()+
ggplot2::theme(
    plot.title=element_text(size=17, face="bold", hjust=0.5),
    axis.title.y=element_text(size=15, face="bold"),
    axis.title.x=element_text(size=15, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=15, face="bold"),
    axis.text.x=element_text(color="black", size=15, face="bold"))

## Combine plots
LesionDistributions <- cowplot::plot_grid(HistogramLeafPopA, HistogramPetiolePopA, 
                                          HistogramLeafPopB, HistogramPetiolePopB, align="hv", ncol=2, nrow=2)
## Warning: Removed 2 rows containing missing values (geom_bar).

## Warning: Removed 2 rows containing missing values (geom_bar).

## Warning: Removed 2 rows containing missing values (geom_bar).

## Warning: Removed 2 rows containing missing values (geom_bar).
#png("./Figures/Lesion_Distributions.png", width=3000, height=2142, res=300, type="cairo")
LesionDistributions

#dev.off()


4 Correlation analysis


4.1 Whole-population screening


Population A:

## Population A
cor.test(formula=~AbsolutePopA$Leaf+AbsolutePopA$Petiole, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  AbsolutePopA$Leaf and AbsolutePopA$Petiole
## t = 9.6087, df = 234, p-value < 2.2e-16
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.4502782 1.0000000
## sample estimates:
##       cor 
## 0.5319115


Population B:

## Population B
cor.test(formula=~AbsolutePopB$Leaf+AbsolutePopB$Petiole, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  AbsolutePopB$Leaf and AbsolutePopB$Petiole
## t = 2.3791, df = 258, p-value = 0.009042
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.04494518 1.00000000
## sample estimates:
##       cor 
## 0.1465165


4.2 Genotyped-population screening


4.2.1 Population A


## Population A
cor.test(formula=~GenotypedPopulationA$Leaf+GenotypedPopulationA$Petiole, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  GenotypedPopulationA$Leaf and GenotypedPopulationA$Petiole
## t = 8.7584, df = 164, p-value = 1.176e-15
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.4704155 1.0000000
## sample estimates:
##       cor 
## 0.5645173


4.2.2 Population B


First assay:

## Population A
cor.test(formula=~GenotypedPopulationB$Leaf1+GenotypedPopulationB$Petiole1, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  GenotypedPopulationB$Leaf1 and GenotypedPopulationB$Petiole1
## t = 5.5034, df = 179, p-value = 6.372e-08
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.2703673 1.0000000
## sample estimates:
##       cor 
## 0.3804169


Second assay:

## Population A
cor.test(formula=~GenotypedPopulationB$Leaf2+GenotypedPopulationB$Petiole2, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  GenotypedPopulationB$Leaf2 and GenotypedPopulationB$Petiole2
## t = 7.1997, df = 155, p-value = 1.223e-11
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.3948857 1.0000000
## sample estimates:
##       cor 
## 0.5006111


Third assay:

## Population A
cor.test(formula=~GenotypedPopulationB$Leaf3+GenotypedPopulationB$Petiole3, alternative="greater", method = c("pearson"))
## 
##  Pearson's product-moment correlation
## 
## data:  GenotypedPopulationB$Leaf3 and GenotypedPopulationB$Petiole3
## t = 3.7132, df = 167, p-value = 0.0001393
## alternative hypothesis: true correlation is greater than 0
## 95 percent confidence interval:
##  0.1546049 1.0000000
## sample estimates:
##       cor 
## 0.2761599


4.3 Scatterplots


Prepare data:

## Prepare whole population screening
AbsolutePopC <- rbind(AbsolutePopA, AbsolutePopB)
AbsolutePopC$Population <- as.factor(AbsolutePopC$Population)
AbsolutePopC <- AbsolutePopC %>% na.omit()
## Prepare genotyped individuals only
First_Assay_PopA <- GenotypedPopulationA %>% 
                    dplyr::select(Individual, Leaf, Petiole) %>%
                    dplyr::mutate(Assay = "PopAFirst") %>%
                    na.omit()
First_Assay_PopB <- GenotypedPopulationB %>% 
                    dplyr::select(Individual, Leaf1, Petiole1) %>%
                    dplyr::mutate(Assay = "PopBFirst") %>%
                    dplyr::rename(Leaf = "Leaf1", Petiole = "Petiole1") %>%
                    na.omit()
Second_Assay_PopB <- GenotypedPopulationB %>% 
                    dplyr::select(Individual, Leaf2, Petiole2) %>%
                    dplyr::mutate(Assay = "PopBSecond") %>%
                    dplyr::rename(Leaf = "Leaf2", Petiole = "Petiole2") %>%
                    na.omit()
Third_Assay_PopB <- GenotypedPopulationB %>% 
                    dplyr::select(Individual, Leaf3, Petiole3) %>%
                    dplyr::mutate(Assay = "PopBThird") %>%
                    dplyr::rename(Leaf = "Leaf3", Petiole = "Petiole3") %>%
                    na.omit()

## Whole population scatterplot
Whole_Pops_Scatteplot <- ggplot2::ggplot(AbsolutePopC, aes(x=Petiole, y=Leaf, group=Population))+
ggplot2::geom_point(aes(size=Population, shape=Population, fill=Population))+
ggplot2::geom_smooth(method=lm, aes(linetype=Population, colour=Population), fill="grey30")+
ggplot2::scale_linetype_manual(values=c(1,1), labels=c("Population A", "Population B"))+
ggplot2::scale_size_manual(values=c(4.5,4.5),labels=c("Population A", "Population B"))+
ggplot2::scale_shape_manual(values=c(21,21), labels=c("Population A", "Population B"))+
ggplot2::scale_fill_manual(values=c(A="goldenrod2", B="lightseagreen"), labels=c("Population A", "Population B"))+
ggplot2::scale_colour_manual(values=c(A="goldenrod2", B="lightseagreen"), labels=c("Population A", "Population B"))+
ggplot2::labs(x="Petiole-lesion length [mm]",y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(
    axis.title.y=element_text(size=20, face="bold"),
    axis.title.x=element_text(size=20, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),,
    axis.text.y=element_text(color="black", size=18, face="bold"),
    axis.text.x=element_text(color="black", size=18, face="bold"),
    panel.background = element_rect(fill="white"),
    panel.border = element_rect(linetype="solid", fill=NA),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    legend.title=element_blank(),
    legend.text=element_text(size=19),
    legend.position = c(0.3,0.93),
    legend.direction = "horizontal")
## Arrange in plot
Whole_Populations_Scatteplot <- cowplot::plot_grid(Whole_Pops_Scatteplot, labels="A", label_size=20)

## Genotyped Population A
GenotypedPopA_First_Scatteplot <- ggplot2::ggplot(First_Assay_PopA, aes(x=Petiole, y=Leaf, color=Assay))+
ggplot2::geom_point(size=3.5, shape=21, fill="goldenrod2", color="black")+
ggplot2::scale_x_continuous(breaks=c(20,30,40,50))+
ggplot2::scale_y_continuous(breaks=c(200,600,1000,1400), limits=c(0,1500))+
ggplot2::scale_color_manual(values = "goldenrod3")+
ggplot2::geom_smooth(method=lm, linetype=1, color="goldenrod3", fill="grey30")+
ggplot2::labs(x="Petiole-lesion length [mm]",y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(
    axis.title.y=element_text(size=16, face="bold"),
    axis.title.x=element_text(size=16, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=16, face="bold"),
    axis.text.x=element_text(color="black", size=16, face="bold"),
    panel.background = element_rect(fill="white"),
    panel.border = element_rect(linetype="solid", fill=NA),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    legend.title=element_blank(),
    legend.position = "none")
## Genotyped Population B (First assay)
GenotypedPopB_First_Scatteplot <- ggplot2::ggplot(First_Assay_PopB, aes(x=Petiole, y=Leaf))+
ggplot2::geom_point(size=3.5, shape=21, fill="lightseagreen", color="black")+
ggplot2::scale_x_continuous(breaks=c(20,30,40))+
ggplot2::scale_y_continuous(breaks=c(200,600,1000,1400), limits=c(0,1500))+
ggplot2::geom_smooth(method=lm, linetype=1, color="lightseagreen", fill="grey30")+
ggplot2::labs(x="Petiole-lesion length [mm]",y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(
    axis.title.y=element_text(size=16, face="bold"),
    axis.title.x=element_text(size=16, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=16, face="bold"),
    axis.text.x=element_text(color="black", size=16, face="bold"),
    panel.background = element_rect(fill="white"),
    panel.border = element_rect(linetype="solid", fill=NA),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    legend.title=element_blank(),
    legend.position = "none")
## Genotyped Population B (Second assay)
GenotypedPopB_Second_Scatteplot <- ggplot2::ggplot(Second_Assay_PopB, aes(x=Petiole, y=Leaf, color=Assay))+
ggplot2::geom_point(size=3.5, shape=21, fill="lightseagreen", color="black")+
ggplot2::scale_x_continuous(breaks=c(20,30,40,50))+
ggplot2::scale_y_continuous(breaks=c(200,600,1000,1400), limits=c(0,1500))+
ggplot2::scale_color_manual(values = "lightseagreen")+
ggplot2::geom_smooth(method=lm, linetype=1, color="lightseagreen", fill="grey30")+
ggplot2::labs(x="Petiole-lesion length [mm]",y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(
    axis.title.y=element_text(size=16, face="bold"),
    axis.title.x=element_text(size=16, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=16, face="bold"),
    axis.text.x=element_text(color="black", size=16, face="bold"),
    panel.background = element_rect(fill="white"),
    panel.border = element_rect(linetype="solid", fill=NA),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    legend.title=element_blank(),
    legend.position = "none")
## Genotyped Population B (Third assay)
GenotypedPopB_Third_Scatteplot <- ggplot2::ggplot(Third_Assay_PopB, aes(x=Petiole, y=Leaf, color=Assay))+
ggplot2::geom_point(size=3.5, shape=21, fill="lightseagreen", color="black")+
ggplot2::scale_x_continuous(breaks=c(20,30,40))+
ggplot2::scale_y_continuous(breaks=c(200,600,1000,1400), limits=c(0,1500))+
ggplot2::scale_color_manual(values = "lightseagreen")+
ggplot2::geom_smooth(method=lm, linetype=1, color="lightseagreen", fill="grey30")+
ggplot2::labs(x="Petiole-lesion length [mm]",y=expression(bold(paste("Leaf-lesion area [ ", mm^{2},"]"))))+
ggplot2::theme_bw()+
ggplot2::theme(
    axis.title.y=element_text(size=16, face="bold"),
    axis.title.x=element_text(size=16, face="bold"),
    axis.ticks.y=element_line(size=1),
    axis.ticks.x=element_line(size=1),
    axis.text.y=element_text(color="black", size=16, face="bold"),
    axis.text.x=element_text(color="black", size=16, face="bold"),
    panel.background = element_rect(fill="white"),
    panel.border = element_rect(linetype="solid", fill=NA),
    panel.grid.major=element_blank(),
    panel.grid.minor=element_blank(),
    legend.title=element_blank(),
    legend.position = "none")


Plot:

## Combine all plots in one plot
ggpubr::ggarrange(Whole_Pops_Scatteplot,
ggpubr::ggarrange(GenotypedPopA_First_Scatteplot,
        GenotypedPopB_First_Scatteplot,
        GenotypedPopB_Second_Scatteplot,
        GenotypedPopB_Third_Scatteplot,
        ncol=2,
        nrow=2))


5 Group comparisons


5.1 Venn diagram


Prepare the data:


## Prepare data, make classification
GroupingPopA <- AbsolutePopA %>% 
                dplyr::mutate(Leaf_Groups = ifelse(Leaf <= 587,"Resistant",
                                            ifelse(Leaf >= 1014,"Susceptible", "Intermediate"))) %>%
                dplyr::mutate(Petiole_Groups = ifelse(Petiole <= 28.5,"Resistant",
                                               ifelse(Petiole >= 46,"Susceptible", "Intermediate"))) %>%
                dplyr::filter(Individual != "A1909" & Individual != "A1896")
GroupingPopB <- AbsolutePopB %>% 
                dplyr::mutate(Leaf_Groups = ifelse(Leaf <= 288.8,"Resistant",
                                            ifelse(Leaf >= 377.6,"Susceptible", "Intermediate"))) %>%
                dplyr::mutate(Petiole_Groups = ifelse(Petiole <= 25.2,"Resistant",
                                               ifelse(Petiole >= 32.4,"Susceptible", "Intermediate"))) %>%
                dplyr::filter(Individual != "B1909" & Individual != "B1896")

## Subsetting of groups
ResLeafA <- subset(GroupingPopA, Leaf_Groups == "Resistant")
ResPetioleA <- subset(GroupingPopA, Petiole_Groups == "Resistant")
IntLeafA <- subset(GroupingPopA, Leaf_Groups == "Intermediate")
IntPetioleA <- subset(GroupingPopA, Petiole_Groups == "Intermediate")
SuscLeafA <- subset(GroupingPopA, Leaf_Groups == "Susceptible")
SuscPetioleA <- subset(GroupingPopA, Petiole_Groups == "Susceptible")

ResLeafB <- subset(GroupingPopB, Leaf_Groups == "Resistant")
ResPetioleB <- subset(GroupingPopB, Petiole_Groups == "Resistant")
IntLeafB <- subset(GroupingPopB, Leaf_Groups == "Intermediate")
IntPetioleB <- subset(GroupingPopB, Petiole_Groups == "Intermediate")
SuscLeafB <- subset(GroupingPopB, Leaf_Groups == "Susceptible")
SuscPetioleB <- subset(GroupingPopB, Petiole_Groups == "Susceptible")


## Compare groups
VennResisA <- VennDiagram::venn.diagram(list(Leaf=ResLeafA$Individual, Petiole=ResPetioleA$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Resistant",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(20,-40),
                cat.dist=c(0.04,0.05),
                margin=0.05,
                rotation.centre=c(1,1),
                rotation=180)
VennIntA <- VennDiagram::venn.diagram(list(Leaf=IntLeafA$Individual, Petiole=IntPetioleA$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Intermediate",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(-160,160),
                cat.dist=c(0.04,0.04),
                margin=0.05)
VennSuscA <- VennDiagram::venn.diagram(list(Leaf=SuscLeafA$Individual, Petiole=SuscPetioleA$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Susceptible",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(-160,160),
                cat.dist=c(0.04,0.04),
                margin=0.05)
## Combine plots
Venn_PopA <- cowplot::plot_grid(grobTree(VennResisA),grobTree(VennIntA),grobTree(VennSuscA),
                       ncol=3, nrow=1, align ="hv", scale=0.9)

## Compare groups
VennResisB <- VennDiagram::venn.diagram(list(Leaf=ResLeafB$Individual, Petiole=ResPetioleB$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Resistant",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(20,-30),
                cat.dist=c(0.04,0.05),
                margin=0.05,
                rotation.centre=c(1,1),
                rotation=180)
VennIntB <- VennDiagram::venn.diagram(list(Leaf=IntLeafB$Individual, Petiole=IntPetioleB$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Intermediate",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(-160,160),
                cat.dist=c(0.04,0.04),
                margin=0.05)
VennSuscB <- VennDiagram::venn.diagram(list(Leaf=SuscLeafB$Individual, Petiole=SuscPetioleB$Individual),
                alpha = c(0.8,0.8), fill=c("deepskyblue1", "deepskyblue4"), filename=NULL,
                cex=1.5, cat.cex=1.3, cat.fontface="bold",
                fontfamily=wf$Arial,
                fontface="bold",
                main.fontface="bold",
                main="Susceptible",
                main.cex=1.5,
                main.pos=c(0.5,1),
                cat.fontfamily=wf$Arial,
                main.fontfamily=wf$Arial,
                cat.pos=c(-160,160),
                cat.dist=c(0.04,0.04),
                margin=0.05)
## Combine plots
Venn_PopB <- cowplot::plot_grid(grobTree(VennResisB),grobTree(VennIntB),grobTree(VennSuscB),
                       ncol=3, nrow=1, align ="hv", scale=0.9)
Venn_All <- cowplot::plot_grid(Venn_PopA, Venn_PopB,
                       ncol=1, nrow=2, align ="hv", scale=0.9)

#png("./Lesion_Comparisons.png", width=3200, height=2046, res=300, type="cairo")
#Venn_All
#dev.off()


Plot:

## Plot
Venn_All


Finished!


print(sessionInfo())
## R version 3.6.3 (2020-02-29)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19043)
## 
## Matrix products: default
## 
## locale:
## [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252   
## [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
## [5] LC_TIME=German_Germany.1252    
## 
## attached base packages:
## [1] grid      stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] extrafont_0.17      VennDiagram_1.6.20  futile.logger_1.4.3
##  [4] ggpubr_0.4.0        lsmeans_2.30-0      emmeans_1.6.0      
##  [7] gridExtra_2.3       wesanderson_0.3.6   RColorBrewer_1.1-2 
## [10] ggsignif_0.6.1      dplyr_1.0.5         cowplot_1.1.1      
## [13] ggplot2_3.3.3       readxl_1.3.1       
## 
## loaded via a namespace (and not attached):
##  [1] tidyr_1.1.3          splines_3.6.3        carData_3.0-4       
##  [4] assertthat_0.2.1     highr_0.9            cellranger_1.1.0    
##  [7] yaml_2.2.1           Rttf2pt1_1.3.8       pillar_1.6.0        
## [10] backports_1.2.1      lattice_0.20-38      glue_1.4.2          
## [13] extrafontdb_1.0      digest_0.6.27        colorspace_2.0-0    
## [16] sandwich_3.0-0       plyr_1.8.6           htmltools_0.5.1.1   
## [19] Matrix_1.2-18        pkgconfig_2.0.3      broom_0.7.6         
## [22] haven_2.4.1          purrr_0.3.4          xtable_1.8-4        
## [25] mvtnorm_1.1-1        scales_1.1.1         openxlsx_4.2.3      
## [28] rio_0.5.26           tibble_3.0.4         mgcv_1.8-31         
## [31] farver_2.1.0         generics_0.1.0       car_3.0-10          
## [34] ellipsis_0.3.1       TH.data_1.0-10       withr_2.4.2         
## [37] survival_3.1-8       magrittr_2.0.1       crayon_1.4.1        
## [40] estimability_1.3     evaluate_0.14        fansi_0.4.2         
## [43] nlme_3.1-144         MASS_7.3-51.5        rstatix_0.7.0       
## [46] forcats_0.5.1        foreign_0.8-75       tools_3.6.3         
## [49] data.table_1.14.0    hms_1.0.0            formatR_1.9         
## [52] lifecycle_1.0.0      multcomp_1.4-17      stringr_1.4.0       
## [55] munsell_0.5.0        zip_2.1.1            lambda.r_1.2.4      
## [58] compiler_3.6.3       rlang_0.4.10         labeling_0.4.2      
## [61] rmarkdown_2.7        gtable_0.3.0         codetools_0.2-16    
## [64] abind_1.4-5          DBI_1.1.1            curl_4.3            
## [67] R6_2.5.0             zoo_1.8-9            knitr_1.33          
## [70] utf8_1.1.4           futile.options_1.0.1 stringi_1.5.3       
## [73] Rcpp_1.0.6           vctrs_0.3.6          tidyselect_1.1.1    
## [76] xfun_0.21