Skip to content

Commit

Permalink
chore: Update gene translation in CDS creation
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 committed Jul 9, 2024
1 parent 3bbc7b8 commit b4066fa
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 b4066fa

Please sign in to comment.