Package list barrnap / dacdd2b9-f84b-477d-8e9f-19614858fb2b/main debian / patches / use_both_hmmsets
dacdd2b9-f84b-477d-8e9f-19614858fb2b/main

Tree @dacdd2b9-f84b-477d-8e9f-19614858fb2b/main (Download .tar.gz)

use_both_hmmsets @dacdd2b9-f84b-477d-8e9f-19614858fb2b/mainraw · history · blame

Description: Use_both_hmmsets
Index: barrnap/bin/barrnap
===================================================================
--- barrnap.orig/bin/barrnap
+++ barrnap/bin/barrnap
@@ -3,6 +3,7 @@ use strict;
 use warnings;
 use List::Util qw(max);
 use FindBin;
+use File::Temp qw/ tempfile tempdir /;
 use File::Temp;
 
 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
@@ -64,6 +65,7 @@ my $kdom = $KINGDOM{ lc substr($kingdom,
 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 @@ $fasta && -r $fasta or err("No input fil
 # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
 # run the external command
 
+if (-e $nonfreehmmdb)  {
+  # prepare full pHMM file (with nonfree if it exists)
+  open ( HMMDB, "<", $hmmdb ) or die "Could not open file $hmmdb: $!";
+  open ( NONFREE, "<", $nonfreehmmdb );
+  my ($tmpfile, $tmpfilename) = tempfile();
+  while ( my $line = <HMMDB> ) {
+    print $tmpfile $line;
+  }
+  while ( my $line = <NONFREE> ) {
+    print $tmpfile $line;
+  }
+  $hmmdb = $tmpfilename
+}
+
 msg("Scanning $fasta for $kdom rRNA genes... please wait");
 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 @@ foreach (@hits) {
   # check for incomplete alignments
   my $note = '';
   my $len = $end-$begin+1;
-  
+
   if ( $len < int($reject * $LENG{$gene}) ) {
     msg("Rejecting short $len nt predicted $gene. Adjust via --reject option.");
     next HIT;
@@ -144,7 +160,7 @@ foreach (@hits) {
   ];
 }
 
-# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
+# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 # output a sorted GFF3
 
 sub gff_sort {