Skip to content

Commit

Permalink
fix pyrodigal training mode on provided training files #175
Browse files Browse the repository at this point in the history
Reset the pyrodigal meta mode to False even for sequences shorter than the required min if a training files is provided.
  • Loading branch information
oschwengers committed Dec 6, 2022
1 parent 0962df7 commit e37d332
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bakta/features/cds.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def predict(genome: dict, sequences_path: Path):
prodigal_tf_path = cfg.prodigal_tf
trainings_info = None
prodigal_metamode = genome['size'] < pyrodigal.MIN_SINGLE_GENOME # 20_000 bp
log.debug('prodigal mode: meta=%s', prodigal_metamode)
if(prodigal_tf_path is None):
closed = not genome['complete']
if(not prodigal_metamode):
Expand All @@ -45,7 +46,8 @@ def predict(genome: dict, sequences_path: Path):
try:
with prodigal_tf_path.open('rb') as fh_tf:
trainings_info = pyrodigal.TrainingInfo.load(fh_tf)
log.info('use provided prodigal training file: file=%s', prodigal_tf_path)
prodigal_metamode = False
log.info('use provided prodigal training info: file=%s, meta mode=%s', prodigal_tf_path, prodigal_metamode)
except:
log.error('Cannot use provided prodigal training file: file=%s', prodigal_tf_path)
sys.exit(f'Error! Cannot use provided prodigal training file: file={prodigal_tf_path}')
Expand Down

0 comments on commit e37d332

Please sign in to comment.