Package list barrnap / cf4456a
refresh patches Sascha Steinbiss 3 years ago
2 changed file(s) with 14 addition(s) and 90 deletion(s). Raw diff Collapse all Expand all
00 Description: Use_both_hmmsets
11 --- a/bin/barrnap
22 +++ b/bin/barrnap
3 @@ -4,8 +4,9 @@
4 use Time::Piece;
3 @@ -3,6 +3,7 @@
4 use warnings;
55 use List::Util qw(max);
66 use FindBin;
77 +use File::Temp qw/ tempfile tempdir /;
8 use File::Temp;
89
9 -# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10 +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 # global variables
12
13 my $EXE = $FindBin::RealScript;
14 @@ -29,13 +30,13 @@
15 );
16 my $MAXLEN = int( 1.2 * max(values %LENG) );
17
18 -# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19 +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20 # command line options
21
22 my(@Options, $quiet, $kingdom, $threads, $evalue, $lencutoff, $reject, $incseq);
23 setOptions();
24
25 -# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
26 +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27 # check all is well
28
29 msg("This is $EXE $VERSION");
30 @@ -64,23 +65,38 @@
10 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11 @@ -64,6 +65,7 @@
3112 my $hmmdb = "$DBDIR/$kdom.hmm";
3213 err("Can't find database: $hmmdb") unless -r $hmmdb;
3314 msg("Using database: $hmmdb");
3415 +my $nonfreehmmdb = "$DBDIR/nonfree/$kdom.hmm";
3516
36 -# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37 +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
18 # check if user is piping to STDIN
19 @@ -84,6 +86,20 @@
20 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3821 # run the external command
39
40 my $fasta = shift @ARGV;
41 $fasta && -r $fasta or err("Usage: $EXE <file.fasta>");
4222
4323 +if (-e $nonfreehmmdb) {
4424 + # prepare full pHMM file (with nonfree if it exists)
5535 +}
5636 +
5737 msg("Scanning $fasta for $kdom rRNA genes... please wait");
58 my $cmd = "$NHMMER --cpu $threads -E $evalue --w_length $MAXLEN -o /dev/null --tblout /dev/stdout \Q$hmmdb\E \Q$fasta\E";
59 msg("Command: $cmd");
60 my @hits = qx($cmd 2>&1);
61
62 -# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
63 +# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64 # process the output
65
66 my @feat;
67 -HIT:
68 +HIT:
69 foreach (@hits) {
70 chomp;
71 err("nhmmer failed to run - $_") if m/fail|error|core dump|bus error/i;
72 @@ -103,7 +119,7 @@
38 my $opts = "--cpu $threads -E $evalue --w_length $MAXLEN -o /dev/null --tblout /dev/stdout";
39 my $cmd = "nhmmer $opts '$hmmdb' '$fasta'";
40 @@ -123,7 +139,7 @@
7341 # check for incomplete alignments
7442 my $note = '';
7543 my $len = $end-$begin+1;
7846 if ( $len < int($reject * $LENG{$gene}) ) {
7947 msg("Rejecting short $len nt predicted $gene. Adjust via --reject option.");
8048 next HIT;
81 @@ -121,7 +137,7 @@
49 @@ -144,7 +160,7 @@
8250 ];
8351 }
8452
8755 # output a sorted GFF3
8856
8957 sub gff_sort {
90 @@ -169,13 +185,13 @@
91
92 sub show_citation {
93 print STDERR << "EOCITE";
94 -
95 +
96 If you use Barrnap in your work, please cite:
97
98 Seemann T (2013)
99 $EXE $VERSION : $DESC
100 $URL
101 -
102 +
103 Thank you.
104
105 EOCITE
106 @@ -194,7 +210,7 @@
107 {OPT=>"help", VAR=>\&usage, DESC=>"This help"},
108 {OPT=>"version", VAR=>\&version, DESC=>"Print version and exit"},
109 {OPT=>"citation",VAR=>\&show_citation, DESC=>"Print citation for referencing $EXE"},
110 - {OPT=>"kingdom=s", VAR=>\$kingdom, DEFAULT=>'bac',
111 + {OPT=>"kingdom=s", VAR=>\$kingdom, DEFAULT=>'bac',
112 DESC=>"Kingdom: ".join(' ', values %KINGDOM) },
113 {OPT=>"quiet!", VAR=>\$quiet, DEFAULT=>0, DESC=>"No screen output"},
114 {OPT=>"threads=i", VAR=>\$threads, DEFAULT=>8, DESC=>"Number of threads/cores/CPUs to use"},
115 @@ -227,15 +243,15 @@
116 my $def = defined($_->{DEFAULT}) ? " (default '$_->{DEFAULT}')" : "";
117 $def = ($def ? ' (default OFF)' : '(default ON)') if $_->{OPT} =~ m/!$/;
118 my $opt = $_->{OPT};
119 - $opt =~ s/!$//;
120 - $opt =~ s/=s$/ [X]/;
121 + $opt =~ s/!$//;
122 + $opt =~ s/=s$/ [X]/;
123 $opt =~ s/=i$/ [N]/;
124 $opt =~ s/=f$/ [n.n]/;
125 printf STDERR " --%-15s %s%s\n", $opt, $_->{DESC}, $def;
126 }
127 else {
128 print STDERR "$_\n";
129 - }
130 + }
131 }
132 exit(1);
133 }
11 --- a/bin/barrnap
22 +++ b/bin/barrnap
33 @@ -14,6 +14,9 @@
4 my $AUTHOR = 'Torsten Seemann <torsten.seemann@gmail.com>';
4 my $AUTHOR = 'Torsten Seemann';
55 my $URL = 'https://github.com/tseemann/barrnap';
66 my $DBDIR = "$FindBin::RealBin/../db";
77 +if ( ! -e $DBDIR) {