List of valid tables for Seq.translate()
1
0
Entering edit mode
9.4 years ago
hydrofilie ▴ 10

Is there a way to get the list of valid values for table argument of the translate() method programatically?

Or, if I want to try all, do I need to provide the list of the valid tables manually?

python seq • 2.2k views
ADD COMMENT
0
Entering edit mode

Are you referring to BioPython Seq.translate() or Python string.translate()?

ADD REPLY
0
Entering edit mode

Seq.translate()

ADD REPLY
1
Entering edit mode
9.4 years ago

Take a look at the end of this file, where the codon tables are defined.

EDIT

Looks like you just need to do:

>>> from Bio.Data.CodonTable import generic_by_name

>>> generic_by_name.keys()

dict_keys(['Hexamita Nuclear', 'SGC4', 'Alternative Yeast Nuclear', 'SGC1', 'SGC8', 'Standard', 'SGC9', 'Yeast Mitochondrial', 'Scenedesmus obliquus Mitochondrial', 'Plant Plastid', 'Alternative Flatworm Mitochondrial', 'Ascidian Mitochondrial', 'Vertebrate Mitochondrial', 'SGC0', 'Dasycladacean Nuclear', 'Coelenterate Mitochondrial', 'Invertebrate Mitochondrial', 'Trematode Mitochondrial', 'Bacterial', 'Flatworm Mitochondrial', 'Echinoderm Mitochondrial', 'Mycoplasma', 'Blepharisma Macronuclear', 'SGC2', 'Ciliate Nuclear', 'Thraustochytrium Mitochondrial', 'Mold Mitochondrial', 'Euplotid Nuclear', 'Chlorophycean Mitochondrial', 'Spiroplasma', 'SGC5', 'SGC3', 'Protozoan Mitochondrial'])
ADD COMMENT
1
Entering edit mode

If I have time I'll look into adding this as a new function.

ADD REPLY
0
Entering edit mode

that would be great, thanks

ADD REPLY
0
Entering edit mode

I have found that already, but the problem is, that new codes may be added/removed and I want the program to know all codes in the recent version without rewriting the code after each change.

ADD REPLY
0
Entering edit mode

Take a look at my edit. It seems like you can already find this list of codes.

ADD REPLY

Login before adding your answer.

Traffic: 2532 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6