forked from Trinotate/Trinotate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Trinotate
executable file
·130 lines (85 loc) · 4.02 KB
/
Trinotate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/usr/bin/env perl
use strict;
use warnings;
use FindBin;
my $usage = <<_EOUSAGE_;
usage: $0 <sqlite.db> <command> <input> [...]
<commands>:
* Initial import of transcriptome and protein data:
init --gene_trans_map <file> --transcript_fasta <file> --transdecoder_pep <file>
* Transdecoder protein search results:
LOAD_swissprot_blastp <file>
LOAD_pfam <file> [--hmmsearch (optional)]
LOAD_tmhmm <file>
LOAD_signalp <file>
* Trinity transcript search results:
LOAD_swissprot_blastx <file>
LOAD_rnammer <file>
* Load custom blast results using any searchable database
LOAD_custom_blast --outfmt6 <file> --prog <blastp|blastx> --dbtype <database_name>
* report generation:
report [ -E (default: 1e-5) ] [--pfam_cutoff DNC|DGC|DTC|SNC|SGC|STC (default: DNC=domain noise cutoff)]
_EOUSAGE_
;
unless (scalar @ARGV >= 2) { die $usage; }
my $sqlite_db = shift @ARGV;
my $command = shift @ARGV;
unless (-s $sqlite_db) {
die "Error, cannot locate $sqlite_db database file. Be sure it's in your current directory.";
}
if ($command ne 'report' && ! @ARGV) {
die $usage . "\n\nMissing parameter.\n\n";
}
my %commands = map { + $_ => 1 } qw(LOAD_swissprot_blastp LOAD_swissprot_blastx
LOAD_pfam LOAD_tmhmm LOAD_signalp LOAD_rnammer
LOAD_custom_blast
report init);
unless (exists $commands{$command}) {
die "$usage\nError, do not recognize command: $command\n";
}
my $util_dir = "$FindBin::RealBin/util";
my $loaders_dir = "$util_dir/trinotateSeqLoader";
unless (@ARGV) {
@ARGV = (""); # to avoid error messages in using $ARGV[0] below
}
my %command_to_params = (
# protein-based
'LOAD_swissprot_blastp' => "$loaders_dir/Trinotate_BLAST_loader.pl --sqlite $sqlite_db --outfmt6 $ARGV[0] --prog blastp --dbtype Swissprot",
'LOAD_trembl_blastp' => "$loaders_dir/Trinotate_BLAST_loader.pl --sqlite $sqlite_db --outfmt6 $ARGV[0] --prog blastp --dbtype TrEMBL",
'LOAD_pfam' => "$loaders_dir/Trinotate_PFAM_loader.pl --sqlite $sqlite_db --pfam @ARGV",
'LOAD_tmhmm' => "$loaders_dir/Trinotate_TMHMM_loader.pl --sqlite $sqlite_db --tmhmm $ARGV[0]",
'LOAD_signalp' => "$loaders_dir/Trinotate_SIGNALP_loader.pl --sqlite $sqlite_db --signalp $ARGV[0]",
# transcript-based
'LOAD_swissprot_blastx' => "$loaders_dir/Trinotate_BLAST_loader.pl --sqlite $sqlite_db --outfmt6 $ARGV[0] --prog blastx --dbtype Swissprot",
'LOAD_trembl_blastx' => "$loaders_dir/Trinotate_BLAST_loader.pl --sqlite $sqlite_db --outfmt6 $ARGV[0] --prog blastx --dbtype TrEMBL",
'LOAD_rnammer' => "$loaders_dir/Trinotate_RNAMMER_loader.pl --sqlite $sqlite_db --rnammer $ARGV[0]",
# custom blast searches
'LOAD_custom_blast' => "$loaders_dir/Trinotate_BLAST_loader.pl --sqlite $sqlite_db @ARGV",
);
if (my $cmd = $command_to_params{$command}) {
&process_cmd($cmd);
}
elsif ($command eq "report") {
## generate Trinotate report.
my $cmd = "$FindBin::RealBin/util/Trinotate_report_writer.pl --sqlite $sqlite_db @ARGV";
&process_cmd($cmd);
}
elsif ($command eq "init") {
# populate sequence and gene/trans/orf data
my $cmd = "$FindBin::RealBin/util/trinotateSeqLoader/TrinotateSeqLoader.pl --sqlite $sqlite_db @ARGV --bulk_load";
&process_cmd($cmd);
}
else {
die "Error, do not recognize command: $command ";
}
exit(0);
####
sub process_cmd {
my ($cmd) = @_;
print STDERR "CMD: $cmd\n";
my $ret = system($cmd);
if ($ret) {
die "Error, cmd: $cmd died with ret $ret";
}
return;
}