Commit 146c79d1 authored by Kosmas Hench's avatar Kosmas Hench

complete plotting scripts

parent 181e3da6
getIHH12 <- function(searchLG,xr){
np <- read.csv(paste('./iHH12/',searchLG,'/iHH12.nig.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
np <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.nig.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='nig')
nu <- read.csv(paste('./iHH12/',searchLG,'/iHH12.pue.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nu <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.pue.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='pue')
pu <- read.csv(paste('./iHH12/',searchLG,'/iHH12.uni.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
pu <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.uni.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='uni')
data_iHH12 <- rbind(np,nu,pu) %>% mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(iHH[12])')
npB <- read.csv(paste('./iHH12/',searchLG,'/iHH12.nigbel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npB <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.nigbel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='nig',group='bel')
nuB <- read.csv(paste('./iHH12/',searchLG,'/iHH12.puebel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuB <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.puebel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='pue',group='bel')
puB <- read.csv(paste('./iHH12/',searchLG,'/iHH12.unibel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puB <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.unibel.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='uni',group='bel')
npH <- read.csv(paste('./iHH12/',searchLG,'/iHH12.puehon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npH <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.puehon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='nig',group='hon')
nuH <- read.csv(paste('./iHH12/',searchLG,'/iHH12.puehon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuH <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.puehon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='pue',group='hon')
puH <- read.csv(paste('./iHH12/',searchLG,'/iHH12.unihon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puH <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.unihon.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='uni',group='hon')
npP <- read.csv(paste('./iHH12/',searchLG,'/iHH12.nigboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npP <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.nigboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='nig',group='pan')
nuP <- read.csv(paste('./iHH12/',searchLG,'/iHH12.pueboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuP <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.pueboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='pue',group='pan')
puP <- read.csv(paste('./iHH12/',searchLG,'/iHH12.uniboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puP <- read.csv(paste('../../2_output/08_popGen/09_iHH12/selscan_merge_10kb/',searchLG,'/iHH12.uniboc.selscan-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGihh12) %>% mutate(run='uni',group='pan')
data_iHH12_pw <- rbind(npB,nuB,puB,npH,nuH,puH,npP,nuP,puP) %>%
mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(ind~iHH[12])')
return(list(data_iHH12_pw=data_iHH12_pw,data_iHH12=data_iHH12))
}
\ No newline at end of file
getPI<- function(searchLG,xr){
np <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.nig.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
np <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.nig.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig')
nu <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.pue.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nu <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.pue.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue')
pu <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.uni.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
pu <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.uni.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='uni')
data_pi <- rbind(np,nu,pu) %>% mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(pi)')
npB <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.nigbel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npB <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.nigbel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig',group='bel')
nuB <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.puebel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuB <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.puebel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue',group='bel')
puB <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.unibel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puB <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.unibel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='uni',group='bel')
npH <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.nighon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npH <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.nighon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig',group='hon')
nuH <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.puehon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuH <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.puehon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue',group='hon')
puH <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.unihon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puH <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.unihon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='uni',group='hon')
npP <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.nigboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npP <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.nigboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig',group='pan')
nuP <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.pueboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuP <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.pueboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue',group='pan')
puP <- read.csv(gzfile(paste('./pi/',searchLG,'/dxy.uniboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puP <- read.csv(gzfile(paste('../../2_output/08_popGen/02_pi/10kb/',searchLG,'/pi.uniboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='uni',group='pan')
data_pi_pw <- rbind(npB,nuB,puB,npH,nuH,puH,npP,nuP,puP) %>%
......
getPIpw<- function(searchLG,xr){
np <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.pue-nig.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
np <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.pue-nig.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-pue')
nu <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.nig-uni.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nu <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.nig-uni.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-uni')
pu <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.uni-pue.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
pu <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.uni-pue.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue-uni')
data_pi <- rbind(np,nu,pu) %>% mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(pi~pw)')
npB <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.puebel-nigbel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npB <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.puebel-nigbel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-pue',group='bel')
nuB <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.nigbel-unibel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuB <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.nigbel-unibel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-uni',group='bel')
puB <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.unibel-puebel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puB <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.unibel-puebel.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue-uni',group='bel')
npH <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.puehon-nighon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npH <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.puehon-nighon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-pue',group='hon')
nuH <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.nighon-unihon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuH <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.nighon-unihon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-uni',group='hon')
puH <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.unihon-puehon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puH <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.unihon-puehon.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue-uni',group='hon')
npP <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.pueboc-nigboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
npP <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.pueboc-nigboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-pue',group='pan')
nuP <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.nigboc-uniboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
nuP <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.nigboc-uniboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='nig-uni',group='pan')
puP <- read.csv(gzfile(paste('./pi_pw/',searchLG,'/dxy.uniboc-pueboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
puP <- read.csv(gzfile(paste('../../2_output/08_popGen/03_pi_pw/10kb/',searchLG,'/pi-pw.uniboc-pueboc.',searchLG,'-10kb-1kb.windowed.pi.gz',sep='')),sep='\t') %>%
select(BIN_START,BIN_END,PI) %>% mutate(run='pue-uni',group='pan')
data_pi_pw <- rbind(npB,nuB,puB,npH,nuH,puH,npP,nuP,puP) %>%
mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(pw~pi~pw)')
return(list(data_piPW_pw=data_pi_pw,data_piPW=data_pi))
}
\ No newline at end of file
getXPEHH <- function(searchLG,xr){
np <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.pue-nig-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
np <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.pue-nig-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-pue')
nu <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.nig-uni-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nu <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.nig-uni-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-uni')
pu <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.pue-uni-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
pu <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.pue-uni-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='pue-uni')
data_xpEHH <- rbind(np,nu,pu) %>% mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(xpEHH)')
npB <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.puebel-nigbel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npB <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.puebel-nigbel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-pue',group='bel')
nuB <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.nigbel-unibel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuB <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.nigbel-unibel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-uni',group='bel')
puB <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.puebel-unibel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puB <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.puebel-unibel-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='pue-uni',group='bel')
npH <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.puehon-nighon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npH <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.puehon-nighon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-pue',group='hon')
nuH <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.nighon-unihon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuH <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.nighon-unihon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-uni',group='hon')
puH <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.puehon-unihon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puH <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.puehon-unihon-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='pue-uni',group='hon')
npP <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.pueboc-nigboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
npP <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.pueboc-nigboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-pue',group='pan')
nuP <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.nigboc-uniboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
nuP <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.nigboc-uniboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='nig-uni',group='pan')
puP <- read.csv(paste('./xpEHH/',searchLG,'/xpEHH.pueboc-uniboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
puP <- read.csv(paste('../../2_output/08_popGen/10_xpEHH/selscan_merge_10kb/',searchLG,'/xpEHH.pueboc-uniboc-',searchLG,'-10kb-1kb.txt',sep=''),sep='\t') %>%
select(BIN_START,BIN_END,AVGxxEHH) %>% mutate(run='pue-uni',group='pan')
data_xpEHH_pw <- rbind(npB,nuB,puB,npH,nuH,puH,npP,nuP,puP) %>%
mutate(POS=(BIN_START+BIN_END)/2,window='bolditalic(pw~xpEHH)')
return(list(data_xpEHH_pw=data_xpEHH_pw,data_xpEHH=data_xpEHH))
}
\ No newline at end of file
......@@ -11,11 +11,11 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
highclr <- '#3bb33b'
theme_set(theme_minimal(base_size = 6))
if(xr[1]>xr[2]){print('error: ill conditioned x-range')}
wdth <- .3
wdth <- .1
# get gene models
df_list <- get_anno_df_single_line(searchLG=searchLG,gfffile=gfffile,xrange=xr,
genes_of_interest = searchgene,genes_of_sec_interest=secondary_genes,anno_rown=3)
df_list <- get_anno_df_single_line(searchLG=searchLG,gfffile=gfffile,xrange=xr,genes_of_interest = searchgene,genes_of_sec_interest=secondary_genes,anno_rown=1)
# get fst values
fst_list <- getFSTS(searchLG,xr,searchsnp,highclr)
......@@ -33,6 +33,26 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
#data_dxy_pw<-dxy_list$data_dxy_pw;
data_dxy<-dxy_list$data_dxy
# get pi values
piPW_list <- getPIpw(searchLG,xr)
#data_pi_pw<-pi_list$data_pi_pw;
data_piPW<-piPW_list$data_piPW
# get pi values
pi_list <- getPI(searchLG,xr)
#data_pi_pw<-pi_list$data_pi_pw;
data_pi<-pi_list$data_pi
# get iHH12 values
iHH12_list <- getIHH12(searchLG,xr)
#data_iHH12_pw<-iHH12_list$data_iHH12_pw;
data_iHH12<-iHH12_list$data_iHH12
# get xpEHH values
xpEHH_list <- getXPEHH(searchLG,xr)
#data_xpEHH_pw<-xpEHH_list$data_xpEHH_pw;
data_xpEHH<-xpEHH_list$data_xpEHH
clr <- c('#fb8620','#1b519c','#d93327')
annoclr <- c('lightgray',highclr,rgb(.3,.3,.3))[1:3]
df_list[[1]] <- df_list[[1]] %>% mutate(label=paste("italic(",tolower(Parentgenename),")",sep='') )
......@@ -59,12 +79,10 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
geom_rect(data=df_list[[2]],aes(xmin=ps/1000,xmax=pe/1000,ymin=yl-(wdth/2),ymax=yl+(wdth/2),
fill=as.factor(clr),col=as.factor(clr),group=Parent),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,
aes(x=ps/1000,xend=pe/1000,y=yl,yend=yl,group=Parent),lwd=.2,
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]]%>%filter(Parentgenename%in%c(searchgene,secondary_genes))),
aes(x=labelx/1000,label=label,y=yl-.5),size=1.8,parse=T)+
facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = T)+
# color settings
......@@ -89,28 +107,6 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
panel.border = element_blank()
);
if(muskID=='A'){
p11$layers[[4]]$data$label <- c("italic(sox10)","italic(rnaseh2a)")
} else if(muskID=='B'){
p11$layers[[4]]$data$label <- c("italic(casz1^3)","italic(casz1^2)","italic(casz1^1)")
} else if(muskID=='C'){
p11$layers[[4]]$data$label <- c('italic(hoxc10a)',"italic(hoxc11a)","italic(hoxc12a)","italic(hoxc13a)","italic(calcoco1)")
}else if(muskID=='E'){
p11$layers[[4]]$data$label <- c("italic(polr1d)","italic(ednrb)")
} else if(muskID=='F'){
p11$layers[[4]]$data$label <- c("italic(foxd3)","italic(alg6)","italic(efcab7)")
} else if(muskID=='D'){
p11$layers[[4]]$data$label <- c("italic(hcfc1)","italic(hcfc1[2])","italic(hcfc1[1])",'italic(paste(sws2a,"\u03B2"))',
'italic(paste(sws2a,"\u03B1"))',"italic(sw2b)","italic(lws)",
"italic(gnl3l)","italic(tfe3)","italic(mdfic2)","italic(cxxc1[3])",
"italic(cxxc1[1])",'italic(mbd1)','italic(ccdc120)')
}else if(muskID=='G'){
p11$layers[[4]]$data$label <- c("italic(lgals3bpb)","italic(mpnd)","italic(sh3gl1)","italic(rorb)")
}else if(muskID=='H'){
p11$layers[[4]]$data$label <- c("italic(alg2)","italic(sec61b)","italic(nr4a3)",
"italic(stx17)","italic(erp44)","italic(invs)")
}
p12 <- ggplot()+coord_cartesian(xlim=xr)+
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)+
......@@ -137,7 +133,7 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
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,9,length.out = 4))+
scale_y_continuous(breaks = seq(0,12,length.out = 4))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
......@@ -154,7 +150,64 @@ create_K_plot <- function(searchLG,gfffile,xr,searchgene,secondary_genes,searchs
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p15 <- ggplot()+coord_cartesian(xlim=xr)+
geom_line(data=(data_piPW %>% filter(POS > xr[1],POS<xr[2]))
,aes(x=POS,y=PI,col=run),lwd=LW)+
# geom_line(data=(data_dxy_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=dxy,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)+
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,.01,length.out = 5))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
clr2 <- c('black','#d45500','#cccccc')
p16 <- ggplot()+coord_cartesian(xlim=xr)+
geom_line(data=(data_pi %>% filter(POS > xr[1],POS<xr[2]))
,aes(x=POS,y=PI,col=run),lwd=LW)+
# geom_line(data=(data_pi_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=PI,col=run,linetype=group),lwd=1)+
scale_color_manual(values=clr2,
breaks=c("nig","pue","uni"),guide=F)+
facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = F)+
scale_x_continuous(name=searchLG,expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(0,.01,length.out = 3))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p17 <- ggplot()+coord_cartesian(xlim=xr)+
geom_line(data=(data_iHH12 %>% filter(POS > xr[1],POS<xr[2]))
,aes(x=POS,y=AVGihh12,col=run),lwd=LW)+
# geom_line(data=(data_iHH12_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=AVGihh12,col=run,linetype=group),lwd=1)+
scale_color_manual(values=clr2,
breaks=c("nig","pue","uni"),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,10000,length.out = 3))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p18 <- ggplot()+coord_cartesian(xlim=xr)+
geom_line(data=(data_xpEHH %>% filter(POS > xr[1],POS<xr[2]))
,aes(x=POS,y=AVGxxEHH,col=run),lwd=LW)+
# geom_line(data=(data_xpEHH_pw %>% filter(POS > xr[1],POS<xr[2]))
# ,aes(x=POS,y=AVGxxEHH,col=run,linetype=group),lwd=1)+
scale_color_manual(values=c(clr,annoclr),breaks=c("nig-pue","nig-uni","pue-uni"),guide=F)+
facet_grid(window~.,scales='free_y',
switch = 'y',labeller = label_parsed,as.table = F)+
scale_x_continuous(name=searchLG,expand=c(0,0),position = 'top')+
scale_y_continuous(breaks = seq(-1,1,length.out = 3))+
scale_linetype(name='location',label=c('Belize','Honduras','Panama'))+
guides(linetype= guide_legend(override.aes = list(color = 'black')))+plotSET
p2 <- plot_grid(p11,p12,p13,p14,
ncol = 1,align = 'v',axis = 'r',rel_heights = c(1.3,rep(1,3)))
p2 <- plot_grid(p11,p12,p13,p14,p15,
p16,p17,p18,
ncol = 1,align = 'v',axis = 'r',rel_heights = c(.85,rep(1,6)))
return(p2)}
\ No newline at end of file
#PBS -l elapstim_req=00:20:00
#PBS -l elapstim_req=01:20:00
#PBS -l memsz_job=80gb
#PBS -b 1
#PBS -l cpunum_job=1
......
......@@ -10,7 +10,7 @@ library(cowplot)
require(rtracklayer)
source('../../0_data/0_scripts/F3.functions.R');
source('../../0_data/0_scripts/F3.plot_fun.R')
source('../../0_data/0_scripts/S11.plot_fun.R')
p1 <- create_K_plot(searchLG = "LG09",gfffile = '../../1-output/09_gff_from_IKMB/HP.annotation.named.gff',xr = c(17800000,18000000),
searchgene = c("SOX10_1"),secondary_genes = c("RNASEH2A"),searchsnp = c(17871737,17872597,17873443),
......@@ -29,7 +29,7 @@ p4 <- create_K_plot(searchLG = "LG17",gfffile = '../../1-output/09_gff_from_IKMB
legGrob <- gTree(children=gList(pictureGrob(readPicture("../../0_data/0_img/legend-pw-cairo.svg"))))
F3 <- plot_grid(NULL,NULL,NULL,NULL,
S11 <- plot_grid(NULL,NULL,NULL,NULL,
p1,NULL,p2,NULL,
NULL,NULL,NULL,NULL,
p3,NULL,p4,NULL,
......@@ -42,5 +42,4 @@ F3 <- plot_grid(NULL,NULL,NULL,NULL,
'','','',''),label_size = 10)+
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('ranges_all_label.pdf',width = 183,height = 120,units = 'mm',device = cairo_pdf)
ggsave(plot = S11,filename = '../output/S11.pdf',width = 183,height = 210,units = 'mm',device = cairo_pdf)
---
output: html_document
editor_options:
chunk_output_type: console
---
# Workflow
```{r setup, include=FALSE}
......@@ -42,23 +47,7 @@ For the final visualization (the green squares in panel 2.2.Popgen), additional
source('workflow/points_and_edges_assembly.R')
source('workflow/points_and_edges_analysis.R')
# 1. Preparation -----------------
crLB3 <- 7
ptsB3 <- data.frame(stringsAsFactors = F, nr = 1:crLB3,
x=c(0,0,1,1.75,1.5,2.5,3.35),
y=c(.75,-.75,0,0,-1,0,0),
decript=c('genome','gff','transcripts',
'idx','RNA','kallisto','plot'),
type=c(rep('ind',4),rep('class',2),'ind'),
label=c('txt',rep('fa',2),'txt','fq','txt','plot'),
status=rep(steps[6],crLB3))
edgB3 <- data.frame(stringsAsFactors = F,
s=c(2,1,3,4,2,5,6),
e=c(3,3,4,6,6,6,7),
label=c('2.3.1.transcripts','','2.3.2.index',
'','','2.3.3.kallisto',''),
type=c(rep('transform',1),rep('helper',4),'transform','plot'),
dir=c(rep(1,7)))
# merge points --------------------
ptsA <- rbind(ptsA1,ptsA2,ptsA3)
......@@ -137,7 +126,6 @@ p2 <- ggplot()+
panel.background = element_rect(fill=rgb(.98,.98,.98)),
plot.margin = unit(rep(5,4),'pt'))
#p2
plot_grid(p1,p2)
```
</center>
\ No newline at end of file
.book .book-header h1 {
padding-left: 20px;
padding-right: 20px;
}
.book .book-header.fixed {
position: fixed;
right: 0;
top: 0;
left: 0;
border-bottom: 1px solid rgba(0,0,0,.07);
}
span.search-highlight {
background-color: #ffff88;
}
@media (min-width: 600px) {
.book.with-summary .book-header.fixed {
left: 300px;
}
}
@media (max-width: 1240px) {
.book .book-body.fixed {
top: 50px;
}
.book .book-body.fixed .body-inner {
top: auto;
}
}
@media (max-width: 600px) {
.book.with-summary .book-header.fixed {
left: calc(100% - 60px);
min-width: 300px;
}
.book.with-summary .book-body {
transform: none;
left: calc(100% - 60px);
min-width: 300px;
}
.book .book-body.fixed {
top: 0;
}
}
.book .book-body.fixed .body-inner {
top: 50px;
}
.book .book-body .page-wrapper .page-inner section.normal sub, .book .book-body .page-wrapper .page-inner section.normal sup {
font-size: 85%;
}
@media print {
.book .book-summary, .book .book-body .book-header, .fa {
display: none !important;
}
.book .book-body.fixed {
left: 0px;
}
.book .book-body,.book .book-body .body-inner, .book.with-summary {
overflow: visible !important;
}
}
.kable_wrapper {
border-spacing: 20px 0;
border-collapse: separate;
border: none;
margin: auto;
}
.kable_wrapper > tbody > tr > td {
vertical-align: top;
}
.book .book-body .page-wrapper .page-inner section.normal table tr.header {
border-top-width: 2px;
}
.book .book-body .page-wrapper .page-inner section.normal table tr:last-child td {
border-bottom-width: 2px;
}
.book .book-body .page-wrapper .page-inner section.normal table td, .book .book-body .page-wrapper .page-inner section.normal table th {
border-left: none;
border-right: none;
}
.book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr, .book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr > td {
border-top: none;
}
.book .book-body .page-wrapper .page-inner section.normal table.kable_wrapper > tbody > tr:last-child > td {
border-bottom: none;
}
div.theorem, div.lemma, div.corollary, div.proposition {
font-style: italic;
}
span.theorem, span.lemma, span.corollary, span.proposition {
font-style: normal;
}
div.proof:after {
content: "\25a2";
float: right;
}
.header-section-number {
padding-right: .5em;
}
/*
* Theme 1
*/
.color-theme-1 .dropdown-menu {
background-color: #111111;
border-color: #7e888b;
}
.color-theme-1 .dropdown-menu .dropdown-caret .caret-inner {
border-bottom: 9px solid #111111;
}
.color-theme-1 .dropdown-menu .buttons {
border-color: #7e888b;
}
.color-theme-1 .dropdown-menu .button {
color: #afa790;
}
.color-theme-1 .dropdown-menu .button:hover {
color: #73553c;
}
/*
* Theme 2
*/
.color-theme-2 .dropdown-menu {
background-color: #2d3143;
border-color: #272a3a;
}
.color-theme-2 .dropdown-menu .dropdown-caret .caret-inner {
border-bottom: 9px solid #2d3143;
}
.color-theme-2 .dropdown-menu .buttons {
border-color: #272a3a;
}
.color-theme-2 .dropdown-menu .button {
color: #62677f;
}
.color-theme-2 .dropdown-menu .button:hover {
color: #f4f4f5;
}
.book .book-header .font-settings .font-enlarge {
line-height: 30px;
font-size: 1.4em;
}
.book .book-header .font-settings .font-reduce {
line-height: 30px;
font-size: 1em;
}
.book.color-theme-1 .book-body {
color: #704214;
background: #f3eacb;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section {
background: #f3eacb;
}
.book.color-theme-2 .book-body {
color: #bdcadb;
background: #1c1f2b;
}
.book.color-theme-2 .book-body .page-wrapper .page-inner section {
background: #1c1f2b;
}
.book.font-size-0 .book-body .page-inner section {
font-size: 1.2rem;
}
.book.font-size-1 .book-body .page-inner section {
font-size: 1.4rem;
}
.book.font-size-2 .book-body .page-inner section {
font-size: 1.6rem;
}
.book.font-size-3 .book-body .page-inner section {
font-size: 2.2rem;
}
.book.font-size-4 .book-body .page-inner section {
font-size: 4rem;
}
.book.font-family-0 {
font-family: Georgia, serif;
}
.book.font-family-1 {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal {
color: #704214;
}
.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a {
color: inherit;
}