Skip to content

Commit

Permalink
Update gene translation in CDS creation (#301)
Browse files Browse the repository at this point in the history
The gene translation in CDS creation has been updated to handle the meta mode where pyrodigal uses the translation table the gene was predicted with. This change ensures accurate translation of genes in different modes.
  • Loading branch information
ohickl authored Jul 10, 2024
1 parent 560f926 commit c93c3f1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bakta/features/cds.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,13 @@ def create_cdss(genes, contig):
partial_cdss_per_sequence.append(cds)
else:
cdss_per_sequence.append(cds)
aa = gene.translate(translation_table=cfg.translation_table).upper()

# In meta mode, let pyrodigal use the translation table the gene was predicted with
if cfg.meta:
aa = gene.translate(translation_table=None).upper()
else:
aa = gene.translate(translation_table=cfg.translation_table).upper()

if('truncated' not in cds or cds['truncated'] == bc.FEATURE_END_5_PRIME):
aa = aa[:-1] # discard trailing asterisk
cds['aa'] = aa
Expand Down

0 comments on commit c93c3f1

Please sign in to comment.