Commit 79ce4b8c authored by k-hench's avatar k-hench

figure update

parent 032ea88e
...@@ -42,6 +42,8 @@ E1 <- plot_grid(NULL,NULL,NULL,NULL, ...@@ -42,6 +42,8 @@ E1 <- 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 = E1,filename = '../output/E1.pdf', #ggsave(plot = E1,filename = '../output/E1.pdf',
width = 183,height = 155,units = 'mm',device = cairo_pdf) # width = 183,height = 155,units = 'mm',device = cairo_pdf)
ggsave(plot = E1,filename = '../output/E1.png',
width = 183,height = 155,dpi = 200,units = 'mm')
#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)
...@@ -22,7 +22,7 @@ dataAll <- read.csv('../../0_data/0_resources/F1.sample.txt',sep='\t') %>% mutat ...@@ -22,7 +22,7 @@ dataAll <- read.csv('../../0_data/0_resources/F1.sample.txt',sep='\t') %>% mutat
data <- dataAll %>% filter(sample=="sample") data <- dataAll %>% filter(sample=="sample")
dataSum <- data%>% rowwise()%>% mutate(nn = sum(as.numeric(strsplit(as.character(`Latittude.N`),' ')[[1]])*c(1,1/60,1/3600)), dataSum <- data%>% rowwise()%>% mutate(nn = sum(as.numeric(strsplit(as.character(`Latittude.N`),' ')[[1]])*c(1,1/60,1/3600)),
ww = sum(as.numeric(strsplit(as.character(`Longitude.W`),' ')[[1]])*c(1,1/60,1/3600))) %>% ww = sum(as.numeric(strsplit(as.character(`Longitude.W`),' ')[[1]])*c(1,1/60,1/3600))) %>%
group_by(loc) %>% summarise(n=mean(nn,na.rm = T),w=-mean(ww,na.rm = T)) %>% group_by(loc) %>% summarise(n=mean(nn,na.rm = T),w=-mean(ww,na.rm = T)) %>%
as.data.frame() %>% cbind(.,read.csv('../../0_data/0_resources/F1.pointer.csv')) as.data.frame() %>% cbind(.,read.csv('../../0_data/0_resources/F1.pointer.csv'))
crvs <- read.csv('../../0_data/0_resources/F1.curve.csv') crvs <- read.csv('../../0_data/0_resources/F1.curve.csv')
...@@ -70,8 +70,8 @@ clrShps <- c("#ffc097","#b1d4f8") ...@@ -70,8 +70,8 @@ clrShps <- c("#ffc097","#b1d4f8")
cFILL <- rgb(.7,.7,.7) cFILL <- rgb(.7,.7,.7)
ccc<-rgb(0,.4,.8) ccc<-rgb(0,.4,.8)
p1 <- ggplot()+coord_map(projection = 'mercator',xlim=xlimW,ylim=ylimW)+ p1 <- ggplot()+coord_map(projection = 'mercator',xlim=xlimW,ylim=ylimW)+
labs(y="Latitude",x="Longitude") + labs(y="Latitude",x="Longitude") +
theme_mapK + theme_mapK +
geom_polygon(data=worldmap,aes(X,Y,group=PID),fill = cFILL, geom_polygon(data=worldmap,aes(X,Y,group=PID),fill = cFILL,
col=rgb(0,0,0),lwd=.2)+ col=rgb(0,0,0),lwd=.2)+
...@@ -85,7 +85,7 @@ p1 <- ggplot()+coord_map(projection = 'mercator',xlim=xlimW,ylim=ylimW)+ ...@@ -85,7 +85,7 @@ p1 <- ggplot()+coord_map(projection = 'mercator',xlim=xlimW,ylim=ylimW)+
geom_point(data=dataSum,aes(x=w,y=n),size=1.5,shape=21,fill='white') geom_point(data=dataSum,aes(x=w,y=n),size=1.5,shape=21,fill='white')
fstdata <- read.csv('../../2_output/08_popGen/05_fst/genome_wide_weighted_mean_fst.txt', fstdata <- read.csv('../../2_output/08_popGen/05_fst/genome_wide_weighted_mean_fst.txt',
sep='\t',skip = 1,head=F,col.names = c('pair','fst')) %>% sep='\t',skip = 1,head=F,col.names = c('pair','fst')) %>%
filter(!pair %in% c('NU','PN','PU')) %>% filter(!pair %in% c('NU','PN','PU')) %>%
arrange(fst) %>% mutate(x=row_number()) %>% rowwise() %>% arrange(fst) %>% mutate(x=row_number()) %>% rowwise() %>%
mutate(loc = substr(as.character(pair),2,2), mutate(loc = substr(as.character(pair),2,2),
...@@ -120,7 +120,7 @@ panPCA <- readRDS('../../2_output/08_popGen/04_pca/pan/panpca.Rds') ...@@ -120,7 +120,7 @@ panPCA <- readRDS('../../2_output/08_popGen/04_pca/pan/panpca.Rds')
dataHON <- cbind(dataAll %>% filter(sample=='sample',loc=='hon')%>% select(id,spec), dataHON <- cbind(dataAll %>% filter(sample=='sample',loc=='hon')%>% select(id,spec),
honPCA$scores); names(dataHON)[3:12]<- paste('PC',1:10,sep='') honPCA$scores); names(dataHON)[3:12]<- paste('PC',1:10,sep='')
exp_varHON <- (honPCA$singular.values[1:10])^2/length(honPCA$maf) exp_varHON <- (honPCA$singular.values[1:10])^2/length(honPCA$maf)
xlabHON <- paste('PC1 (',sprintf("%.1f",exp_varHON[1]*100),'%)')# explained varinace)') xlabHON <- paste('PC1 (',sprintf("%.1f",exp_varHON[1]*100),'%)')# explained varinace)')
ylabHON <- paste('PC2 (',sprintf("%.1f",exp_varHON[2]*100),'%)')# explained varinace)') ylabHON <- paste('PC2 (',sprintf("%.1f",exp_varHON[2]*100),'%)')# explained varinace)')
p2 <- ggplot(dataHON,aes(x=PC1,y=PC2,col=spec,fill=spec))+geom_point(size=1.1,shape=21)+ p2 <- ggplot(dataHON,aes(x=PC1,y=PC2,col=spec,fill=spec))+geom_point(size=1.1,shape=21)+
scale_color_manual(values=clr,guide=F)+ scale_color_manual(values=clr,guide=F)+
...@@ -184,19 +184,19 @@ F1 <- ggdraw()+ ...@@ -184,19 +184,19 @@ F1 <- ggdraw()+
draw_grob(nigGrob, xf[1]+xS[1], yf[1]+yS[1], hSC[1], hSC[2])+ # Honduras draw_grob(nigGrob, xf[1]+xS[1], yf[1]+yS[1], hSC[1], hSC[2])+ # Honduras
draw_grob(pueGrob, xf[2]+xS[1], yf[2]+yS[1], hSC[1], hSC[2])+ # Honduras draw_grob(pueGrob, xf[2]+xS[1], yf[2]+yS[1], hSC[1], hSC[2])+ # Honduras
draw_grob(uniGrob, xf[3]+xS[1], yf[3]+yS[1], hSC[1], hSC[2])+ # Honduras draw_grob(uniGrob, xf[3]+xS[1], yf[3]+yS[1], hSC[1], hSC[2])+ # Honduras
draw_grob(nigGrob, xf[1]+xS[2], yf[1]+yS[2], hSC[1], hSC[2])+ # Panama draw_grob(nigGrob, xf[1]+xS[2], yf[1]+yS[2], hSC[1], hSC[2])+ # Panama
draw_grob(pueGrob, xf[2]+xS[2], yf[2]+yS[2], hSC[1], hSC[2])+ # Panama draw_grob(pueGrob, xf[2]+xS[2], yf[2]+yS[2], hSC[1], hSC[2])+ # Panama
draw_grob(uniGrob, xf[3]+xS[2], yf[3]+yS[2], hSC[1], hSC[2])+ # Panama draw_grob(uniGrob, xf[3]+xS[2], yf[3]+yS[2], hSC[1], hSC[2])+ # Panama
draw_grob(nigGrob, xf[1]+xS[3], yf[1]+yS[3], hSC[1], hSC[2])+ # Belize draw_grob(nigGrob, xf[1]+xS[3], yf[1]+yS[3], hSC[1], hSC[2])+ # Belize
draw_grob(pueGrob, xf[2]+xS[3], yf[2]+yS[3], hSC[1], hSC[2])+ # Belize draw_grob(pueGrob, xf[2]+xS[3], yf[2]+yS[3], hSC[1], hSC[2])+ # Belize
draw_grob(uniGrob, xf[3]+xS[3], yf[3]+yS[3], hSC[1], hSC[2])+ # Belize draw_grob(uniGrob, xf[3]+xS[3], yf[3]+yS[3], hSC[1], hSC[2])+ # Belize
draw_grob(panGrob, 0.3, 0.485, 0.042, 0.042)+ draw_grob(panGrob, 0.3, 0.485, 0.042, 0.042)+
draw_grob(belGrob, 0.2, 0.67, 0.042, 0.042)+ draw_grob(belGrob, 0.2, 0.67, 0.042, 0.042)+
draw_grob(honGrob, 0.28, 0.61, 0.042, 0.042)+ draw_grob(honGrob, 0.28, 0.61, 0.042, 0.042)+
draw_grob(honGrob, 0.285+.09, 0.37, 0.042, 0.042)+ draw_grob(honGrob, 0.285+.09, 0.37, 0.042, 0.042)+
draw_grob(belGrob, 0.535+.09, 0.37, 0.042, 0.042)+ draw_grob(belGrob, 0.535+.09, 0.37, 0.042, 0.042)+
draw_grob(panGrob, 0.785+.09, 0.37, 0.042, 0.042)+ draw_grob(panGrob, 0.785+.09, 0.37, 0.042, 0.042)+
...@@ -204,5 +204,5 @@ F1 <- ggdraw()+ ...@@ -204,5 +204,5 @@ F1 <- ggdraw()+
y = c(.995,.42,.42), y = c(.995,.42,.42),
label =letters[1:3]) label =letters[1:3])
ggsave(plot = F1,filename = '../output/F1.pdf',width = 183,height = 145,units = 'mm',device = cairo_pdf) #ggsave(plot = F1,filename = '../output/F1.pdf',width = 183,height = 145,units = 'mm',device = cairo_pdf)
ggsave(plot = F1,filename = '../output/F1.png',width = 183,height = 145,units = 'mm',dpi = 200)
\ No newline at end of file
...@@ -6,58 +6,58 @@ library(grConvert) ...@@ -6,58 +6,58 @@ library(grConvert)
library(tidyverse) library(tidyverse)
library(cowplot) library(cowplot)
library(hrbrthemes) library(hrbrthemes)
karyo <- read.csv('../../0_data/0_resources/F2.karyo.txt',sep='\t') %>% karyo <- read.csv('../../0_data/0_resources/F2.karyo.txt',sep='\t') %>%
mutate(GSTART=lag(cumsum(END),n = 1,default = 0), mutate(GSTART=lag(cumsum(END),n = 1,default = 0),
GEND=GSTART+END,GROUP=rep(letters[1:2],12)) %>% GEND=GSTART+END,GROUP=rep(letters[1:2],12)) %>%
select(CHROM,GSTART,GEND,GROUP) select(CHROM,GSTART,GEND,GROUP)
# global ------------- # global -------------
pn <- read.csv('../../2_output/08_popGen/05_fst/pue-nig.50kb.5kb.windowed.weir.fst',sep='\t') %>% pn <- read.csv('../../2_output/08_popGen/05_fst/pue-nig.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PN'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PN');
pu <- read.csv('../../2_output/08_popGen/05_fst/pue-uni.50kb.5kb.windowed.weir.fst',sep='\t') %>% pu <- read.csv('../../2_output/08_popGen/05_fst/pue-uni.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PU'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PU');
nu <- read.csv('../../2_output/08_popGen/05_fst/nig-uni.50kb.5kb.windowed.weir.fst',sep='\t') %>% nu <- read.csv('../../2_output/08_popGen/05_fst/nig-uni.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NU'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NU');
# PAN ------------- # PAN -------------
ppnp <- read.csv('../../2_output/08_popGen/05_fst/pueboc-nigboc.50kb.5kb.windowed.weir.fst',sep='\t') %>% ppnp <- read.csv('../../2_output/08_popGen/05_fst/pueboc-nigboc.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PPNP'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PPNP');
ppup <- read.csv('../../2_output/08_popGen/05_fst/pueboc-uniboc.50kb.5kb.windowed.weir.fst',sep='\t') %>% ppup <- read.csv('../../2_output/08_popGen/05_fst/pueboc-uniboc.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PPUP'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PPUP');
npup <- read.csv('../../2_output/08_popGen/05_fst/nigboc-uniboc.50kb.5kb.windowed.weir.fst',sep='\t') %>% npup <- read.csv('../../2_output/08_popGen/05_fst/nigboc-uniboc.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NPUP'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NPUP');
# Bel ------------- # Bel -------------
pbnb <- read.csv('../../2_output/08_popGen/05_fst/puebel-nigbel.50kb.5kb.windowed.weir.fst',sep='\t') %>% pbnb <- read.csv('../../2_output/08_popGen/05_fst/puebel-nigbel.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PBNB'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PBNB');
pbub <- read.csv('../../2_output/08_popGen/05_fst/puebel-unibel.50kb.5kb.windowed.weir.fst',sep='\t') %>% pbub <- read.csv('../../2_output/08_popGen/05_fst/puebel-unibel.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PBUB'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PBUB');
nbub <- read.csv('../../2_output/08_popGen/05_fst/nigbel-unibel.50kb.5kb.windowed.weir.fst',sep='\t') %>% nbub <- read.csv('../../2_output/08_popGen/05_fst/nigbel-unibel.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NBUB'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NBUB');
# Hon ------------- # Hon -------------
phnh <- read.csv('../../2_output/08_popGen/05_fst/puehon-nighon.50kb.5kb.windowed.weir.fst',sep='\t') %>% phnh <- read.csv('../../2_output/08_popGen/05_fst/puehon-nighon.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PHNH'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PN',RUN='PHNH');
phuh <- read.csv('../../2_output/08_popGen/05_fst/puehon-unihon.50kb.5kb.windowed.weir.fst',sep='\t') %>% phuh <- read.csv('../../2_output/08_popGen/05_fst/puehon-unihon.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PHUH'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='PU',RUN='PHUH');
nhuh <- read.csv('../../2_output/08_popGen/05_fst/nighon-unihon.50kb.5kb.windowed.weir.fst',sep='\t') %>% nhuh <- read.csv('../../2_output/08_popGen/05_fst/nighon-unihon.50kb.5kb.windowed.weir.fst',sep='\t') %>%
merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>% merge(.,(karyo %>% select(-GEND,-GROUP)),by='CHROM',allx=T) %>%
mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NHUH'); mutate(POS=(BIN_START+BIN_END)/2,GPOS=POS+GSTART,COL='NU',RUN='NHUH');
# ------------------------------------------ # ------------------------------------------
data <- rbind(pn,pu,nu,ppnp,ppup,npup,pbnb,pbub,nbub,phnh,phuh,nhuh) data <- rbind(pn,pu,nu,ppnp,ppup,npup,pbnb,pbub,nbub,phnh,phuh,nhuh)
...@@ -71,9 +71,9 @@ gwFST$RUN <- factor(gwFST$run,levels=levels(data$RUN)) ...@@ -71,9 +71,9 @@ gwFST$RUN <- factor(gwFST$run,levels=levels(data$RUN))
threshs <- data %>% group_by(RUN) %>% summarise(thresh=quantile(WEIGHTED_FST,.9998)) threshs <- data %>% group_by(RUN) %>% summarise(thresh=quantile(WEIGHTED_FST,.9998))
data2 <- data %>% filter(RUN %in% levels(data$RUN)[1:3]) %>% merge(.,threshs,by='RUN',all.x=T) %>% data2 <- data %>% filter(RUN %in% levels(data$RUN)[1:3]) %>% merge(.,threshs,by='RUN',all.x=T) %>%
mutate(OUTL = (WEIGHTED_FST>thresh)) %>% filter(OUTL) %>% group_by(RUN) %>% mutate(OUTL = (WEIGHTED_FST>thresh)) %>% filter(OUTL) %>% group_by(RUN) %>%
mutate(CHECK=cumsum(1-(BIN_START-lag(BIN_START,default = 0)==5000)),ID=paste(RUN,'-',CHECK,sep='')) %>% mutate(CHECK=cumsum(1-(BIN_START-lag(BIN_START,default = 0)==5000)),ID=paste(RUN,'-',CHECK,sep='')) %>%
ungroup() %>% group_by(ID) %>% ungroup() %>% group_by(ID) %>%
summarise(CHROM=CHROM[1], summarise(CHROM=CHROM[1],
xmin = min(BIN_START+GSTART), xmin = min(BIN_START+GSTART),
xmax=max(BIN_END+GSTART), xmax=max(BIN_END+GSTART),
...@@ -81,7 +81,7 @@ data2 <- data %>% filter(RUN %in% levels(data$RUN)[1:3]) %>% merge(.,threshs,by= ...@@ -81,7 +81,7 @@ data2 <- data %>% filter(RUN %in% levels(data$RUN)[1:3]) %>% merge(.,threshs,by=
LGmin=min(BIN_START), LGmin=min(BIN_START),
LGmax=min(BIN_END), LGmax=min(BIN_END),
LGmean=min(POS), LGmean=min(POS),
RUN=RUN[1],COL=COL[1]) %>% RUN=RUN[1],COL=COL[1]) %>%
ungroup() %>% mutate(muskS = letters[as.numeric(as.factor(xmin))], ungroup() %>% mutate(muskS = letters[as.numeric(as.factor(xmin))],
musk=LETTERS[c(1,3,4,4,1,2,2,3)]) musk=LETTERS[c(1,3,4,4,1,2,2,3)])
...@@ -162,4 +162,3 @@ F2 <- ggdraw(p1)+ ...@@ -162,4 +162,3 @@ F2 <- ggdraw(p1)+
draw_grob(panGrob, 0.954, boxes$y[3]+.78*yd, .045, .045) draw_grob(panGrob, 0.954, boxes$y[3]+.78*yd, .045, .045)
ggsave(plot = F2,filename = '../output/F2.png',width = 183,height = 183,dpi = 200,units = 'mm') ggsave(plot = F2,filename = '../output/F2.png',width = 183,height = 183,dpi = 200,units = 'mm')
#ggsave('fst_mac02_weight_99.98.eps',width = 183,height = 183,dpi = 200,units = 'mm')
...@@ -16,4 +16,5 @@ p1 <- ggdraw()+ ...@@ -16,4 +16,5 @@ 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 = '../output/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)
ggsave(plot = p1,filename = '../output/S01.png',width = 183,height = 183,units = 'mm',dpi = 200)
\ No newline at end of file
...@@ -96,5 +96,6 @@ S02 <- ggdraw()+ ...@@ -96,5 +96,6 @@ S02 <- ggdraw()+
draw_grob(honGrob, labX-.0225, boxes$y[2]+.84*yd+.07, .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) draw_grob(panGrob, labX-.0225, boxes$y[1]+.84*yd+.07, .045, .045)
ggsave(plot = S02,filename = '../output/S02.pdf',width = 183,height = 235,units = 'mm',device = cairo_pdf) #ggsave(plot = S02,filename = '../output/S02.pdf',width = 183,height = 235,units = 'mm',device = cairo_pdf)
ggsave(plot = S02,filename = '../output/S02.png',width = 183,height = 235,units = 'mm',dpi = 200)
...@@ -160,4 +160,5 @@ S05 <- ggdraw()+ ...@@ -160,4 +160,5 @@ S05 <- ggdraw()+
draw_grob(legGrob, 0.2, 0, 0.8, 0.17)+ draw_grob(legGrob, 0.2, 0, 0.8, 0.17)+
draw_plot_label(x=c(0,.6),y=c(.99,.99),label = c('a','b')) draw_plot_label(x=c(0,.6),y=c(.99,.99),label = c('a','b'))
ggsave(plot = S05, filename = '../output/S05.pdf',width=183,height=90,units = 'mm',device = cairo_pdf) #ggsave(plot = S05, filename = '../output/S05.pdf',width=183,height=90,units = 'mm',device = cairo_pdf)
ggsave(plot = S05, filename = '../output/S05.png',width=183,height=90,units = 'mm',dpi = 200)
...@@ -58,6 +58,10 @@ S07c <- ggdraw()+ ...@@ -58,6 +58,10 @@ S07c <- ggdraw()+
draw_plot(p3,0,.05,1,.95)+ draw_plot(p3,0,.05,1,.95)+
draw_plot(legGrob,0,0,1,.05) draw_plot(legGrob,0,0,1,.05)
ggsave(plot = S07a,filename = '../output/S07a.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf) #ggsave(plot = S07a,filename = '../output/S07a.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf)
ggsave(plot = S07b,filename = '../output/S07b.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf) #ggsave(plot = S07b,filename = '../output/S07b.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf)
ggsave(plot = S07c,filename = '../output/S07c.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf) #ggsave(plot = S07c,filename = '../output/S07c.pdf',width = 180,height = 247,units = 'mm',device = cairo_pdf)
ggsave(plot = S07a,filename = '../output/S07a.png',width = 180,height = 247,units = 'mm',dpi = 200)
ggsave(plot = S07b,filename = '../output/S07b.png',width = 180,height = 247,units = 'mm',dpi = 200)
ggsave(plot = S07c,filename = '../output/S07c.png',width = 180,height = 247,units = 'mm',dpi = 200)
...@@ -54,4 +54,5 @@ S08 <- plot_grid(NULL,NULL,NULL,NULL, ...@@ -54,4 +54,5 @@ S08 <- 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 = S08,filename = '../output/S08.pdf',width = 183,height = 155,units = 'mm',device = cairo_pdf) #ggsave(plot = S08,filename = '../output/S08.pdf',width = 183,height = 155,units = 'mm',device = cairo_pdf)
ggsave(plot = S08,filename = '../output/S08.png',width = 183,height = 155,units = 'mm',dpi = 200)
...@@ -140,7 +140,7 @@ BINWDTH <- 50000 ...@@ -140,7 +140,7 @@ BINWDTH <- 50000
outl_window <- function(LGBIN){ outl_window <- function(LGBIN){
lg = str_sub(LGBIN, 1, 4) lg = str_sub(LGBIN, 1, 4)
bin = str_sub(LGBIN, 5) %>% as.numeric() bin = str_sub(LGBIN, 5) %>% as.numeric()
if (lg == "LG09") { if (lg == "LG09") {
out <- c("Other LGs","Candidate intervals")[between(x = bin,left = 17821000,right = 17930000-BINWDTH)+1] out <- c("Other LGs","Candidate intervals")[between(x = bin,left = 17821000,right = 17930000-BINWDTH)+1]
return(out) return(out)
...@@ -200,4 +200,5 @@ S12c <- ggplot(data_both,aes(x=RHO,y=WEIGHTED_FST))+ ...@@ -200,4 +200,5 @@ S12c <- ggplot(data_both,aes(x=RHO,y=WEIGHTED_FST))+
S12ab <- plot_grid(S12a,S12b,ncol = 1,align = 'v',labels = c('a','b')) S12ab <- plot_grid(S12a,S12b,ncol = 1,align = 'v',labels = c('a','b'))
S12 <- plot_grid(S12ab,NULL,S12c,ncol = 1,rel_heights = c(1,.05,.8),labels = c('','','c')) S12 <- plot_grid(S12ab,NULL,S12c,ncol = 1,rel_heights = c(1,.05,.8),labels = c('','','c'))
ggsave(plot = S12,filename = '../output/S12.pdf',width = 183,height = 220,units = 'mm',device = cairo_pdf) #ggsave(plot = S12,filename = '../output/S12.pdf',width = 183,height = 220,units = 'mm',device = cairo_pdf)
ggsave(plot = S12,filename = '../output/S12.png',width = 183,height = 220,units = 'mm',dpi = 200)
...@@ -42,4 +42,5 @@ S15 <- plot_grid(NULL,NULL,NULL,NULL, ...@@ -42,4 +42,5 @@ S15 <- plot_grid(NULL,NULL,NULL,NULL,
'','','',''),label_size = 10)+ '','','',''),label_size = 10)+
draw_grob(legGrob, 0.05, 0, .9, 0.04) draw_grob(legGrob, 0.05, 0, .9, 0.04)
ggsave(plot = S15,filename = '../output/S15.pdf',width = 183,height = 210,units = 'mm',device = cairo_pdf) #ggsave(plot = S15,filename = '../output/S15.pdf',width = 183,height = 210,units = 'mm',device = cairo_pdf)
ggsave(plot = S15,filename = '../output/S15.png',width = 183,height = 210,units = 'mm',dpi = 200)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment