python - ete3: How to get taxonomic rank names from taxonomy id? -
i want use convert bunch of identifiers need know taxonomic rank assigned each taxonomy code. shown below example of conversion makes sense don't know label of taxonomy calls. basic taxonomic ranks are: (domain, kingdom, phylum, class, order, family, genus, , species) https://en.wikipedia.org/wiki/taxonomic_rank.
for cases easy, in case of having subspecies , strains bacteria can confusing.
how ete3 specify rank lineage ids correspond in taxonomic rank?
import ete3 import pandas pd  ncbi = ete3.ncbitaxa() taxon_id = 505 lineage = ncbi.get_lineage(taxon_id) se_lineage = pd.series(ncbi.get_taxid_translator(lineage), name=taxon_id) se_lineage[lineage]   1                       root 131567    cellular organisms 2                   bacteria 1224          proteobacteria 28216     betaproteobacteria 206351          neisseriales 481            neisseriaceae 32257               kingella 505          kingella oralis name: 505, dtype: object      
use ncbi.get_rank() dictionary of {id:name} basic transformations {name:taxonomy}
Comments
Post a Comment