Skip to content

Commit

Permalink
feat(add extra prodigal check):
Browse files Browse the repository at this point in the history
Add extra prodigal check to make sure Prodigal is not crashing
This is
to patch issue #451
  • Loading branch information
pchaumeil committed Jan 11, 2023
1 parent 544ff9c commit 7743a5f
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions gtdbtk/biolib_lite/prodigal_biolib.py
Expand Up @@ -26,6 +26,7 @@
import ntpath
import os
import shutil
import subprocess
import tempfile
from collections import defaultdict, namedtuple

Expand Down Expand Up @@ -134,14 +135,24 @@ def _producer(self, genome_file):
if self.closed_ends:
args += ' -c'

cmd = 'prodigal %s -p %s -q -f gff -g %d -a %s -d %s -i %s > %s 2> /dev/null' % (args,
proc_str,
translation_table,
aa_gene_file_tmp,
nt_gene_file_tmp,
processed_prodigal_input,
gff_file_tmp)
os.system(cmd)

cmd = ['prodigal',args,'-p',proc_str,'-q',
'-f','gff','-g',str(translation_table),
'-a',aa_gene_file_tmp,'-d',nt_gene_file_tmp,
'-i',processed_prodigal_input,'-o',gff_file_tmp]

proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, encoding='utf-8')

stdout, stderr = proc.communicate()
#This extra step has been added for the issue 451 where Prodigal can return a free pointer error
if proc.returncode != 0:
self.logger.warning('Error running Prodigal on genome: '
'{}'.format(genome_file))
self.logger.warning('Error message:')
for line in stderr.splitlines():
print(line)
self.logger.warning('This genome is skipped.')

# determine coding density
prodigalParser = ProdigalGeneFeatureParser(gff_file_tmp)
Expand Down

0 comments on commit 7743a5f

Please sign in to comment.