Skip to content

19. Inference of Population Splits

George Pacheco edited this page Aug 4, 2021 · 1 revision

Based on Dataset III, we perform an Inference of Population Splits.

Creates a TreeMiX .annot file:
cat ~/data/Pigeons/PBGP/PBGP--Analyses/Lists/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals--Article--Ultra.labels | awk '{split($0,a,"_"); print $1"\t"a[1]}' > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals--Article--Ultra.annot
Converts the .geno file into a .treemix file:
perl $SCRIPTS/scripts/geno2treemix.pl --geno ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--ANGSDRuns/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.geno.gz --format angsd --skip_cols 4 --pop ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals--Article--Ultra.annot | gzip --best > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.gz
Runs TreeMix:
for M in `seq 6 8`
do 
    echo $SCRIPTS/scripts/wrapper_treemix.sh -i ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.gz -k 100 -t 10 -noss -m $M -root Crupestris -global -o ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.${M}

done | xsbatch -c 10 --mem-per-cpu 1024 -J TreeMix -R --max-array-jobs 11 --time 10-00 --
Creates a .poporder file:
zcat ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.gz | head -n 1 | perl -p -e 's/ /\n/g' > ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.poporder
Plots the results:
ls -Sv ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.XXX.llik | perl -p -e 's/\.llik//g' | Rscript --vanilla --slave -e "source('$SOFT/treemix/v1.13/src/plotting_funcs.R'); h=18; w=h*2; x<-read.table('stdin')[,1]; pdf(height=h,width=w); layout(matrix(c(1,2),ncol=2),c(w/2,w/2),c(h)); for(i in x){plot_tree(i);plot_resid(i,'~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.poporder')}; dev.off()"; mv Rplots.pdf  ~/data/Pigeons/PBGP/PBGP--Analyses/PBGP--TreeMix/PBGP--GoodSamples_WithWGSs_NoOddSamplesNoFerals_SNPCalling--Article--Ultra.treemix.XXX.pdf

Clone this wiki locally