annotate VCFToolsStats/VCFToolsStats.pl @ 24:21d878747ac6 draft default tip

Uploaded
author dereeper
date Mon, 23 Mar 2015 05:53:20 -0400
parents 7ba803afa41b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
1
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
2 #!/usr/bin/perl
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
3
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
4 use strict;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
5 use Switch;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
6 use Getopt::Long;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
7 use Bio::SeqIO;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
8
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
9 my $usage = qq~Usage:$0 <args> [<opts>]
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
10
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
11 where <args> are:
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
12
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
13 -i, --input <VCF input>
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
14 -o, --out <output basename>
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
15 ~;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
16 $usage .= "\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
17
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
18 my ($input,$out);
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
19
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
20 GetOptions(
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
21 "input=s" => \$input,
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
22 "out=s" => \$out
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
23 );
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
24
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
25
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
26 die $usage
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
27 if ( !$input);
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
28
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
29
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
30
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
31 my $nb_gene = `grep -c mRNA $input`;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
32 $nb_gene =~s/\n//g;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
33 my $nb_intergenic = `grep -c INTERGENIC $input`;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
34 $nb_intergenic =~s/\n//g;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
35
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
36 my $nb_intron = `grep -c INTRON $input`;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
37 $nb_intron =~s/\n//g;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
38 my $nb_UTR = `grep -c UTR $input`;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
39 $nb_UTR =~s/\n//g;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
40 my $nb_exon = $nb_gene - $nb_intron - $nb_UTR;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
41
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
42 my $nb_ns = `grep -c NON_SYNONYMOUS_CODING $input`;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
43 $nb_ns =~s/\n//g;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
44 my $nb_s = $nb_exon - $nb_ns;
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
45
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
46
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
47
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
48
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
49 #system("$VCFTOOLS_EXE --vcf $input --remove-filtered-all --out $out --hardy >>vcftools.log 2>&1");
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
50 system("vcftools --vcf $input --remove-filtered-all --out $out --het >>vcftools.log 2>&1");
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
51 system("vcftools --vcf $input --remove-filtered-all --out $out --TsTv-summary >>vcftools.log 2>&1");
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
52 system("vcftools --vcf $input --remove-filtered-all --out $out --missing-indv >>vcftools.log 2>&1");
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
53
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
54 open(my $G,">$out.annotation");
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
55 print $G "Genic $nb_gene\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
56 print $G "Intergenic $nb_intergenic\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
57 print $G "========\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
58 print $G "Intron $nb_intron\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
59 print $G "Exon $nb_exon\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
60 print $G "UTR $nb_UTR\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
61 print $G "========\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
62 print $G "Non-syn $nb_ns\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
63 print $G "Synonym $nb_s\n";
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
64 close($G);
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
65
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
66
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
67
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
68
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
69
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
70
7ba803afa41b Uploaded
dereeper
parents:
diff changeset
71