This is a test version of Biostars. For the public version, visit https://www.biostars.org.
converting taxID to taxonomy

Hello,

I know the following question have been asked many times by now, but the suggested solutions were not helpful. I have a set of taxIDs and I want to convert them to taxonomies, but I do not want to download any extra databases. Is there any simple way to do this via terminal?

ncbi taxonomy taxid terminal

, but the suggested solutions were not helpful

so, what did you try ?

2 answers

Another solution using Entrez Direct

efetch -db taxonomy -id 387462,2594474 -format xml | \
xtract -pattern Taxon -first TaxId -element Taxon -block "*/Taxon"  \
-unless Rank -equals "no rank" -tab "," -sep "_" -element Rank,ScientificName

387462  superkingdom_Eukaryota,kingdom_Metazoa,phylum_Mollusca,class_Gastropoda,subclass_Caenogastropoda,order_Littorinimorpha,superfamily_Stromboidea,family_Strombidae,genus_Strombus
2594474 superkingdom_Bacteria,phylum_Firmicutes,class_Clostridia,order_Clostridiales,family_Peptococcaceae,genus_Dehalobacter

Using Entrezdirect:

$ esearch -db taxonomy -query "4932 [taxID]" | efetch -format nativemode xml | xtract -pattern Taxon -block "*/Taxon" -unless Rank -equals "no rank" -tab "\n" -element Rank,ScientificName
superkingdom    Eukaryota
kingdom Fungi
subkingdom  Dikarya
phylum  Ascomycota
subphylum   Saccharomycotina
class   Saccharomycetes
order   Saccharomycetales
family  Saccharomycetaceae
genus   Saccharomyces

OR

$ esearch -db taxonomy -query "4932 [taxID]" | efetch -format native -mode xml | grep ScientificName | awk -F ">|<" 'BEGIN{ORS=", ";}{print $3;}'
Saccharomyces cerevisiae, cellular organisms, Eukaryota, Opisthokonta, Fungi, Dikarya, Ascomycota, saccharomyceta, Saccharomycotina, Saccharomycetes, Saccharomycetales, Saccharomycetaceae, Saccharomyces

@genomax Thank you very much, it works perfectly. There is a manual on how to use Entrez on NCBI, but I find it difficult to use. Do you have any suggestions for me on how to learn Entrez' commands properly?

Log in to answer this question.