Mercurial > repos > dereeper > snpeff_from_gff_vcf
annotate SnpEff.pl @ 1:633d264f8888 draft default tip
planemo upload commit 475f4d7d8442a0d75e103af326ae5881c4d2a4ac
author | dereeper |
---|---|
date | Mon, 16 Apr 2018 08:56:29 -0400 |
parents | abde5b0387c8 |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/perl |
2 | |
3 use strict; | |
4 use Getopt::Long; | |
5 | |
6 my $usage = qq~Usage:$0 <args> [<opts>] | |
7 where <args> are: | |
8 -i, --input <input VCF> | |
9 -o, --output <output> | |
10 -g, --gff <GFF annotation> | |
11 -f, --fasta <Fasta of chromosomes> | |
12 -h, --html <HTML output> | |
13 ~; | |
14 $usage .= "\n"; | |
15 | |
16 my ($input,$output,$gff,$fasta,$html); | |
17 | |
18 | |
19 GetOptions( | |
20 "input=s" => \$input, | |
21 "output=s" => \$output, | |
22 "gff=s" => \$gff, | |
23 "fasta=s" => \$fasta, | |
24 "html=s" => \$html | |
25 ); | |
26 | |
27 | |
28 die $usage | |
29 if ( !$input || !$output || !$fasta || !$gff || !$html); | |
30 | |
31 | |
32 if (!-e $gff){ | |
33 die "Error: GFF input does not exist\n" | |
34 } | |
35 if (!-e $fasta){ | |
36 die "Error: Fasta input does not exist\n" | |
37 } | |
38 | |
39 #my $SNPEFF_PATH = "/usr/local/bioinfo/galaxy/galaxy_dist/tools/SNiPlay/SnpEff/snpEff"; | |
40 my $SNPEFF_PATH = $ENV{SNPEFF_JAR_PATH}; | |
41 | |
42 | |
43 my $session = $$; | |
44 mkdir($session); | |
45 mkdir("$session/data"); | |
46 mkdir("$session/data/genomes"); | |
47 mkdir("$session/data/myspecies"); | |
48 | |
49 system("cp -rf $fasta $session/data/genomes/myspecies.fa"); | |
50 system("cp -rf $gff $session/data/myspecies/genes.gff"); | |
51 | |
52 open(my $C,"$SNPEFF_PATH/snpEff.config"); | |
53 open(my $C2,">$session/snpEff.config"); | |
54 while(<$C>) | |
55 { | |
56 if (/data_dir/) | |
57 { | |
58 print $C2 "data_dir = ./data\n"; | |
59 } | |
60 elsif (/^genomes/) | |
61 { | |
62 print $C2 "genomes : \\n"; | |
63 print $C2 "myspecies, myspecies \\n"; | |
64 } | |
65 else | |
66 { | |
67 print $C2 $_; | |
68 } | |
69 } | |
70 print $C2 "myspecies.genome : myspecies\n"; | |
71 close($C); | |
72 close($C2); | |
73 | |
74 | |
1
633d264f8888
planemo upload commit 475f4d7d8442a0d75e103af326ae5881c4d2a4ac
dereeper
parents:
0
diff
changeset
|
75 my $build_cmd = "snpEff build -c $session/snpEff.config -gff3 myspecies"; |
633d264f8888
planemo upload commit 475f4d7d8442a0d75e103af326ae5881c4d2a4ac
dereeper
parents:
0
diff
changeset
|
76 #my $build_cmd = "java -jar $SNPEFF_PATH/snpEff.jar build -c $session/snpEff.config -gff3 myspecies"; |
0 | 77 system($build_cmd); |
78 | |
1
633d264f8888
planemo upload commit 475f4d7d8442a0d75e103af326ae5881c4d2a4ac
dereeper
parents:
0
diff
changeset
|
79 my $eff_cmd = "snpEff eff -c $session/snpEff.config -o vcf -no-downstream -no-upstream myspecies -s $html $input >$output"; |
633d264f8888
planemo upload commit 475f4d7d8442a0d75e103af326ae5881c4d2a4ac
dereeper
parents:
0
diff
changeset
|
80 #my $eff_cmd = "java -jar $SNPEFF_PATH/snpEff.jar eff -c $session/snpEff.config -o vcf -no-downstream -no-upstream myspecies -s $html $input >$output"; |
0 | 81 system($eff_cmd); |
82 | |
83 | |
84 system("rm -rf $session"); |