This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get NCBI Accession Number from Taxonomy ID

How to get NCBI Accession Number by Taxonomy ID ?

accession ncbi taxonomy id number

What do you mean NCBI accession number? That is usually the tax id. Could you provide an example, please ?

Using Entrezdirect (example taxID of E. coli):

$ esearch -db taxonomy -query "562 [taxID]" | elink -target nuccore | efetch -format acc | head -5
1QRU_B
1QRT_B
1QRS_B
NC_010064.1
2PXV_B

There are 64,700 as of today. So you will want to be specific as to what kind of accession you are looking for.

1 answer

Hi Dan,

You can use NCBI Datasets. If you're looking for genome accessions, you can use the following command (I'm using human, 9606 as an example of taxid)

datasets summary genome taxon 9606 --assmaccs

datasets will return a list of accessions in JSON format. If you want more information than that, you can remove the assmaccs and you would have the complete JSON with info about each assembly. You can then parse the information using jq, for example.

Let me know if you have any questions or if you are looking for something else.

Log in to answer this question.