Commit 5ddd61bf authored by Kosmas Hench's avatar Kosmas Hench

update figure documentation

parent 4a40cb84
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
se <- function(x){
x2 <- x[!is.na(x)]
return(sd(x2)/sqrt(length(x2)))}
trplot <- function(sel){
files <- c("global","boc","bel","hon","pue","nig","uni","nig-pue","nig-uni","pue-uni")
data <- read.csv(paste('../../2_output/08_popGen/07_LD/',files[sel],'-10000-bins.txt',sep=''),sep='\t')
message(files[sel])
s1=17620000;s2=19910000;s3=21960000;s4=22320000;
e2=20660000;e3=22460000;
stp=20000;
l1=500000;l2=750000;l3=500000;l4=500000
scling <- c(-s1,-s2+(l1+stp),-s3+(l1+l2+2*stp),-s4+(l1+l2+l3+(stp*3)))
dt <- data %>% mutate(miX = floor(Mx/10000),miY=floor(My/10000))
genes <- data.frame(start=c(17871610,20186151,22225149,22553187,22556763,22561894,22573388),
end=c(17873915,20347811,22228342,22555052,22559742,22566321,22575503),
sclr=c(1,2,3,4,4,4,4),
LG=c("LG09","LG12-1","LG12-2","LG17","LG17","LG17","LG17"),
name=c("sox10",'casz1',"hoxc13a","sws2a\u03B1","sws2a\u03B2","sws2b","lws"))
genes <- genes %>% mutate(Nx1 = (start+scling[sclr])/10000,Nx2 = (end+scling[sclr])/10000,
labPOS = (Nx1+Nx2)/2)
genes$labPOS[genes$name %in% c("sws2a\u03B1","sws2a\u03B2","sws2b","lws")] <- genes$labPOS[genes$name %in% c("sws2a\u03B1","sws2a\u03B2","sws2b","lws")]+c(-16,-1,12,20)
GZrS <- 40000;GZrS2 <- 20000; #gene zoom offset
BS <- c(-5,5,-4,3,-8,8,-20,-10,-6,5,7,16,17,22)*10000 # Backshifter for gene zoom
GZdf <- data.frame(x=c(genes$start[1],genes$end[1],genes$end[1]+GZrS+BS[1],genes$start[1]+GZrS+BS[2],genes$start[1],
genes$start[2],genes$end[2],genes$end[2]+GZrS+BS[3],genes$start[2]+GZrS+BS[4],genes$start[2],
genes$start[3],genes$end[3],genes$end[3]+GZrS+BS[5],genes$start[3]+GZrS+BS[6],genes$start[3],
genes$start[4],genes$end[4],genes$end[4]+GZrS+BS[7],genes$start[4]+GZrS+BS[8],genes$start[4],
genes$start[5],genes$end[5],genes$end[5]+GZrS+BS[9],genes$start[5]+GZrS+BS[10],genes$start[5],
genes$start[6],genes$end[6],genes$end[6]+GZrS+BS[11],genes$start[6]+GZrS+BS[12],genes$start[6],
genes$start[7],genes$end[7],genes$end[7]+GZrS+BS[13],genes$start[7]+GZrS+BS[14],genes$start[7])+GZrS2,
y=c(genes$start[1],genes$end[1],genes$end[1]-GZrS+BS[1],genes$start[1]-GZrS+BS[2],genes$start[1],
genes$start[2],genes$end[2],genes$end[2]-GZrS+BS[3],genes$start[2]-GZrS+BS[4],genes$start[2],
genes$start[3],genes$end[3],genes$end[3]-GZrS+BS[5],genes$start[3]-GZrS+BS[6],genes$start[3],
genes$start[4],genes$end[4],genes$end[4]-GZrS+BS[7],genes$start[4]-GZrS+BS[8],genes$start[4],
genes$start[5],genes$end[5],genes$end[5]-GZrS+BS[9],genes$start[5]-GZrS+BS[10],genes$start[5],
genes$start[6],genes$end[6],genes$end[6]-GZrS+BS[11],genes$start[6]-GZrS+BS[12],genes$start[6],
genes$start[7],genes$end[7],genes$end[7]-GZrS+BS[13],genes$start[7]-GZrS+BS[14],genes$start[7])-GZrS2,
grp=rep(letters[1:7],each=5)) %>%
mutate(sclr=rep(c(1,2,3,4,4,4,4),each=5),
Nx1 = (x+scling[sclr])/10000,
Nx2 = (y+scling[sclr])/10000)
clr = c(viridis::inferno(5)[c(1,1:5)])
Gcol <- '#3bb33b'
Zcol = rgb(.94,.94,.94)
DG <- rgb(.4,.4,.4)
LGoffset <- 15
GLABoffset <- 8
if(sel %in% c(1,8)){
rS <- 100000 # width of grey annotation band
zmRange <- data.frame(x=c(s1,s1+l1,s1+l1+rS,s1+rS,s1,
s2,s2+l2,s2+l2+rS,s2+rS,s2,
s3,s3+l3,s3+l3+rS,s3+rS,s3,
s4,s4+l4,s4+l4+rS,s4+rS,s4),
y=c(s1,s1+l1,s1+l1-rS,s1-rS,s1,
s2,s2+l2,s2+l2-rS,s2-rS,s2,
s3,s3+l3,s3+l3-rS,s3-rS,s3,
s4,s4+l4,s4+l4-rS,s4-rS,s4),
grp=rep(letters[1:4],each=5)) %>%
mutate(sclr=rep(1:4,each=5),
Nx1 = (x+scling[sclr])/10000-1,
Nx2 = (y+scling[sclr])/10000)
rS2 <- .75*rS
zmRange2 <- data.frame(x=c(s1,s1+l1,s1+l1+rS2,s1+rS2,s1,
s2,s2+l2,s2+l2+rS2,s2+rS2,s2,
s3,s3+l3,s3+l3+rS2,s3+rS2,s3,
s4,s4+l4,s4+l4+rS2,s4+rS2,s4),
y=c(s1,s1+l1,s1+l1-rS2,s1-rS2,s1,
s2,s2+l2,s2+l2-rS2,s2-rS2,s2,
s3,s3+l3,s3+l3-rS2,s3-rS2,s3,
s4,s4+l4,s4+l4-rS2,s4-rS2,s4),
grp=rep(letters[1:4],each=5)) %>%
mutate(sclr=rep(1:4,each=5),
Nx1 = (x+scling[sclr])/10000-1,
Nx2 = (y+scling[sclr])/10000)
rS3 <- .07*rS
zmRange3 <- data.frame(x=c(s1,s1+l1,s1+l1+rS3,s1+rS3,s1,
s2,s2+l2,s2+l2+rS3,s2+rS3,s2,
s3,s3+l3,s3+l3+rS3,s3+rS3,s3,
s4,s4+l4,s4+l4+rS3,s4+rS3,s4),
y=c(s1,s1+l1,s1+l1-rS3,s1-rS3,s1,
s2,s2+l2,s2+l2-rS3,s2-rS3,s2,
s3,s3+l3,s3+l3-rS3,s3-rS3,s3,
s4,s4+l4,s4+l4-rS3,s4-rS3,s4),
grp=rep(letters[1:4],each=5)) %>%
mutate(sclr=rep(1:4,each=5),
Nx1 = (x+scling[sclr])/10000-1,
Nx2 = (y+scling[sclr])/10000)
zmLab <- data.frame(x=c(s1+.5*l1,s2+.5*l2,s3+.5*l3,s4+.5*l4),
label=c('LG09 (A)','LG12 (B)','LG12 (C)','LG17 (D)')) %>%
mutate(sclr=1:4, Nx= (x+scling[sclr])/10000)
zmEND <- data.frame(x=c(s1,s1+l1,
s2,s2+l2,
s3,s3+l3,
s4,s4+l4)) %>%
mutate(sclr=rep(1:4,each=2),
Nx = ((x+scling[sclr])/10000)+rep(c(2.5,-4),4),
label=round((x/1000000),2))
textSCALE1 <- c(1.8,rep(NA,6),.7)
textSCALE2 <- c(2,rep(NA,6),1)
textSCALE3 <- c(3.5,rep(NA,6),1.75)
p1 <- ggplot(dt %>% filter(!is.na(Mval)),aes(fill=Mval))+
coord_equal()+
geom_polygon(inherit.aes = F,data=zmRange,
aes(x=Nx1+1,y=Nx2-1,group=grp),fill='lightgray')+
geom_polygon(inherit.aes = F,data=zmRange2,
aes(x=Nx1+11,y=Nx2-11,group=grp),fill=DG)+
geom_polygon(inherit.aes = F,data=zmRange3,
aes(x=Nx1+1.1,y=Nx2-1.1,group=grp),fill=DG)+
geom_polygon(inherit.aes = F,data=GZdf,
aes(x=Nx1,y=Nx2,group=grp),fill=Zcol)+
geom_segment(inherit.aes = F,data=genes,
aes(x=Nx1+1,y=Nx1-1,xend=Nx2+1,yend=Nx2-1),
col=Gcol,size=1.5)+
geom_tile(aes(x=miX,y=miY))+
geom_text(inherit.aes = F,data=zmEND,
aes(x=Nx+LGoffset,y=Nx-LGoffset,label=paste(label,'\n(Mb)')),
angle=45,size=textSCALE1[sel])+
geom_text(inherit.aes = F,data=genes,
aes(x=labPOS+GLABoffset,y=labPOS-GLABoffset,label=name),
angle=-45,fontface='italic',size=textSCALE2[sel])+
geom_text(inherit.aes = F,data=zmLab,
aes(x=Nx+LGoffset-.8,y=Nx-LGoffset+.8,label=label),
angle=-45,fontface='bold',size=textSCALE3[sel],col='white')+
scale_x_continuous(expand=c(0,0))+
scale_y_continuous(expand=c(0,0),
trans = 'reverse')+
scale_fill_gradientn(name=expression(bar(r^2)),colours=clr,
values=rescale(c(1,.08,.03,.015,.01,0)),
limits=c(0,1),guide = 'legend',breaks=c(0,.005,.01,.02,.03,.1,1))+
theme_void()+
theme(legend.position = c(.7,.75),legend.direction = 'vertical')
} else {
p1 <- ggplot(dt %>% filter(!is.na(Mval)),aes(fill=Mval))+
coord_equal()+
geom_segment(inherit.aes = F,data=genes,
aes(x=Nx1+1.5,y=Nx1-1.5,xend=Nx2+1.5,yend=Nx2-1.5),
col=Gcol,size=1)+
geom_tile(aes(x=miX,y=miY))+
scale_x_continuous(expand=c(0,0))+
scale_y_continuous(expand=c(0,0),
trans = 'reverse')+
scale_fill_gradientn(name=expression(bar(r^2)),colours=clr,
values=rescale(c(1,.08,.03,.015,.01,0)),
limits=c(0,1),guide = 'legend',breaks=c(0,.005,.01,.02,.03,.1,1))+
theme_void()+
theme(legend.position = c(.7,.75),legend.direction = 'vertical')
}
return(p1)
}
\ No newline at end of file
BW <- read.csv('../../2_output/08_popGen/07_LD/subsets/glob_between.interchrom.hap.ld',sep='\t') %>%
select(R.2) %>%
mutate(type='Global',run='Global')
for(j in 1:6){
flS <- c("boc","bel","hon","pue","nig","uni")
flL <- c("Panana","Belize","Honduras","H. puella","H. nigricans","H. unicolor")
flT <- c(rep('Geo',3),rep('Spec',3))
k <- flS[j]
q <- flL[j]
u <- flT[j]
print(j)
BW <- BW %>%
rbind(.,(read.csv(paste('../../2_output/08_popGen/07_LD/subsets/glob_between.',k,'.interchrom.hap.ld',sep=''),
sep='\t') %>%
select(R.2) %>%
mutate(type=u,run=q)))
}
BW$run <- factor(BW$run,levels=c('Global',"Panana","Belize","Honduras",
"H. nigricans","H. puella","H. unicolor"))
dt2 <- BW %>%
group_by(run) %>%
summarise(meanR2=mean(R.2,na.rm = T),medR2=median(R.2,na.rm = T)) %>%
gather(key = 'type',value = 'val',2:3)
BC <-rgb(.7,.7,.7)
clr <-colorRampPalette(colors = c('white',BC,'black'))(8)
pBOX <- ggplot(BW,aes(x=run,y=R.2))+
geom_boxplot(fill=BC,width=.7,outlier.size = .1)+
coord_fixed(ylim=c(0,.031),ratio = 250)+
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,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_y_continuous('genome wide r²')+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
guides(shape = guide_legend(ncol = 1))+
theme(legend.position = c(-.4,1.27),
text = element_text(size=10),
axis.title.x = element_blank(),
axis.text.y = element_text(size=7),
axis.text.x = element_text(size=7,angle=45,hjust = 1),
panel.background = element_blank(),
plot.background = element_blank())
\ No newline at end of file
dataBoxGenes <- data.frame(R.2=c(),run=c(),stringsAsFactors = F)
for (file in dir("../../2_output/08_popGen/07_LD/",pattern = "interchrom.hap.ld.gz")) {
nm <- str_remove_all(file, "spotlight.") %>% str_remove_all(.,".interchrom.hap.ld.gz")
if(nm %in% c("global","uni","pue","nig","hon","bel","boc")){
dataBoxGenes <- read.csv(gzfile(paste('../../2_output/08_popGen/07_LD/',file,sep='')),sep='\t') %>%
mutate(run = nm) %>%
select(R.2,run) %>%
rbind(dataBoxGenes,.)
}
}
dataBoxGenes$xS <- factor(dataBoxGenes$run,
levels = c("global","boc","bel","hon","nig","pue","uni"))
BoxGenes_summary <- dataBoxGenes %>%
group_by(xS) %>%
summarise(run = run[1],
meanR2 = mean(R.2,na.rm = T),
medR2 = median(R.2,na.rm = T),
sdR2 = sd(R.2,na.rm=T),
seR2 = se(R.2),
nanr = sum(is.na(R.2)),
minR2 = min(R.2,na.rm = T),
maxR2 = max(R.2,na.rm = T),
lengthR2 = length(R.2)) %>%
select(xS,meanR2,medR2) %>%
gather(key = 'type',value = 'val',2:3)
boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
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)+
coord_fixed(ylim=c(0,.06),ratio = 133)+
scale_y_continuous('peak area r²')+
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
guides(shape = guide_legend(ncol = 1))+
theme(legend.position = c(.35,1.27),
text = element_text(size=10),
axis.title.x = element_blank(),
axis.text.y = element_text(size=7),
axis.text.x = element_text(size=7,angle=45,hjust = 1),
panel.background = element_blank(),
plot.background = element_blank())
\ No newline at end of file
--- ---
output: html_document output: html_document
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
--- ---
# Figure 3 # Figure 3
......
This diff is collapsed.
--- ---
output: html_document output: html_document
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
--- ---
# Figure 5 # Figure 5
...@@ -22,4 +22,88 @@ cd $WORK/3_figures/F_scripts ...@@ -22,4 +22,88 @@ cd $WORK/3_figures/F_scripts
Rscript --vanilla F5.R Rscript --vanilla F5.R
rm Rplots.pdf rm Rplots.pdf
``` ```
\ No newline at end of file ## Details of F5.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 data managing and genomic data packages.
It Furthermore depends on the R scripts `F4.functions.R` (located under `$WORK/0_data/0_scripts`).
This script is a modification of sript F4.R. It uses the same funtions and just differs in the data sets and settings
```{r head,results='hide',message=FALSE}
library(tidyverse)
library(scales)
library(cowplot)
library(grid)
library(gridSVG)
library(grImport2)
source('../../0_data/0_scripts/F4.functions.R')
```
The script `F4.functions.R`contains a function (`trplot()`) that plots a single LD triangle as seen in Figure 5.
The Details of this script are explained below.
The output depends on the data set plotted (sub figure a contains additional annotations).
We create an empty list that is then filled with the subplots using the `trplot()` function.
```{r basePlot,results='hide',message=FALSE}
plts <- list()
for(k in 1:3){
plts[[k]] <- trplot((8:10)[k])
}
```
The basic plots are transformed into `grid obgects`.
These are afterwards rotated by 45 degrees.
```{r grobPlot,results='hide', message=FALSE, warning=FALSE}
tN <- theme(legend.position = 'none')
pG8 <- ggplotGrob(plts[[1]]+tN)
pG9 <- ggplotGrob(plts[[2]]+tN)
pG10 <- ggplotGrob(plts[[3]]+tN)
pGr8 <- editGrob(pG8, vp=viewport(x=0.5, y=0.97, angle=45,width = .76), name="pG8")
pGr9 <- editGrob(pG9, vp=viewport(x=0.5, y=0.62, angle=45,width = .7), name="pG9")
pGr10 <- editGrob(pG10, vp=viewport(x=0.5, y=0.3, angle=45,width = .7), name="pG10")
```
Then, external annotations loaded and the legend ins extracted from the first plot.
```{r annotatePlot,results='hide', message=FALSE, warning=FALSE}
npGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/pue-nig-cairo.svg"))))
puGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/uni-pue-cairo.svg"))))
nuGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/nig-uni-cairo.svg"))))
leg <- get_legend(plts[[1]]+theme(legend.text = element_text(size = 5),
legend.title = element_text(size = 5),
legend.key.size = unit(7,'pt')))
```
Finally, the complete Figure 5 is put together.
```{r finalPlot,results='hide', message=FALSE, warning=FALSE}
F5 <- ggdraw(pGr8)+
draw_grob(pGr9,0,0,1,1)+
draw_grob(leg,-.65,.04,1,1)+
draw_grob(pGr10,0,0,1,1)+
draw_grob(npGrob, 0.7, 0.7, 0.28, 0.1)+
draw_grob(nuGrob, 0.7, 0.37, 0.28, 0.1)+
draw_grob(puGrob, 0.7, .04, 0.28, 0.1)
```
The final figure is then exported using `ggsave()`.
```{r, eval=FALSE}
#ggsave(plot = F5,filename = '../output/F5.pdf',width = 91.5,height = 145,units = 'mm',device = cairo_pdf)
ggsave(plot = F5,filename = '../output/F5.png',width = 91.5,height = 145,units = 'mm',dpi = 150)
```
<center>
```{r f5SHOW, echo=FALSE, fig.height=145*0.03937008, fig.width=91.5*0.03937008, warning=FALSE}
F5
```
</center>
---
\ No newline at end of file
This diff is collapsed.
#!/usr/bin/env Rscript
library(tidyverse)
library(scales)
library(cowplot)
library(grid)
library(gridSVG)
library(grImport2)
source('../../0_data/0_scripts/F4.functions.R')
plts <- list()
for(k in 1:3){
plts[[k]] <- trplot((8:10)[k])
}
tN <- theme(legend.position = 'none')
pG8 <- ggplotGrob(plts[[1]]+tN)
pG9 <- ggplotGrob(plts[[2]]+tN)
pG10 <- ggplotGrob(plts[[3]]+tN)
pGr8 <- editGrob(pG8, vp=viewport(x=0.5, y=0.97, angle=45,width = .76), name="pG8")
pGr9 <- editGrob(pG9, vp=viewport(x=0.5, y=0.62, angle=45,width = .7), name="pG9")
pGr10 <- editGrob(pG10, vp=viewport(x=0.5, y=0.3, angle=45,width = .7), name="pG10")
npGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/pue-nig-cairo.svg"))))
puGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/uni-pue-cairo.svg"))))
nuGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/nig-uni-cairo.svg"))))
leg <- get_legend(plts[[1]]+theme(legend.text = element_text(size = 5),
legend.title = element_text(size = 5),
legend.key.size = unit(7,'pt')))
F5 <- ggdraw(pGr8)+
draw_grob(pGr9,0,0,1,1)+
draw_grob(leg,-.65,.04,1,1)+
draw_grob(pGr10,0,0,1,1)+
draw_grob(npGrob, 0.7, 0.7, 0.28, 0.1)+
draw_grob(nuGrob, 0.7, 0.37, 0.28, 0.1)+
draw_grob(puGrob, 0.7, .04, 0.28, 0.1)
#ggsave(plot = F5,filename = '../output/F5.pdf',width = 91.5,height = 145,units = 'mm',device = cairo_pdf)
ggsave(plot = F5,filename = '../output/F5.png',width = 91.5,height = 145,units = 'mm',dpi = 150)
\ No newline at end of file
# S01 ---
output: html_document
editor_options:
chunk_output_type: console
---
# Supplement Figure S01
This is the accessory documentation of Supplementary Figure 01. This is the accessory documentation of Supplementary Figure 01.
It explains the steps of script **2.2.0.1.maf2circos.sh** and documents progression from the whole genome alignment of the *de novo* *Hypoplectrus puella* genome assembly with the *Gasterosteus aculeatus* reference genome. It explains the steps of script **2.2.0.1.maf2circos.sh** and documents progression from the whole genome alignment of the *de novo* *Hypoplectrus puella* genome assembly with the *Gasterosteus aculeatus* reference genome.
......
# S08 ---
output: html_document
editor_options:
chunk_output_type: console
---
# Supplement Figure S08
```{r setup, include=FALSE} ```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE) knitr::opts_chunk$set(echo = TRUE)
......
...@@ -31,6 +31,12 @@ edgR <- function(pts,edg){ ...@@ -31,6 +31,12 @@ edgR <- function(pts,edg){
## Info ## Info
In the following, I give an overview over the individual steps done in during *de novo* assembly of the barred hamlet (*Hypoplectrus puella*) genome. In the following, I give an overview over the individual steps done in during *de novo* assembly of the barred hamlet (*Hypoplectrus puella*) genome.
Within the scheme, each arrow represents a script (or class of scripts) connecting individual setps of the assembly/ analysis.
The respective scripts are store in the folders `$WORK/1_assembly_scripts` & `$WORK/2_reSeq-scripts`.
For the final visualization (the green squares in panel 2.2.Popgen), additional documetation is provided in the following pages.
```{r data_prep,echo=FALSE} ```{r data_prep,echo=FALSE}
source('workflow/points_and_edges_assembly.R') source('workflow/points_and_edges_assembly.R')
source('workflow/points_and_edges_analysis.R') source('workflow/points_and_edges_analysis.R')
......
...@@ -118,6 +118,8 @@ gwFST <- read.csv('../../2_output/08_popGen/05_fst/genome_wide_weighted_mean_fst ...@@ -118,6 +118,8 @@ gwFST <- read.csv('../../2_output/08_popGen/05_fst/genome_wide_weighted_mean_fst
gwFST$RUN <- factor(gwFST$run,levels=levels(data$RUN)) gwFST$RUN <- factor(gwFST$run,levels=levels(data$RUN))
``` ```
### Computing 99.98 *F~ST~* percentiles
The upper 99.98 *F~ST~* percintile is computed per run. The upper 99.98 *F~ST~* percintile is computed per run.
Then windows above this threshold are indentified for each global run. Then windows above this threshold are indentified for each global run.
...@@ -153,6 +155,8 @@ musks <- data2 %>% group_by(musk) %>% summarise(MUSKmin=min(xmin), ...@@ -153,6 +155,8 @@ musks <- data2 %>% group_by(musk) %>% summarise(MUSKmin=min(xmin),
MUSKmin-1e+07,MUSKmax+1e+07)) MUSKmin-1e+07,MUSKmax+1e+07))
``` ```
### Plotting
For plotting, colors,labels and the scaling of the secondary axis are pre-defined. For plotting, colors,labels and the scaling of the secondary axis are pre-defined.
...@@ -234,6 +238,8 @@ yd <- .2195 ...@@ -234,6 +238,8 @@ yd <- .2195
boxes = data.frame(x=rep(.9675,4),y=c(ys,ys+yd+ysc,ys+(yd+ysc)*2,ys+(yd+ysc)*3)) boxes = data.frame(x=rep(.9675,4),y=c(ys,ys+yd+ysc,ys+(yd+ysc)*2,ys+(yd+ysc)*3))
``` ```
### Composing the final figure
And finally the base plot is combined with the external annotations. And finally the base plot is combined with the external annotations.
......
--- ---
output: html_document output: html_document
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
--- ---
# Figure 3 # Figure 3
......
This diff is collapsed.
--- ---
output: html_document output: html_document
editor_options: editor_options:
chunk_output_type: console chunk_output_type: console
--- ---
# Figure 5 # Figure 5
...@@ -20,3 +20,91 @@ Rscript --vanilla F5.R ...@@ -20,3 +20,91 @@ Rscript --vanilla F5.R
rm Rplots.pdf rm Rplots.pdf
``` ```
## Details of F5.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 data managing and genomic data packages.
It Furthermore depends on the R scripts `F4.functions.R` (located under `$WORK/0_data/0_scripts`).
This script is a modification of sript F4.R. It uses the same funtions and just differs in the data sets and settings
```r
library(tidyverse)
library(scales)
library(cowplot)
library(grid)
library(gridSVG)
library(grImport2)
source('../../0_data/0_scripts/F4.functions.R')
```
The script `F4.functions.R`contains a function (`trplot()`) that plots a single LD triangle as seen in Figure 5.
The Details of this script are explained below.
The output depends on the data set plotted (sub figure a contains additional annotations).
We create an empty list that is then filled with the subplots using the `trplot()` function.
```r
plts <- list()
for(k in 1:3){
plts[[k]] <- trplot((8:10)[k])
}
```
The basic plots are transformed into `grid obgects`.
These are afterwards rotated by 45 degrees.
```r
tN <- theme(legend.position = 'none')
pG8 <- ggplotGrob(plts[[1]]+tN)
pG9 <- ggplotGrob(plts[[2]]+tN)
pG10 <- ggplotGrob(plts[[3]]+tN)
pGr8 <- editGrob(pG8, vp=viewport(x=0.5, y=0.97, angle=45,width = .76), name="pG8")
pGr9 <- editGrob(pG9, vp=viewport(x=0.5, y=0.62, angle=45,width = .7), name="pG9")
pGr10 <- editGrob(pG10, vp=viewport(x=0.5, y=0.3, angle=45,width = .7), name="pG10")
```
Then, external annotations loaded and the legend ins extracted from the first plot.
```r
npGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/pue-nig-cairo.svg"))))
puGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/uni-pue-cairo.svg"))))
nuGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/nig-uni-cairo.svg"))))
leg <- get_legend(plts[[1]]+theme(legend.text = element_text(size = 5),
legend.title = element_text(size = 5),
legend.key.size = unit(7,'pt')))
```
Finally, the complete Figure 5 is put together.
```r
F5 <- ggdraw(pGr8)+
draw_grob(pGr9,0,0,1,1)+
draw_grob(leg,-.65,.04,1,1)+
draw_grob(pGr10,0,0,1,1)+
draw_grob(npGrob, 0.7, 0.7, 0.28, 0.1)+
draw_grob(nuGrob, 0.7, 0.37, 0.28, 0.1)+
draw_grob(puGrob, 0.7, .04, 0.28, 0.1)
```
The final figure is then exported using `ggsave()`.
```r
#ggsave(plot = F5,filename = '../output/F5.pdf',width = 91.5,height = 145,units = 'mm',device = cairo_pdf)
ggsave(plot = F5,filename = '../output/F5.png',width = 91.5,height = 145,units = 'mm',dpi = 150)
```
<center>
<img src="F5_files/figure-html/f5SHOW-1.png" width="345.82678272" />
</center>
---
...@@ -5,6 +5,12 @@ ...@@ -5,6 +5,12 @@
In the following, I give an overview over the individual steps done in during *de novo* assembly of the barred hamlet (*Hypoplectrus puella*) genome. In the following, I give an overview over the individual steps done in during *de novo* assembly of the barred hamlet (*Hypoplectrus puella*) genome.
Within the scheme, each arrow represents a script (or class of scripts) connecting individual setps of the assembly/ analysis.
The respective scripts are store in the folders `$WORK/1_assembly_scripts` & `$WORK/2_reSeq-scripts`.
For the final visualization (the green squares in panel 2.2.Popgen), additional documetation is provided in the following pages.
<center> <center>
<img src="Workflow_files/figure-html/plot-1.png" width="2304" /> <img src="Workflow_files/figure-html/plot-1.png" width="2304" />
</center> </center>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<meta name="author" content="Kosmas Hench"> <meta name="author" content="Kosmas Hench">
<meta name="date" content="2018-06-13"> <meta name="date" content="2018-06-14">