This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Fetching NCBI ID for a list of species?

I have a long list of species names.

I was wondering whether a tool was available online, which could fetch the NCBI IDs?

gene phylogeny

obligatory R code:

library("myTAI")
data=c("Homo sapiens", "Mus musculus")
sapply(data, function(x) taxonomy(x, db = "ncbi", output   = "taxid"))

2 answers

try taxonkit, providing single binary files for Windows/Linux. It's really fast.

$ cat names.txt 
Homo sapiens
Akkermansia muciniphila ATCC BAA-835
Akkermansia muciniphila
Mouse Intracisternal A-particle
Wei Shen
uncultured murine large bowel bacterium BAC 54B
Croceibacter phage P2559Y

$ time taxonkit name2taxid names.txt
[INFO] parsing names file: /home/shenwei/.taxonkit/names.dmp
[INFO] 1587755 names parsed
Homo sapiens    9606
Akkermansia muciniphila ATCC BAA-835    349741
Akkermansia muciniphila 239935
Mouse Intracisternal A-particle 11932
Wei Shen
uncultured murine large bowel bacterium BAC 54B 314101
Croceibacter phage P2559Y       1327037

real    0m7.217s
user    0m10.682s
sys     0m0.471s

$ time taxonkit name2taxid names.txt | taxonkit lineage -i 2
Homo sapiens    9606    cellular organisms;Eukaryota;Opisthokonta;Metazoa;Eumetazoa;Bilateria;Deuterostomia;Chordata;Craniata;Vertebrata;Gnathostomata;Teleostomi;Euteleostomi;Sarcopterygii;Dipnotetrapodomorpha;Tetrapoda;Amniota;Mammalia;Theria;Eutheria;Boreoeutheria;Euarchontoglires;Primates;Haplorrhini;Simiiformes;Catarrhini;Hominoidea;Hominidae;Homininae;Homo;Homo sapiens
Akkermansia muciniphila ATCC BAA-835    349741  cellular organisms;Bacteria;PVC group;Verrucomicrobia;Verrucomicrobiae;Verrucomicrobiales;Akkermansiaceae;Akkermansia;Akkermansia muciniphila;Akkermansia muciniphila ATCC BAA-835
...

real    0m13.151s
user    0m23.251s
sys     0m0.948s

This is a very powerful and useful tool. Thank you

NCBI esearch with db=taxonomy https://www.ncbi.nlm.nih.gov/books/NBK25499/

https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?db=taxonomy&term=%22Homo+sapiens%22


https://eutils.ncbi.nlm.nih.gov/eutils/dtd/20060628/esearch.dtd">
<eSearchResult>
  <Count>1</Count>
  <RetMax>1</RetMax>
  <RetStart>0</RetStart>
  <IdList>
    <Id>9606</Id>
  </IdList>
  <TranslationSet/>
  <TranslationStack>
    <TermSet>
      <Term>"Homo sapiens"[All Names]</Term>
      <Field>All Names</Field>
      <Count>1</Count>
      <Explode>N</Explode>
    </TermSet>
    <OP>GROUP</OP>
  </TranslationStack>
  <QueryTranslation>"Homo sapiens"[All Names]</QueryTranslation>
</eSearchResult>

Thanks Pierre. However I have a list of 3000+ species, doing each one individually would be exhaustive. Is there a way of inputting the entire list in to the db?

Log in to answer this question.