diff --git a/debian/patches/use_both_hmmsets b/debian/patches/use_both_hmmsets index 64931c9..7daf6f0 100644 --- a/debian/patches/use_both_hmmsets +++ b/debian/patches/use_both_hmmsets @@ -1,45 +1,25 @@ Description: Use_both_hmmsets --- a/bin/barrnap +++ b/bin/barrnap -@@ -4,8 +4,9 @@ - use Time::Piece; +@@ -3,6 +3,7 @@ + use warnings; use List::Util qw(max); use FindBin; +use File::Temp qw/ tempfile tempdir /; + use File::Temp; --# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - # global variables - - my $EXE = $FindBin::RealScript; -@@ -29,13 +30,13 @@ - ); - my $MAXLEN = int( 1.2 * max(values %LENG) ); - --# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - # command line options - - my(@Options, $quiet, $kingdom, $threads, $evalue, $lencutoff, $reject, $incseq); - setOptions(); - --# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - # check all is well - - msg("This is $EXE $VERSION"); -@@ -64,23 +65,38 @@ + # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +@@ -64,6 +65,7 @@ my $hmmdb = "$DBDIR/$kdom.hmm"; err("Can't find database: $hmmdb") unless -r $hmmdb; msg("Using database: $hmmdb"); +my $nonfreehmmdb = "$DBDIR/nonfree/$kdom.hmm"; --# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + # check if user is piping to STDIN +@@ -84,6 +86,20 @@ + # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . # run the external command - - my $fasta = shift @ARGV; - $fasta && -r $fasta or err("Usage: $EXE "); +if (-e $nonfreehmmdb) { + # prepare full pHMM file (with nonfree if it exists) @@ -56,21 +36,9 @@ +} + msg("Scanning $fasta for $kdom rRNA genes... please wait"); - my $cmd = "$NHMMER --cpu $threads -E $evalue --w_length $MAXLEN -o /dev/null --tblout /dev/stdout \Q$hmmdb\E \Q$fasta\E"; - msg("Command: $cmd"); - my @hits = qx($cmd 2>&1); - --# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . -+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - # process the output - - my @feat; --HIT: -+HIT: - foreach (@hits) { - chomp; - err("nhmmer failed to run - $_") if m/fail|error|core dump|bus error/i; -@@ -103,7 +119,7 @@ + my $opts = "--cpu $threads -E $evalue --w_length $MAXLEN -o /dev/null --tblout /dev/stdout"; + my $cmd = "nhmmer $opts '$hmmdb' '$fasta'"; +@@ -123,7 +139,7 @@ # check for incomplete alignments my $note = ''; my $len = $end-$begin+1; @@ -79,7 +47,7 @@ if ( $len < int($reject * $LENG{$gene}) ) { msg("Rejecting short $len nt predicted $gene. Adjust via --reject option."); next HIT; -@@ -121,7 +137,7 @@ +@@ -144,7 +160,7 @@ ]; } @@ -88,47 +56,3 @@ # output a sorted GFF3 sub gff_sort { -@@ -169,13 +185,13 @@ - - sub show_citation { - print STDERR << "EOCITE"; -- -+ - If you use Barrnap in your work, please cite: - - Seemann T (2013) - $EXE $VERSION : $DESC - $URL -- -+ - Thank you. - - EOCITE -@@ -194,7 +210,7 @@ - {OPT=>"help", VAR=>\&usage, DESC=>"This help"}, - {OPT=>"version", VAR=>\&version, DESC=>"Print version and exit"}, - {OPT=>"citation",VAR=>\&show_citation, DESC=>"Print citation for referencing $EXE"}, -- {OPT=>"kingdom=s", VAR=>\$kingdom, DEFAULT=>'bac', -+ {OPT=>"kingdom=s", VAR=>\$kingdom, DEFAULT=>'bac', - DESC=>"Kingdom: ".join(' ', values %KINGDOM) }, - {OPT=>"quiet!", VAR=>\$quiet, DEFAULT=>0, DESC=>"No screen output"}, - {OPT=>"threads=i", VAR=>\$threads, DEFAULT=>8, DESC=>"Number of threads/cores/CPUs to use"}, -@@ -227,15 +243,15 @@ - my $def = defined($_->{DEFAULT}) ? " (default '$_->{DEFAULT}')" : ""; - $def = ($def ? ' (default OFF)' : '(default ON)') if $_->{OPT} =~ m/!$/; - my $opt = $_->{OPT}; -- $opt =~ s/!$//; -- $opt =~ s/=s$/ [X]/; -+ $opt =~ s/!$//; -+ $opt =~ s/=s$/ [X]/; - $opt =~ s/=i$/ [N]/; - $opt =~ s/=f$/ [n.n]/; - printf STDERR " --%-15s %s%s\n", $opt, $_->{DESC}, $def; - } - else { - print STDERR "$_\n"; -- } -+ } - } - exit(1); - } diff --git a/debian/patches/use_debian_dirs b/debian/patches/use_debian_dirs index 914f98e..351364a 100644 --- a/debian/patches/use_debian_dirs +++ b/debian/patches/use_debian_dirs @@ -2,7 +2,7 @@ --- a/bin/barrnap +++ b/bin/barrnap @@ -14,6 +14,9 @@ - my $AUTHOR = 'Torsten Seemann '; + my $AUTHOR = 'Torsten Seemann'; my $URL = 'https://github.com/tseemann/barrnap'; my $DBDIR = "$FindBin::RealBin/../db"; +if ( ! -e $DBDIR) {