Commit e4900339 authored by Kosmas Hench's avatar Kosmas Hench

update figures

parent 8ec8eaab
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -32,7 +32,8 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -32,7 +32,8 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
clr <- c('#fb8620','#1b519c','#d93327') clr <- c('#fb8620','#1b519c','#d93327')
annoclr <- c('lightgray',highclr,rgb(.3,.3,.3))[1:3] annoclr <- c('lightgray',highclr,rgb(.3,.3,.3))[1:3]
df_list[[1]] <- df_list[[1]] %>% mutate(label=paste("italic(",tolower(Parentgenename),")",sep='') ) df_list[[1]] <- df_list[[1]] %>%
mutate(label=paste("italic(",tolower(Parentgenename),")",sep='') )
LW <- .3;lS <- 9;tS <- 6 LW <- .3;lS <- 9;tS <- 6
plotSET <- theme(rect = element_blank(), plotSET <- theme(rect = element_blank(),
...@@ -67,7 +68,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -67,7 +68,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
# color settings # color settings
scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+ scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+
scale_fill_manual(values=annoclr,guide=F)+ scale_fill_manual(values=annoclr,guide=F)+
scale_x_continuous(name=paste(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+ scale_x_continuous(name=paste0(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.75,length.out = 4))+ scale_y_continuous(breaks = seq(0,.75,length.out = 4))+
theme(rect = element_blank(), theme(rect = element_blank(),
text=element_text(size=tS,color='black'), text=element_text(size=tS,color='black'),
...@@ -130,7 +131,8 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -130,7 +131,8 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
,aes(x=POS,y=avgp_wald,col=run),lwd=LW)+ ,aes(x=POS,y=avgp_wald,col=run),lwd=LW)+
# geom_line(data=(data_pfst_pw %>% filter(POS > xr[1],POS<xr[2])) # geom_line(data=(data_pfst_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=avgp_wald,col=run,linetype=group),lwd=1)+ # ,aes(x=POS,y=avgp_wald,col=run,linetype=group),lwd=1)+
scale_color_manual(values=c(clr,annoclr),breaks=c("nig-pue","nig-uni","pue-uni","x","y","z"),guide=F)+ scale_color_manual(values=c(clr,annoclr),
breaks=c("nig-pue","nig-uni","pue-uni","x","y","z"),guide=F)+
facet_grid(window~.,scales='free_y', facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = T)+ switch = 'y',labeller = label_parsed,as.table = T)+
scale_x_continuous(name=searchLG,expand=c(0,0),position = 'top')+ scale_x_continuous(name=searchLG,expand=c(0,0),position = 'top')+
...@@ -151,7 +153,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -151,7 +153,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+ scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p2 <- plot_grid(p11,p12,p13,p14, p2 <- plot_grid(p11,p12,p13,p14,
ncol = 1,align = 'v',axis = 'r',rel_heights = c(1.3,rep(1,3))) ncol = 1,align = 'v',axis = 'r',
rel_heights = c(1.3,rep(1,3)))
return(p2)} return(p2)}
\ No newline at end of file
...@@ -34,7 +34,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+ ...@@ -34,7 +34,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+
geom_point(inherit.aes = F, data=dt2,aes(x=run,y=val,fill=type),shape=23,size=1)+ geom_point(inherit.aes = F, data=dt2,aes(x=run,y=val,fill=type),shape=23,size=1)+
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas, scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+ italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_y_continuous('genome wide ')+ scale_y_continuous('genome wide ILD (r²)')+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+ scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
guides(shape = guide_legend(ncol = 1))+ guides(shape = guide_legend(ncol = 1))+
theme(legend.position = c(-.4,1.27), theme(legend.position = c(-.4,1.27),
......
...@@ -30,8 +30,8 @@ BoxGenes_summary <- dataBoxGenes %>% ...@@ -30,8 +30,8 @@ BoxGenes_summary <- dataBoxGenes %>%
boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
geom_boxplot(aes(y=R.2),fill=BC,width=.7,outlier.size = .1) + geom_boxplot(aes(y=R.2),fill=BC,width=.7,outlier.size = .1) +
geom_point(data=BoxGenes_summary,aes(y=val,fill=type),shape=23,size=1)+ geom_point(data=BoxGenes_summary,aes(y=val,fill=type),shape=23,size=1)+
coord_fixed(ylim=c(0,.06),ratio = 133)+ coord_fixed(ylim=c(0,.031),ratio = 250)+
scale_y_continuous('peak area r²')+ scale_y_continuous('ILD around \ncandidate genes (r²)')+
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas, scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+ italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+ scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
......
...@@ -88,7 +88,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -88,7 +88,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
# color settings # color settings
scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+ scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+
scale_fill_manual(values=annoclr,guide=F)+ scale_fill_manual(values=annoclr,guide=F)+
scale_x_continuous(name=paste(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+ scale_x_continuous(name=paste0(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.75,length.out = 4))+ scale_y_continuous(breaks = seq(0,.75,length.out = 4))+
theme(rect = element_blank(), theme(rect = element_blank(),
text=element_text(size=tS,color='black'), text=element_text(size=tS,color='black'),
......
#PBS -l elapstim_req=02:00:00
#PBS -l memsz_job=80gb
#PBS -b 1
#PBS -l cpunum_job=1
#PBS -N fstGlobal
#PBS -q clexpress
#PBS -o 2.2.5.4.fst_gw_bel.stdout
#PBS -e 2.2.5.4.fst_gw_bel.stderr
cd $WORK/2_output/08_popGen/05_fst
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nigbel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puebel.pop \
--out fst.gw.nigbel-puebel
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nigbel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unibel.pop \
--out fst.gw.nigbel-unibel
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puebel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unibel.pop \
--out fst.gw.puebel-unibel
\ No newline at end of file
#PBS -l elapstim_req=02:00:00
#PBS -l memsz_job=80gb
#PBS -b 1
#PBS -l cpunum_job=1
#PBS -N fstGlobal
#PBS -q clexpress
#PBS -o 2.2.5.4.fst_gw_hon.stdout
#PBS -e 2.2.5.4.fst_gw_hon.stderr
cd $WORK/2_output/08_popGen/05_fst
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_hon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nighon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puehon.pop \
--out fst.gw.nighon-puehon
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_hon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nighon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unihon.pop \
--out fst.gw.nighon-unihon
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_hon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puehon.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unihon.pop \
--out fst.gw.puehon-unihon
\ No newline at end of file
#PBS -l elapstim_req=02:00:00
#PBS -l memsz_job=80gb
#PBS -b 1
#PBS -l cpunum_job=1
#PBS -N fstGlobal
#PBS -q clexpress
#PBS -o 2.2.5.4.fst_gw_bel.stdout
#PBS -e 2.2.5.4.fst_gw_bel.stderr
cd $WORK/2_output/08_popGen/05_fst
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nigbel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puebel.pop \
--out fst.gw.nigbel-puebel
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_nigbel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unibel.pop \
--out fst.gw.nigbel-unibel
vcftools --gzvcf $WORK/2_output/07_phased_variants/6_phased_mac2.vcf.gz \
--keep $WORK/0_data/0_resources/vcfpops/vcftools_bel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_puebel.pop \
--weir-fst-pop $WORK/0_data/0_resources/vcfpops/vcftools_unibel.pop \
--out fst.gw.puebel-unibel
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
## Summary ## Summary
This is the accessory documentation of Figure 1. This is the accessory documentation of Figure 1.
The Figure can be recreated by running the **R** script F1.R: The Figure can be recreated by running the **R** script `F1.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -22,7 +22,7 @@ rm Rplots.pdf ...@@ -22,7 +22,7 @@ rm Rplots.pdf
``` ```
## Details of F1.R ## Details of `F1.R`
In the following, the individual steps of the R script are documented. Is an executable R script that depends on a variety of image manipulation and geodata packages. In the following, the individual steps of the R script are documented. Is an executable R script that depends on a variety of image manipulation and geodata packages.
Additionally, the supporting R script (**F1.functions.R**) in needed: Additionally, the supporting R script (**F1.functions.R**) in needed:
......
...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
This is the accessory documentation of Figure 2. This is the accessory documentation of Figure 2.
The Figure can be recreated by running the **R** script F2.R: The Figure can be recreated by running the **R** script `F2.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -23,7 +23,7 @@ Rscript --vanilla F2.R ...@@ -23,7 +23,7 @@ Rscript --vanilla F2.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of F2.R ## Details of `F2.R`
In the following, the individual steps of the R script are documented. In the following, the individual steps of the R script are documented.
Is an executable R script that depends on a variety of image manipulation and data managing packages. Is an executable R script that depends on a variety of image manipulation and data managing packages.
...@@ -185,7 +185,8 @@ p1 <- ggplot()+ ...@@ -185,7 +185,8 @@ p1 <- ggplot()+
# genome wide Fst # genome wide Fst
geom_rect(data=gwFST,aes(xmin=570*10^6,xmax=573*10^6,ymin=0,ymax=gwFST*secScale))+ geom_rect(data=gwFST,aes(xmin=570*10^6,xmax=573*10^6,ymin=0,ymax=gwFST*secScale))+
# layout of y axis and secondary y axis # layout of y axis and secondary y axis
scale_y_continuous(name = yl,breaks=0:4*0.2,labels = c(0,'',0.4,'',0.8), scale_y_continuous(name = yl,limits=c(-.03,.83),
breaks=0:4*0.2,labels = c(0,'',0.4,'',0.8),
sec.axis = sec_axis(~./secScale,labels = c(0,'',.02,'',.04)))+ sec.axis = sec_axis(~./secScale,labels = c(0,'',.02,'',.04)))+
# layout of x axis # layout of x axis
scale_x_continuous(expand = c(0,0),limits = c(0,577*10^6), scale_x_continuous(expand = c(0,0),limits = c(0,577*10^6),
......
...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
This is the accessory documentation of Figure 3. This is the accessory documentation of Figure 3.
The Figure can be recreated by running the **R** script F3.R: The Figure can be recreated by running the **R** script `F3.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -23,7 +23,7 @@ Rscript --vanilla F3.R ...@@ -23,7 +23,7 @@ Rscript --vanilla F3.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of F3.R ## Details of `F3.R`
In the following, the individual steps of the R script are documented. In the following, the individual steps of the R script are documented.
Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages. Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages.
...@@ -112,11 +112,11 @@ F3 ...@@ -112,11 +112,11 @@ F3
</center> </center>
--- ---
## Details of F3.plot_fun.R ## Details of `F3.plot_fun.R`
The actual work for figure 3 is done within the `create_K_plot()` function. The actual work for figure 3 is done within the `create_K_plot()` function.
This function loads the data and does the plotting - the F3.R script is basically just a wrapper that selects the setting for each subplot and combines the results. This function loads the data and does the plotting - the `F3.R` script is basically just a wrapper that selects the setting for each subplot and combines the results.
The function starts by importing the functions need to import the different data types (gene models, *F~ST~* values, GxP p values, d~XY~) The function starts by importing the functions need to import the different data types (gene models, *F~ST~* values, GxP p values, d~XY~)
...@@ -128,7 +128,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs ...@@ -128,7 +128,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
source('../../0_data/0_scripts/F3.getDXY.R') source('../../0_data/0_scripts/F3.getDXY.R')
``` ```
It then sets some global options for the plotting and throws an error if the genomic range illogical. It then sets some global options for the plotting and throws an error if the genomic range is negative.
```{r, eval=FALSE} ```{r, eval=FALSE}
highclr <- '#3bb33b' highclr <- '#3bb33b'
...@@ -211,7 +211,7 @@ The first data track contains the gene models from the annotation file as well a ...@@ -211,7 +211,7 @@ The first data track contains the gene models from the annotation file as well a
scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+ scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+
scale_fill_manual(values=annoclr,guide=F)+ scale_fill_manual(values=annoclr,guide=F)+
# axes labels and settings # axes labels and settings
scale_x_continuous(name=paste(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+ scale_x_continuous(name=paste0(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.75,length.out = 4))+ scale_y_continuous(breaks = seq(0,.75,length.out = 4))+
# plot format adjustments # plot format adjustments
theme(rect = element_blank(), theme(rect = element_blank(),
......
...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
This is the accessory documentation of Figure 4. This is the accessory documentation of Figure 4.
The Figure can be recreated by running the **R** script F4.R: The Figure can be recreated by running the **R** script `F4.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -22,7 +22,7 @@ Rscript --vanilla F4.R ...@@ -22,7 +22,7 @@ Rscript --vanilla F4.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of F4.R ## Details of `F4.R`
In the following, the individual steps of the R script are documented. In the following, the individual steps of the R script are documented.
Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages. Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages.
...@@ -150,7 +150,7 @@ F4 ...@@ -150,7 +150,7 @@ F4
</center> </center>
--- ---
## Details of F4.functions.R ## Details of `F4.functions.R`
The script first defines a function for standard error The script first defines a function for standard error
```{r eval=FALSE} ```{r eval=FALSE}
...@@ -415,12 +415,12 @@ Finally, the function returns the current base plot stored in `p1`. ...@@ -415,12 +415,12 @@ Finally, the function returns the current base plot stored in `p1`.
--- ---
## Details of F4.genomeWide_box.R ## Details of `F4.genomeWide_box.R`
Within this script, the ILD data of the genome wide subsets of SNPs is loaded and and plotted. Within this script, the ILD data of the genome wide subsets of SNPs is loaded and and plotted.
First we read in the global data set, then we loop over the individual population subsets and append the data to the global data set. First we read in the global data set, then we loop over the individual population subsets and append the data to the global data set.
Since we're only interested in the distribution of r^2, we select only this column and create extra columns for the run ID, and the run type (global, subset by species, subset by location) Since we're only interested in the distribution of r[2], we select only this column and create extra columns for the run ID, and the run type (global, subset by species, subset by location)
```{r eval=FALSE} ```{r eval=FALSE}
BW <- read.csv('../../2_output/08_popGen/07_LD/subsets/glob_between.interchrom.hap.ld',sep='\t') %>% BW <- read.csv('../../2_output/08_popGen/07_LD/subsets/glob_between.interchrom.hap.ld',sep='\t') %>%
...@@ -480,7 +480,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+ ...@@ -480,7 +480,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+
# settting the axis and color labels # settting the axis and color labels
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas, scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+ italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_y_continuous('genome wide ')+ scale_y_continuous('genome wide ILD (r²)')+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+ scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
# formatting the legend # formatting the legend
guides(shape = guide_legend(ncol = 1))+ guides(shape = guide_legend(ncol = 1))+
...@@ -497,7 +497,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+ ...@@ -497,7 +497,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+
--- ---
## Details of F4.peakArea_box.R ## Details of `F4.peakArea_box.R`
Within this script, the ILD data of the peak area subsets of SNPs is loaded and and plotted. Within this script, the ILD data of the peak area subsets of SNPs is loaded and and plotted.
...@@ -553,9 +553,9 @@ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+ ...@@ -553,9 +553,9 @@ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
# adding mean and median values # adding mean and median values
geom_point(data=BoxGenes_summary,aes(y=val,fill=type),shape=23,size=1)+ geom_point(data=BoxGenes_summary,aes(y=val,fill=type),shape=23,size=1)+
# set a fixed aspect ratio # set a fixed aspect ratio
coord_fixed(ylim=c(0,.06),ratio = 133)+ coord_fixed(ylim=c(0,.031),ratio = 133)+
# settting the axis and color labels # settting the axis and color labels
scale_y_continuous('peak area r²')+ scale_y_continuous('ILD around \ncandidate genes (r²)')+
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas, scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+ italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+ scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
......
...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -14,7 +14,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
This is the accessory documentation of Figure 5. This is the accessory documentation of Figure 5.
The Figure can be recreated by running the **R** script F5.R: The Figure can be recreated by running the **R** script `F5.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -23,14 +23,14 @@ Rscript --vanilla F5.R ...@@ -23,14 +23,14 @@ Rscript --vanilla F5.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of F5.R ## Details of `F5.R`
In the following, the individual steps of the R script are documented. In the following, the individual steps of the R script are documented.
Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages. Is an executable R script that depends on a variety of image manipulation and data managing and genomic data packages.
It Furthermore depends on the R scripts `F4.functions.R` (located under `$WORK/0_data/0_scripts`). It Furthermore depends on the R scripts `F4.functions.R` (located under `$WORK/0_data/0_scripts`).
This script is a modification of script F4.R. It uses the same functions and just differs in the data sets and settings This script is a modification of script `F4.R`. It uses the same functions and just differs in the data sets and settings
```{r head,results='hide',message=FALSE} ```{r head,results='hide',message=FALSE}
library(tidyverse) library(tidyverse)
......
...@@ -106,7 +106,7 @@ p1 <- ggplot()+ ...@@ -106,7 +106,7 @@ p1 <- ggplot()+
geom_text(data=musks,aes(x=muskX,y=.65,label=musk))+ geom_text(data=musks,aes(x=muskX,y=.65,label=musk))+
geom_vline(data = data.frame(x=567000000),aes(xintercept=x),col=annoclr,lwd=.2)+ geom_vline(data = data.frame(x=567000000),aes(xintercept=x),col=annoclr,lwd=.2)+
geom_rect(data=gwFST,aes(xmin=570*10^6,xmax=573*10^6,ymin=0,ymax=gwFST*secScale))+ geom_rect(data=gwFST,aes(xmin=570*10^6,xmax=573*10^6,ymin=0,ymax=gwFST*secScale))+
scale_y_continuous(name = yl,breaks=0:4*0.2,labels = c(0,'',0.4,'',0.8), scale_y_continuous(name = yl,limits=c(-.03,.83),breaks=0:4*0.2,labels = c(0,'',0.4,'',0.8),
sec.axis = sec_axis(~./secScale,labels = c(0,'',.02,'',.04)))+ sec.axis = sec_axis(~./secScale,labels = c(0,'',.02,'',.04)))+
scale_x_continuous(expand = c(0,0),limits = c(0,577*10^6), scale_x_continuous(expand = c(0,0),limits = c(0,577*10^6),
breaks = c((karyo$GSTART+karyo$GEND)/2,571*10^6), breaks = c((karyo$GSTART+karyo$GEND)/2,571*10^6),
......
...@@ -42,5 +42,6 @@ F3 <- plot_grid(NULL,NULL,NULL,NULL, ...@@ -42,5 +42,6 @@ F3 <- plot_grid(NULL,NULL,NULL,NULL,
'','','',''),label_size = 10)+ '','','',''),label_size = 10)+
draw_grob(legGrob, 0.1, 0, .8, 0.04) draw_grob(legGrob, 0.1, 0, .8, 0.04)
ggsave(plot = F3,filename = '../output/F3.pdf',width = 183,height = 155,units = 'mm',device = cairo_pdf) ggsave(plot = F3,filename = '../output/F3.pdf',
width = 183,height = 155,units = 'mm',device = cairo_pdf)
#ggsave('ranges_all_label.pdf',width = 183,height = 120,units = 'mm',device = cairo_pdf) #ggsave('ranges_all_label.pdf',width = 183,height = 120,units = 'mm',device = cairo_pdf)
...@@ -78,7 +78,8 @@ p1 <- ggplot()+ ...@@ -78,7 +78,8 @@ p1 <- ggplot()+
geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+ geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+
geom_point(data=data,aes(x=GPOS,y=avgp_wald,col=COL),size=.01)+ geom_point(data=data,aes(x=GPOS,y=avgp_wald,col=COL),size=.01)+
geom_text(data=musks,aes(x=muskX,y=9.5,label=musk))+ geom_text(data=musks,aes(x=muskX,y=9.5,label=musk))+
scale_y_continuous(name = yl,breaks=0:4*2.5,labels = c(0,'',5,'',10))+ scale_y_continuous(name = yl,limits=c(-.3,11),
breaks=0:4*2.5,labels = c(0,'',5,'',10))+
scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+ scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+
scale_color_manual(name='comparison',values=clr)+ scale_color_manual(name='comparison',values=clr)+
scale_fill_manual(values = c(NA,lgclr),guide=F)+ scale_fill_manual(values = c(NA,lgclr),guide=F)+
......
...@@ -74,9 +74,10 @@ p1 <- ggplot()+ ...@@ -74,9 +74,10 @@ p1 <- ggplot()+
geom_rect(inherit.aes = F,data=karyo,aes(xmin=GSTART,xmax=GEND, geom_rect(inherit.aes = F,data=karyo,aes(xmin=GSTART,xmax=GEND,
ymin=-Inf,ymax=Inf,fill=GROUP))+ ymin=-Inf,ymax=Inf,fill=GROUP))+
geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+ geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+
geom_text(data=musks,aes(x=muskX,y=.55,label=musk))+ geom_text(data=musks,aes(x=muskX,y=.7,label=musk))+
geom_point(data=data,aes(x=GPOS,y=WEIGHTED_FST,col=COL),size=.01)+ geom_point(data=data,aes(x=GPOS,y=WEIGHTED_FST,col=COL),size=.01)+
scale_y_continuous(name = yl,breaks=yT,labels = c(yT[1],'',yT[3],'',yT[5]))+ scale_y_continuous(name = yl,limits=c(-.03,.83),
breaks=yT,labels = c(yT[1],'',yT[3],'',yT[5]))+
scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+ scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+
scale_color_manual(name='comparison',values=clr)+ scale_color_manual(name='comparison',values=clr)+
scale_fill_manual(values = c(NA,lgclr),guide=F)+ scale_fill_manual(values = c(NA,lgclr),guide=F)+
......
...@@ -73,9 +73,10 @@ p1 <- ggplot()+ ...@@ -73,9 +73,10 @@ p1 <- ggplot()+
geom_rect(inherit.aes = F,data=karyo,aes(xmin=GSTART,xmax=GEND, geom_rect(inherit.aes = F,data=karyo,aes(xmin=GSTART,xmax=GEND,
ymin=-Inf,ymax=Inf,fill=GROUP))+ ymin=-Inf,ymax=Inf,fill=GROUP))+
geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+ geom_vline(data=data2,aes(xintercept=xmean),col=annoclr,lwd=.2)+
geom_text(data=musks,aes(x=muskX,y=5.5,label=musk))+ geom_text(data=musks,aes(x=muskX,y=8.5,label=musk))+
geom_point(data=data,aes(x=GPOS,y=avgp_wald,col=COL),size=.01)+ geom_point(data=data,aes(x=GPOS,y=avgp_wald,col=COL),size=.01)+
scale_y_continuous(name = yl,breaks=0:4*2.5,labels = c(0,'',5,'',10))+ scale_y_continuous(name = yl,limits=c(-.3,11),
breaks=0:4*2.5,labels = c(0,'',5,'',10))+
scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+ scale_x_continuous(expand = c(0,0),breaks = (karyo$GSTART+karyo$GEND)/2,labels = 1:24,position = "top")+
scale_color_manual(name='comparison',values=clr)+ scale_color_manual(name='comparison',values=clr)+
scale_fill_manual(values = c(NA,lgclr),guide=F)+ scale_fill_manual(values = c(NA,lgclr),guide=F)+
......
...@@ -27,19 +27,19 @@ p4 <- create_K_plot(searchLG = "LG17",gfffile = '../../1-output/09_gff_from_IKMB ...@@ -27,19 +27,19 @@ p4 <- create_K_plot(searchLG = "LG17",gfffile = '../../1-output/09_gff_from_IKMB
secondary_genes = c("Hcfc1","HCFC1_2","HCFC1_1","GNL3L","TFE3_0","MDFIC2_1","CXXC1_3","CXXC1_1",'Mbd1','CCDC120'), secondary_genes = c("Hcfc1","HCFC1_2","HCFC1_1","GNL3L","TFE3_0","MDFIC2_1","CXXC1_3","CXXC1_1",'Mbd1','CCDC120'),
muskID = 'D') muskID = 'D')
legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend-pw-cairo.svg")))) legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend-pw-single-cairo.svg"))))
S11 <- plot_grid(NULL,NULL,NULL,NULL, S11 <- plot_grid(NULL,NULL,NULL,NULL,
p1,NULL,p2,NULL, p1,NULL,p2,NULL,
NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,
p3,NULL,p4,NULL, p3,NULL,p4,NULL,
NULL,NULL,NULL,NULL, NULL,NULL,NULL,NULL,
ncol=4,rel_heights = c(.03,1,.03,1,.1),rel_widths = c(1,.025,1,.02), ncol=4,rel_heights = c(.03,1,.03,1,.1),rel_widths = c(1,.025,1,.04),
labels = c('a','','b','', labels = c('a','','b','',
'','','','', '','','','',
'c','','d','', 'c','','d','',
'','','','', '','','','',
'','','',''),label_size = 10)+ '','','',''),label_size = 10)+
draw_grob(legGrob, 0.1, 0, .8, 0.04) draw_grob(legGrob, 0.05, 0, .9, 0.04)
ggsave(plot = S11,filename = '../output/S11.pdf',width = 183,height = 210,units = 'mm',device = cairo_pdf) ggsave(plot = S11,filename = '../output/S11.pdf',width = 183,height = 210,units = 'mm',device = cairo_pdf)
...@@ -10,7 +10,7 @@ source('../../0_data/0_scripts/S07.functions.R') ...@@ -10,7 +10,7 @@ source('../../0_data/0_scripts/S07.functions.R')
plts <- list() plts <- list()
for(k in 1:3){ for(k in 1:3){
plts[[k]] <- trplot((8:10)[k]) plts[[k]] <- trplot((8:10)[k])
} }
tN <- theme(legend.position = 'none') tN <- theme(legend.position = 'none')
......
...@@ -16,4 +16,4 @@ p1 <- ggdraw()+ ...@@ -16,4 +16,4 @@ p1 <- ggdraw()+
draw_grob(GA, 0, .84, .25, .2)+ draw_grob(GA, 0, .84, .25, .2)+
draw_grob(HP, 0.75,.83,.25,.2) draw_grob(HP, 0.75,.83,.25,.2)
ggsave(plot = p1,filename = 'S01.pdf',width = 183,height = 183,units = 'mm',device = cairo_pdf) ggsave(plot = p1,filename = '../output/S01.pdf',width = 183,height = 183,units = 'mm',device = cairo_pdf)
...@@ -1649,7 +1649,7 @@ ...@@ -1649,7 +1649,7 @@
</symbol> </symbol>
</g> </g>
</defs> </defs>
<g id="surface5"> <g id="surface1">
<rect x="0" y="0" width="900" height="900" style="fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;"/> <rect x="0" y="0" width="900" height="900" style="fill:rgb(100%,100%,100%);fill-opacity:1;stroke:none;"/>
<path style="fill-rule:nonzero;fill:rgb(3.921569%,14.117647%,41.568627%);fill-opacity:1;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 495.648438 125.191406 C 508.886719 127.050781 522 129.71875 534.910156 133.179688 L 540.863281 110.964844 C 527.046875 107.261719 513.015625 104.40625 498.851562 102.414062 Z M 495.648438 125.191406 "/> <path style="fill-rule:nonzero;fill:rgb(3.921569%,14.117647%,41.568627%);fill-opacity:1;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:4;" d="M 495.648438 125.191406 C 508.886719 127.050781 522 129.71875 534.910156 133.179688 L 540.863281 110.964844 C 527.046875 107.261719 513.015625 104.40625 498.851562 102.414062 Z M 495.648438 125.191406 "/>
<g style="fill:rgb(0%,0%,0%);fill-opacity:1;"> <g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
......
...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts') ...@@ -13,7 +13,7 @@ knitr::opts_knit$set(root.dir = './F_scripts')
This is the accessory documentation of Supplementary Figure 02. This is the accessory documentation of Supplementary Figure 02.
The Figure can be recreated by running the **R** script S02.R: The Figure can be recreated by running the **R** script `S02.R`:
```sh ```sh
cd $WORK/3_figures/F_scripts cd $WORK/3_figures/F_scripts
...@@ -22,16 +22,16 @@ Rscript --vanilla S02.R ...@@ -22,16 +22,16 @@ Rscript --vanilla S02.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of S02.R ## Details of `S02.R`
In principal the S02.R script is a reduced versions of the F2.R script. Is an executable R script that depends on a variety of image manipulation and data managing packages. In principal the `S02.R` script is a reduced versions of the `F2.R` script. Is an executable R script that depends on a variety of image manipulation and data managing packages.