Hi there,
I wonder if there is a smart way to retrieve the codon tables for all sequences from all contigs/scaffolds/chromosomes for all genomes from Ensembl and EnsemblGenomes databases. I suppose that all sequences from this same chromosome share the same codon table. Consequently, the question means that I need to have all contigs/scaffolds/chromosomes with their corresponding NCBI genetic codes number ( https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi ).
I realise that for a specific sequence, using MySQL database search might work. But I hope to obtain all the information for all genomes, which seems impossible to get it done through MySQL query.
Many thanks,
Tom
1 answer
Hi wangdp123,
In Ensembl, the codon table is typically stored in seq_region_attrib under attrib_type_id 11. For vertebrates, only the MT has the attribute, and so the API uses the standard codon table if the attribute is not present. The codon table numbers correspond to BioPerl functionality.
You can get this information per species but as you say, it would be extremely inefficient to retrieve this information from every species DB via SQL. However, the core API does the right thing with every translate().
The core API has get_all_attributes on Bio::EnsEMBL::Slice, with the relevant value being "codon_table". See: https://github.com/Ensembl/ensembl/blob/d3e7d31529700643a59088813318184c7c5c9ff4/modules/Bio/EnsEMBL/Transcript.pm#L2108
The same code should apply to non-vertebrates too.
Then you need to figure out how to iterate over all species, and successively fetch all slices with a SliceAdaptor, and call the get_all_attributes('codon_table') on each slice.
Best wishes
Ben Ensembl Helpdesk
Log in to answer this question.