annotate vcfToolsFilter.sh @ 1:b058193a71d0 draft

Uploaded
author dereeper
date Thu, 12 Feb 2015 15:41:00 -0500
parents 9dec9f724a50
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
1 #!/bin/bash
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
2
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
3 tool_path=$(dirname $0)
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
4
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
5 filein=$1
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
6 fileout_label=$2
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
7 fileout=$3
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
8 filelog=$4
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
9 export=$5
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
10 frequency=$6
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
11 max_freq=$7
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
12 allow_missing=$8
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
13 nb_alleles_min=$9
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
14 nb_alleles_max=${10}
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
15 type=${11}
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
16 bound_start=${12}
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
17 bound_end=${13}
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
18
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
19
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
20 if [ "${14}" != "None" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
21 then samples="--samples ${14}"
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
22 fi
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
23
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
24 if [ "${15}" != "None" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
25 then chromosomes="--chromosomes ${15}"
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
26 fi
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
27
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
28 if [ "$bound_start" -gt "$bound_end" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
29 then tmp=$bound_start ; bound_start=$bound_end ; bound_end=$tmp ; echo "Warning : Lower bound must be lower than greater bound!" >&2
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
30 fi
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
31
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
32 if [ "$nb_alleles_min" -gt "$nb_alleles_max" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
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
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
34 fi
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
35
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
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
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
37
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
38 if [ "$export" = "VCF" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
39 then cp $fileout_label.recode.vcf $fileout ; rm $fileout_label.recode.vcf
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
40 elif [ "$export" = "freq" ]
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
41 then cp $fileout_label.frq $fileout ; rm $fileout_label.frq
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
42 else cp $fileout_label.ped $fileout; cp $fileout_label.map ${16} ; rm $fileout_label.ped $fileout_label.map
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
43 fi
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
44
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
45 cp vcftools.log $filelog
9dec9f724a50 Uploaded
dereeper
parents:
diff changeset
46 rm vcftools.log