Commit 7df22ce7 authored by Kosmas Hench's avatar Kosmas Hench

figures docs done

parent 961c6de3
- F1 from R script to Rmd
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,7 @@
version="1.1"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="legend-map-cairo (copy).svg">
sodipodi:docname="legend-map.svg">
<metadata
id="metadata1797">
<rdf:RDF>
......@@ -41,13 +41,13 @@
inkscape:window-height="1056"
id="namedview1795"
showgrid="false"
inkscape:zoom="2.2358842"
inkscape:cx="294.64476"
inkscape:cy="132.99246"
inkscape:zoom="3.1620178"
inkscape:cx="226.77122"
inkscape:cy="18.108575"
inkscape:window-x="1360"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="surface1" />
inkscape:current-layer="g569" />
<defs
id="defs4">
<g
......@@ -1454,16 +1454,21 @@
height="100%" />
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:6px;line-height:125%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="278.62106"
y="159.27197"
id="text6705"
style="font-style:normal;font-weight:normal;font-size:30px;line-height:125%;font-family:sans-serif;text-align:end;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
x="270.91306"
y="156.66864"
id="text5050"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan6707"
x="278.62106"
y="159.27197"
style="font-style:italic;font-size:6px">H. sp</tspan></text>
id="tspan5052"
x="270.91306"
y="156.66864"
style="font-style:italic;font-size:5.5px;text-align:center;text-anchor:middle;letter-spacing:-0.08px">Hypoplectrus</tspan><tspan
sodipodi:role="line"
x="270.91306"
y="164.16864"
id="tspan5054"
style="font-style:italic;font-size:5.5px;text-align:center;text-anchor:middle;letter-spacing:-0.08px">sp.</tspan></text>
</g>
<g
id="g5945"
......
LG04 5835001 5925000 1
LG04 6555001 6645000 2
LG08 1945001 2090000 3
LG08 9505001 9595000 4
LG08 10270001 10420000 5
LG08 12810001 12895000 6
LG08 12945001 13010000 7
LG08 14825001 14875000 8
LG09 17820001 17930000 9
LG09 20995001 21085000 10
LG12 15050001 15105000 11
LG12 20085001 20355000 12
LG12 22150001 22290000 13
LG17 21340001 21415000 14
LG17 22505001 22660000 15
LG20 13840001 13900000 16
LG23 13965001 14030000 17
LG23 15445001 15530000 18
......@@ -134,11 +134,13 @@ trplot <- function(sel){
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))+
scale_fill_gradientn(name=expression(bar(italic(r)^2)),colours=clr,
values=rescale(c(1,.5,.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')
theme(legend.position = c(.9,.75),
legend.direction = 'vertical')
} else {
p1 <- ggplot(dt %>% filter(!is.na(Mval)),aes(fill=Mval))+
coord_equal()+
......
......@@ -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)+
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_y_continuous('genome wide ILD (r²)')+
scale_y_continuous(name=expression(genome~wide~ILD~(italic(r)^2)))+
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),
......
......@@ -31,7 +31,7 @@ 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,.031),ratio = 250)+
scale_y_continuous('ILD around \ncandidate genes (r²)')+
scale_y_continuous(expression(candidate~gene~ILD~(italic(r)^2)))+
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'))+
......@@ -39,6 +39,7 @@ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
theme(legend.position = c(.35,1.27),
text = element_text(size=10),
axis.title.x = element_blank(),
axis.title.y = element_text(hjust=1.25),
axis.text.y = element_text(size=7),
axis.text.x = element_text(size=7,angle=45,hjust = 1),
panel.background = element_blank(),
......
......@@ -188,7 +188,7 @@ trplot <- function(sel){
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,
scale_fill_gradientn(name=expression(bar(italic(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))+
scale_color_manual(values=viridis_pal(option='A')(6))+theme_void()+
......
get_anno_df_single_line <- function(searchLG,gfffile,
xrange,
anno_rown=4){
gff_filter <- list(seqid=searchLG)
data <- as.data.frame(readGFF(gfffile,filter=gff_filter)) %>% mutate(Parent=as.character(Parent))#%>%
#rowwise() %>% mutate(Parent=ifelse(length(Parent)==0,ID,Parent))
mRNAs <- data %>% filter(type=='mRNA',end>xrange[1],start<xrange[2]) %>%
ungroup() %>% mutate(yl=row_number()%%anno_rown+2) %>% rowwise()%>%
mutate(checkStart =ifelse(start<xrange[1],-Inf,start),
checkEnd =ifelse(end>xrange[2],Inf,end),
ps=ifelse(strand=='-',checkEnd,checkStart),
pe=ifelse(strand=='-',checkStart,checkEnd),
labelx=mean(c(sort(c(xrange[1],ps))[2],
sort(c(xrange[2],pe))[1])),
window='bold(Gene)') %>%
select(-Parent);
names(mRNAs)[names(mRNAs)=='ID'] <- 'Parent'
exons <- data %>% filter(type=='exon',end>xrange[1],start<xrange[2]) %>%
merge(.,mRNAs %>% select(Parent,yl),by='Parent',all.x=T) %>%
mutate(ps=ifelse(strand=='-',end,start),
pe=ifelse(strand=='-',start,end),
window='bold(Gene)')
return(list(mRNAs,exons))}
create_K_plot <- function(searchLG,gfffile,xr,xr2,muskID){
source('../../0_data/0_scripts/S14.functions.R');
source('../../0_data/0_scripts/F3.getFSTs.R')
highclr <- '#3bb33b'
theme_set(theme_minimal(base_size = 6))
if(xr[1]>xr[2]){print('error: ill conditioned x-range')}
wdth <- .3
# get gene models
df_list <- get_anno_df_single_line(searchLG=searchLG,gfffile=gfffile,xrange=xr,anno_rown=4)
# get fst values
fst_list <- getFSTS(searchLG,xr,c(),highclr)
# data_fst_pw<-fst_list$data_fst_pw;
global_fst<-fst_list$global_fst;
data_fst<-fst_list$data_fst
clr <- c('#fb8620','#1b519c','#d93327')
annoclr <- c('lightgray',highclr,rgb(.3,.3,.3))[1:3]
df_list[[1]] <- df_list[[1]] %>%
rowwise() %>%
mutate(label=unlist(strsplit(tolower(Parentgenename), "_"))[1])
LW <- .3;lS <- 9;tS <- 6
plotSET <- theme(rect = element_blank(),
text=element_text(size=tS,color='black'),
panel.grid.major = element_line(colour = rgb(.92,.92,.92)),
panel.grid.minor = element_line(colour = rgb(.95,.95,.95)),
plot.background = element_blank(),
plot.margin = unit(c(3,7,3,3),'pt'),
panel.background = element_blank(),#element_rect(colour = 'gray',fill=NULL),
legend.position = 'none',#c(.8,.3),
legend.direction = 'horizontal',
axis.title.y = element_blank(),
axis.title.x = element_blank(),#element_text(size=13,face='bold',color='black'),
strip.text.y = element_text(size=lS,color='black'),
axis.text.x = element_blank(),#element_text(size=11,color='black'),
strip.placement = "outside",
panel.border = element_blank()
)
Gclr=rgb(.3,.3,.3)
range_df <- data.frame(x=xr2[1],x2=xr2[2])
range_clr <- rgb(0,0,.4,.1)
p11 <- ggplot()+coord_cartesian(xlim=xr/1000)+
geom_rect(data=range_df,aes(xmin = x/1000,xmax=x2/1000,ymin=-Inf,ymax=Inf),
col=range_clr,fill=range_clr)+
geom_rect(data=df_list[[2]],
aes(xmin=ps/1000,xmax=pe/1000,ymin=yl-(wdth/2),ymax=yl+(wdth/2),group=Parent),
col=Gclr,fill=Gclr,lwd=.1)+
geom_segment(data=(df_list[[1]]%>%filter(strand%in%c('+','-'))),
aes(x=ps/1000,xend=pe/1000,y=yl,yend=yl,group=Parent),lwd=.1,
arrow=arrow(length=unit(2,"pt"),type='closed'),color='black')+
geom_segment(data=(df_list[[1]]%>%filter(!strand%in%c('+','-'))),
aes(x=ps/1000,xend=pe/1000,y=yl,yend=yl,group=Parent),lwd=.2,color='black')+
geom_text(data=df_list[[1]],
aes(x=labelx/1000,label=gsub('000000','...',label),y=yl-.5),size=1.8)+
facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = T)+
# color settings
#scale_color_manual(values=annoclr,breaks=c("x","y","z"),guide=F)+
#scale_fill_manual(values=annoclr,guide=F)+
scale_x_continuous(name=paste0(searchLG,' (',muskID,', kb)'),expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.75,length.out = 4))+
theme(rect = element_blank(),
text=element_text(size=tS,color='black'),
panel.grid.major = element_blank(),#element_line(colour = rgb(.92,.92,.92)),
panel.grid.minor = element_blank(),#element_line(colour = rgb(.95,.95,.95)),
plot.background = element_blank(),
panel.background = element_blank(),#element_rect(colour = 'gray',fill=NULL),
# plot.margin = unit(c(3,3,3,3),'pt'),
legend.position = c(.8,.3),
legend.direction = 'horizontal',
axis.title.y = element_blank(),
axis.title.x = element_text(size=lS,face='bold',color='black'),
strip.text.y = element_text(size=lS,color='black'),
axis.text.x = element_text(size=tS,color='black'),
strip.placement = "outside",
panel.border = element_blank()
);
p12 <- ggplot()+coord_cartesian(xlim=xr)+
geom_rect(data=range_df,aes(xmin = x,xmax=x2,ymin=-Inf,ymax=Inf),
col=range_clr,fill=range_clr)+
geom_point(data=global_fst,aes(x=POS,y=WEIR_AND_COCKERHAM_FST),col=global_fst$clr,size=.2)+
geom_point(data=global_fst,aes(x=POS,y=WEIR_AND_COCKERHAM_FST),col=global_fst$clr2,size=.3)+
# add pairwise fsts as lines (10 kb / 1kb)
geom_line(data=(data_fst %>% filter(POS > xr[1],POS<xr[2]))
,aes(x=POS,y=WEIGHTED_FST,col=run),lwd=LW)+
# geom_line(data=(data_fst_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=WEIGHTED_FST,col=run,linetype=group),lwd=1)+
scale_color_manual(values=c(clr,annoclr),breaks=c("nig-pue","nig-uni","pue-uni"),guide=F)+
scale_fill_manual(values=annoclr,guide=F)+
facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = T)+
scale_x_continuous(name=searchLG,expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.75,length.out = 4))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p2 <- plot_grid(p11,p12,
ncol = 1,align = 'v',axis = 'r',rel_heights = c(1.3,1))
return(p2)}
\ No newline at end of file
......@@ -11,4 +11,4 @@ path.hold <- getwd()
your.NH <- paste0(args[3],"/newhybrids/")
parallelnh_OSX(folder.data = paste0(path.hold,"/",args[1],"/"),
where.NH = your.NH, burnin = 1000000, sweeps = 3000000)
\ No newline at end of file
where.NH = your.NH, burnin = 1000000, sweeps = 10000000)
\ No newline at end of file
......@@ -24,7 +24,7 @@ vcftools \
--thin 3000 \
--out $WORK/2_output/08_popGen/11_newHyb/NHrecode/newHyb.$k \
--positions $WORK/2_output/08_popGen/11_newHyb/snpSets/filterSet.1k.$k.snps \
--recode \
--recode
$WORK/0_data/0_scripts/subsetVcf newHyb.$k.recode.vcf 120
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
......@@ -264,8 +264,8 @@ F2 <- ggdraw(p1)+
The *F~ST~* outlier windows are then exported to be used as reference in other figures.
```{r exportMusks, eval=FALSE}
write.table(x = data2, file = 'fst_outlier_windows.txt',sep='\t',quote = F,row.names = F)
write.table(x = musks, file = 'fst_outlier_ID.txt',sep='\t',quote = F,row.names = F)
write.table(x = data2, file = '../../0_data/0_resources/fst_outlier_windows.txt',sep='\t',quote = F,row.names = F)
write.table(x = musks, file = '../../0_data/0_resources/fst_outlier_ID.txt',sep='\t',quote = F,row.names = F)
```
......
......@@ -369,7 +369,7 @@ Then, the base plot is created and stored in `p1`.
scale_y_continuous(expand=c(0,0),
trans = 'reverse')+
# manual color gradient for LD data
scale_fill_gradientn(name=expression(bar(r^2)),colours=clr,
scale_fill_gradientn(name=expression(bar(italic(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))+
# plot layout theme
......@@ -480,7 +480,7 @@ pBOX <- ggplot(BW,aes(x=run,y=R.2))+
# settting the axis and color labels
scale_x_discrete(labels = expression(Global,Panama,Belize,Honduas,
italic("H. nigricans"),italic("H. puella"),italic("H. unicolor")))+
scale_y_continuous('genome wide ILD (r²)')+
scale_y_continuous(name=expression(genome~wide~ILD~(italic(r)^2)))+
scale_fill_manual('',values = clr[c(6,1)],labels=c('mean','median'))+
# formatting the legend
guides(shape = guide_legend(ncol = 1))+
......@@ -555,7 +555,7 @@ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
# set a fixed aspect ratio
coord_fixed(ylim=c(0,.031),ratio = 133)+
# settting the axis and color labels
scale_y_continuous('ILD around \ncandidate genes (r²)')+
scale_y_continuous(expression(candidate~gene~ILD~(italic(r)^2)))+
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'))+
......@@ -565,6 +565,7 @@ boxGenes <- ggplot(dataBoxGenes,aes(x=xS))+
theme(legend.position = c(.35,1.27),
text = element_text(size=10),
axis.title.x = element_blank(),
axis.title.y = element_text(hjust=1.25),
axis.text.y = element_text(size=7),
axis.text.x = element_text(size=7,angle=45,hjust = 1),
panel.background = element_blank(),
......
......@@ -87,7 +87,7 @@ 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(leg,-.85,.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)+
......@@ -98,7 +98,7 @@ 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)
ggsave(plot = F5,filename = '../output/F5.png',width = 91.5,height = 155,units = 'mm',dpi = 150)
```
<center>
......
......@@ -130,8 +130,8 @@ p1 <- ggplot()+
)+
facet_grid(RUN~.)
write.table(x = data2, file = 'fst_outlier_windows.txt',sep='\t',quote = F,row.names = F)
write.table(x = musks, file = 'fst_outlier_ID.txt',sep='\t',quote = F,row.names = F)
write.table(x = data2, file = '../../0_data/0_resources/fst_outlier_windows.txt',sep='\t',quote = F,row.names = F)
write.table(x = musks, file = '../../0_data/0_resources/fst_outlier_ID.txt',sep='\t',quote = F,row.names = F)
legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend-pw-cairo.svg"))))
carGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/caribbean-cairo.svg"))))
......
......@@ -32,10 +32,10 @@ leg <- get_legend(plts[[1]]+theme(legend.text = element_text(size = 5),
F5 <- ggdraw(pGr8)+
draw_grob(pGr9,0,0,1,1)+
draw_grob(leg,-.65,.04,1,1)+
draw_grob(leg,-.85,.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.png',width = 91.5,height = 145,units = 'mm',dpi = 150)
\ No newline at end of file
ggsave(plot = F5,filename = '../output/F5.png',width = 91.5,height = 155,units = 'mm',dpi = 150)
\ No newline at end of file
......@@ -6,8 +6,8 @@ library(grConvert)
library(tidyverse)
library(cowplot)
convertPicture("circos.svg",'circos-cairo.svg')
cir <- gTree(children=gList(pictureGrob(readPicture("circos-cairo.svg"))))
convertPicture("../S01/circos.svg",'../S01/circos-cairo.svg')
cir <- gTree(children=gList(pictureGrob(readPicture("../S01/circos-cairo.svg"))))
GA <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/GA-cairo.svg"))))
HP <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/puella-cairo.svg"))))
......
......@@ -64,8 +64,8 @@ data$RUN <- factor(as.character(data$RUN),
levels=c('PN','NU','PU','PPNP','NPUP','PPUP','PBNB','NBUB','PBUB','PHNH','NHUH','PHUH'))
data$COL <- factor(as.character(data$COL),levels=c('PN','PU','NU'))
data2 <- read.csv('fst_outlier_windows.txt', sep='\t')
musks <- read.csv('fst_outlier_ID.txt', sep='\t')
data2 <- read.csv('../../0_data/0_resources/fst_outlier_windows.txt', sep='\t')
musks <- read.csv('../../0_data/0_resources/fst_outlier_ID.txt', sep='\t')
clr <- c('#fb8620','#d93327','#1b519c')
annoclr <- rgb(.4,.4,.4)
......
......@@ -49,7 +49,7 @@ sX <- -.03;
S07 <- ggdraw(pGr1)+
draw_plot(pGRAD,.307,-.018,.16,.53)+
draw_grob(pGr2,0,0,1,1)+
draw_grob(leg,.15,-.08,1,1)+
draw_grob(leg,.2,-.08,1,1)+
draw_grob(pGr3,0,0,1,1)+
draw_grob(pGr4,0,0,1,1)+
draw_grob(pGr5,0,0,1,1)+
......
......@@ -54,11 +54,11 @@ data$RUN <- factor(as.character(data$RUN),
levels=c('BH','BP','HP','BHN','BPN','HPN','BHP','BPP','HPP','BHU','BPU','HPU'))
data$COL <- factor(as.character(data$COL),levels=c('BH','BP','HP'))
data2 <- read.csv('fst_outlier_windows.txt', sep='\t') %>%
data2 <- read.csv('../../0_data/0_resources/fst_outlier_windows.txt', sep='\t') %>%
select(-RUN) %>%
group_by(musk) %>%
summarise_all(function(x){x[1]})
musks <- read.csv('fst_outlier_ID.txt', sep='\t') %>%
musks <- read.csv('../../0_data/0_resources/fst_outlier_ID.txt', sep='\t') %>%
select(-RUN) %>%
group_by(musk) %>%
summarise_all(function(x){x[1]}) %>%
......
......@@ -54,11 +54,11 @@ data$RUN <- factor(as.character(data$RUN),
levels=c('BH','BP','HP','BHN','BPN','HPN','BHP','BPP','HPP','BHU','BPU','HPU'))
data$COL <- factor(as.character(data$COL),levels=c('BH','BP','HP'))
data2 <- read.csv('fst_outlier_windows.txt', sep='\t') %>%
data2 <- read.csv('../../0_data/0_resources/fst_outlier_windows.txt', sep='\t') %>%
select(-RUN) %>%
group_by(musk) %>%
summarise_all(function(x){x[1]})
musks <- read.csv('fst_outlier_ID.txt', sep='\t') %>%
musks <- read.csv('../../0_data/0_resources/fst_outlier_ID.txt', sep='\t') %>%
select(-RUN) %>%
group_by(musk) %>%
summarise_all(function(x){x[1]}) %>%
......
......@@ -37,4 +37,4 @@ S12 <- ggdraw(pGr8)+
draw_grob(nuGrob, 0.7, 0.34, 0.28, 0.1)+
draw_grob(puGrob, 0.7, .01, 0.28, 0.1)
ggsave(plot = S12,filename = '../output/S12.png',width = 91.5,height = 155,units = 'mm',dpi = 150)
\ No newline at end of file
ggsave(plot = S12,filename = '../output/S12.png',width = 91.5,height = 160,units = 'mm',dpi = 150)
\ No newline at end of file
......@@ -64,7 +64,8 @@ p3 <- plotPCA(pca=panPCA, dataAll=(dataAll %>% filter(spec!='gum')), locIN='boc'
cp1 <- plot_grid(pbel+theme(legend.position = 'none'),p1,
phon+theme(legend.position = 'none'),p2,
pboc+theme(legend.position = 'none'),p3,
ncol = 2,rel_heights = c(1,1,1),rel_widths = c(0.65,0.35));
ncol = 2,rel_heights = c(1,1,1),
rel_widths = c(0.65,0.35),labels=c('a','b',rep('',4)),label_size = 10);
legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend_NH-cairo.svg"))))
belGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/belize-cairo.svg"))))
......@@ -76,22 +77,23 @@ ysc <- .008
yd <- .3025
labX <- .675
bclr <- rgb(.9,.9,.9)
boxes = data.frame(x=rep(labX-.015,3),y=c(ys,ys+yd+ysc,ys+(yd+ysc)*2))
boxes = data.frame(x=rep(labX-.015,3),
y=c(ys,ys+yd+ysc,ys+(yd+ysc)*2))
S13 <- ggdraw()+
geom_rect(data = boxes, aes(xmin = x, xmax = x + .03, ymin = y, ymax = y + yd),
geom_rect(data = boxes, aes(xmin = x, xmax = x + .03, ymin = y+.07, ymax = y + yd+c(.07,.07,.05)),
colour = NA, fill = c(rep(bclr,3)))+
draw_label('Belize', x = labX, y = boxes$y[3]+.13,
draw_label('Belize', x = labX, y = boxes$y[3]+.20,
size = 13, angle=-90)+
draw_label('Honduras', x = labX, y = boxes$y[2]+.13,
draw_label('Honduras', x = labX, y = boxes$y[2]+.20,
size = 13, angle=-90)+
draw_label('Panama', x = labX, y = boxes$y[1]+.13,
draw_label('Panama', x = labX, y = boxes$y[1]+.20,
size = 13, angle=-90)+
draw_label('Posterior probability',x=.01,y=.5,size = 15, angle=90)+
draw_grob(legGrob,0,.93,1,.07)+
draw_plot(cp1,.0,0,1,.93)+
draw_grob(belGrob, labX-.0225, boxes$y[3]+.84*yd, .045, .045)+
draw_grob(honGrob, labX-.0225, boxes$y[2]+.84*yd, .045, .045)+
draw_grob(panGrob, labX-.0225, boxes$y[1]+.84*yd, .045, .045)
draw_label('Posterior probability',x=.01,y=.57,size = 15, angle=90)+
draw_grob(legGrob,0,0,1,.07)+
draw_plot(cp1,.0,.07,1,.93)+
draw_grob(belGrob, labX-.0225, boxes$y[3]+.84*yd+.05, .045, .045)+
draw_grob(honGrob, labX-.0225, boxes$y[2]+.84*yd+.07, .045, .045)+
draw_grob(panGrob, labX-.0225, boxes$y[1]+.84*yd+.07, .045, .045)
ggsave(plot = S13,filename = '../output/S13.pdf',width = 183,height = 235,units = 'mm',device = cairo_pdf)
#!/usr/bin/env Rscript
library(grid)
library(gridSVG)
library(grImport2)
library(grConvert)
library(tidyverse)
library(rtracklayer)
library(hrbrthemes)
library(cowplot)
require(rtracklayer)
source('../../0_data/0_scripts/S14.plot_fun.R')
dat <- read.csv('../../0_data/0_resources/outlier_regions.bed',sep='\t',header = FALSE,stringsAsFactors = FALSE)
mar <- 10^5
mI <- c('-E','','-F',rep('',3),'-G','','-A',rep('',2),'-B','-C','','-D','-H',rep('',2))
plts <- list()
for(k in 1:18){
print(k)
x1 <- dat$V2[k]
x2 <- dat$V3[k]
plts[[k]] <- create_K_plot(searchLG = dat$V1[k],
gfffile = '../../1-output/09_gff_from_IKMB/HP.annotation.named.gff',
xr = c(x1-mar,x2+mar),
xr2=c(x1,x2),
muskID = paste0(k,mI[k]))
}
legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend-pw-cairo.svg"))))
p1 <- plot_grid(plts[[1]],plts[[2]],
plts[[3]], plts[[4]],
plts[[5]],plts[[6]],
labels=letters[1:6],label_size = 10,
ncol=2)
S14a <- ggdraw()+
draw_plot(p1,0,.05,1,.95)+
draw_plot(legGrob,0,0,1,.05)
p2 <- plot_grid(plts[[7]],plts[[8]],
plts[[9]], plts[[10]],
plts[[11]],plts[[12]],
labels=letters[7:12],label_size = 10,
ncol=2)
S14b <- ggdraw()+
draw_plot(p2,0,.05,1,.95)+
draw_plot(legGrob,0,0,1,.05)
p3 <- plot_grid(plts[[13]],plts[[14]],
plts[[15]], plts[[16]],
plts[[17]],plts[[17]],
labels=letters[13:18],label_size = 10,
ncol=2)
S14c <- ggdraw()+
draw_plot(p3,0,.05,1,.95)+
draw_plot(legGrob,0,0,1,.05)
ggsave(plot = S14a,filename = '../output/S14a.pdf',width = 183,height = 250,units = 'mm',device = cairo_pdf)
ggsave(plot = S14b,filename = '../output/S14b.pdf',width = 183,height = 250,units = 'mm',device = cairo_pdf)
ggsave(plot = S14c,filename = '../output/S14c.pdf',width = 183,height = 250,units = 'mm',device = cairo_pdf)
\ No newline at end of file
......@@ -55,7 +55,9 @@ Afterwards we use the `S01.R` script to annotate the alignment plot.
```sh
# annotation with R
Rscript --vanilla $WORK/3_figures/S01/S01.R
cd $WORK/3_figures/F_scripts
Rscript --vanilla S01.R
rm Rplots.pdf
```
## Content of circos_figure.R
......
......@@ -50,8 +50,8 @@ Furthermore, the generation of the outlier annotation changed.
While in the *F~ST~* script, the outlier where determined from the loaded data and later exported, within the G x P script the the highlights don't refer to G x P outliers, but the old *F~ST~* outlier are imported and plotted for reference.
```{r newScript, eval=FALSE}
data2 <- read.csv('fst_outlier_windows.txt', sep='\t')
musks <- read.csv('fst_outlier_ID.txt', sep='\t')
data2 <- read.csv('../../0_data/0_resources/fst_outlier_windows.txt', sep='\t')
musks <- read.csv('../../0_data/0_resources/fst_outlier_ID.txt', sep='\t')
```
This replaced the original section that computes the outlier windows within `F2.R`:
......@@ -152,8 +152,8 @@ data$RUN <- factor(as.character(data$RUN),
levels=c('PN','NU','PU','PPNP','NPUP','PPUP','PBNB','NBUB','PBUB','PHNH','NHUH','PHUH'))
data$COL <- factor(as.character(data$COL),levels=c('PN','PU','NU'))
data2 <- read.csv('fst_outlier_windows.txt', sep='\t')