3
|
1 #!/bin/bash
|
|
2
|
|
3 tool_path=$(dirname $0)
|
|
4
|
|
5 filein=$1
|
|
6 fileout_label=$(date "+%Y%m%d%H%M%S")
|
4
|
7 window=$2
|
|
8 filelog=$3
|
|
9 fileout_taj=$4
|
|
10 fileout_tstv=$5
|
|
11 fileout_windowed=$6
|
|
12 fileout_snp=$7
|
|
13 group=$8
|
3
|
14 if [ "$group" != "none" ]
|
4
|
15 then fileout_fst=${9}
|
|
16 fileout_fst_marker=${10}
|
|
17 fileout_taj_combined=${11}
|
|
18 fileout_windowed_combined=${12}
|
7
|
19 fileout_tstv_combined=${13}
|
|
20 fileout_snp_combined=${14}
|
3
|
21 fi
|
|
22
|
|
23
|
|
24 cp $filein ${filein}.vcf
|
|
25 if [ "$group" != "none" ]
|
4
|
26 then perl $tool_path/VCFToolsSlidingWindow.pl --input ${filein}.vcf --out $fileout_label --window $window --group $group
|
|
27 else perl $tool_path/VCFToolsSlidingWindow.pl --input ${filein}.vcf --out $fileout_label --window $window
|
3
|
28 fi
|
|
29
|
|
30 mv ${fileout_label}.vcftools.log $filelog
|
|
31 mv ${fileout_label}.Tajima.D ${fileout_taj}
|
|
32 mv ${fileout_label}.TsTv ${fileout_tstv}
|
|
33 mv ${fileout_label}.windowed.pi ${fileout_windowed}
|
|
34 mv ${fileout_label}.snpden ${fileout_snp}
|
|
35
|
|
36 if [ "$group" != "none" ]
|
|
37 then mv ${fileout_label}.fst.txt ${fileout_fst}
|
|
38 mv ${fileout_label}.fst.by_marker.genes.txt ${fileout_fst_marker}
|
|
39 mv ${fileout_label}.combined.dtajima.txt ${fileout_taj_combined}
|
|
40 mv ${fileout_label}.combined.pi.txt ${fileout_windowed_combined}
|
7
|
41 paste ${fileout_label}.Pop1.TsTv ${fileout_label}.Pop2.TsTv | column -s $'\t' -t | awk '{OFS="\t"; print $1,$2,$4,$8} ' | awk 'NR==1{$3="Pop1";$4="Pop2"}1' > ${fileout_tstv_combined}
|
|
42 paste ${fileout_label}.Pop1.snpden ${fileout_label}.Pop2.snpden | column -s $'\t' -t | awk '{OFS="\t"; print $1,$2,$4,$8} ' | awk 'NR==1{$3="Pop1";$4="Pop2"}1' > ${fileout_snp_combined}
|
3
|
43 fi
|
|
44
|
|
45 rm -f ${filein}.vcf ${filein}.vcf.*
|
|
46
|