5
|
1 #!/bin/bash
|
|
2
|
|
3 tool_path=$(dirname $0)
|
|
4
|
|
5 filein=$1
|
|
6 fileout_label=$2
|
|
7 fileout=$3
|
|
8 filelog=$4
|
|
9 export=$5
|
|
10 frequency=$6
|
|
11 max_freq=$7
|
|
12 allow_missing=$8
|
|
13 nb_alleles_min=$9
|
|
14 nb_alleles_max=${10}
|
|
15 type=${11}
|
|
16 bound_start=${12}
|
|
17 bound_end=${13}
|
|
18
|
|
19
|
|
20 if [ "${14}" != "None" ]
|
|
21 then samples="--samples ${14}"
|
|
22 fi
|
|
23
|
|
24 if [ "${15}" != "None" ]
|
|
25 then chromosomes="--chromosomes ${15}"
|
|
26 fi
|
|
27
|
|
28 if [ "$bound_start" -gt "$bound_end" ]
|
|
29 then tmp=$bound_start ; bound_start=$bound_end ; bound_end=$tmp ; echo "Warning : Lower bound must be lower than greater bound!" >&2
|
|
30 fi
|
|
31
|
|
32 if [ "$nb_alleles_min" -gt "$nb_alleles_max" ]
|
|
33 then tmp=$nb_alleles_min ; nb_alleles_min=$nb_alleles_max ; nb_alleles_max=$tmp ; echo "Warning : Minimum number of alleles must be lower than maximum number of allele!" >&2
|
|
34 fi
|
|
35
|
|
36 perl $tool_path/VCFToolsFilter.pl --input $filein --out $fileout_label --export $export --frequency $frequency --max_freq $max_freq --allow_missing $allow_missing --nb_alleles $nb_alleles_min','$nb_alleles_max --type $type --bounds $bound_start','$bound_end $samples $chromosomes
|
|
37
|
|
38 if [ "$export" = "VCF" ]
|
|
39 then cp $fileout_label.recode.vcf $fileout ; rm $fileout_label.recode.vcf
|
|
40 elif [ "$export" = "freq" ]
|
|
41 then cp $fileout_label.frq $fileout ; rm $fileout_label.frq
|
|
42 else cp $fileout_label.ped $fileout; cp $fileout_label.map ${16} ; rm $fileout_label.ped $fileout_label.map
|
|
43 fi
|
|
44
|
|
45 cp vcftools.log $filelog
|
|
46 rm vcftools.log
|