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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
1 #!/usr/bin/perl
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
2
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
3 use strict;
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
4 use Getopt::Long;
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
5
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
6 my $usage = qq~Usage:$0 <args> [<opts>]
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
7 where <args> are:
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
8 -i, --input <input VCF>
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
9 -o, --output <output>
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
10 -g, --gff <GFF annotation>
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
11 -f, --fasta <Fasta of chromosomes>
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
12 -h, --html <HTML output>
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
13 ~;
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
14 $usage .= "\n";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
15
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
16 my ($input,$output,$gff,$fasta,$html);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
17
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
18
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
19 GetOptions(
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
20 "input=s" => \$input,
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
21 "output=s" => \$output,
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
22 "gff=s" => \$gff,
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
23 "fasta=s" => \$fasta,
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
24 "html=s" => \$html
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
25 );
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
26
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
27
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
28 die $usage
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
29 if ( !$input || !$output || !$fasta || !$gff || !$html);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
30
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
31
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
32 if (!-e $gff){
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
33 die "Error: GFF input does not exist\n"
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
34 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
35 if (!-e $fasta){
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
36 die "Error: Fasta input does not exist\n"
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
37 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
38
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
39 #my $SNPEFF_PATH = "/usr/local/bioinfo/galaxy/galaxy_dist/tools/SNiPlay/SnpEff/snpEff";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
40 my $SNPEFF_PATH = $ENV{SNPEFF_JAR_PATH};
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
41
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
42
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
43 my $session = $$;
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
44 mkdir($session);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
45 mkdir("$session/data");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
46 mkdir("$session/data/genomes");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
47 mkdir("$session/data/myspecies");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
48
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
49 system("cp -rf $fasta $session/data/genomes/myspecies.fa");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
50 system("cp -rf $gff $session/data/myspecies/genes.gff");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
51
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
52 open(my $C,"$SNPEFF_PATH/snpEff.config");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
53 open(my $C2,">$session/snpEff.config");
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
54 while(<$C>)
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
55 {
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
56 if (/data_dir/)
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
57 {
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
58 print $C2 "data_dir = ./data\n";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
59 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
60 elsif (/^genomes/)
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
61 {
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
62 print $C2 "genomes : \\n";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
63 print $C2 "myspecies, myspecies \\n";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
64 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
65 else
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
66 {
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
67 print $C2 $_;
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
68 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
69 }
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
70 print $C2 "myspecies.genome : myspecies\n";
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
71 close($C);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
72 close($C2);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
73
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
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
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
77 system($build_cmd);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
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
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
81 system($eff_cmd);
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
82
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
83
abde5b0387c8 Uploaded
dereeper
parents:
diff changeset
84 system("rm -rf $session");