Thank you! It worked
Hello everyone,
I am currently working on a project where I need to map a large list of organisms identified by their NCBI taxid to their corresponding ott_id in the Open Tree of Life taxonomy. Due to the extensive size of the list (thousands of taxid), I'm looking for an efficient method to do this without relying on scientific names, as they can introduce inaccuracies due to synonymy and naming inconsistencies. The final purpose is to obtain the corresponding synthetic tree from Open Tree of Life using the ott_id.
Is there an API or service that accepts taxid directly and returns ott_id? Has anyone handled a similar task with a large volume of taxonomic data, and could you share your approach or best practices? Any guidance, links, or examples would be greatly appreciated!
Thank you in advance for your help!
Martin
1 answer
You can use the API provided by Tree of Life (LINK):
$ curl -X POST https://api.opentreeoflife.org/v3/taxonomy/taxon_info -H 'content-type:application/json' -d '{"source_id":"ncbi:9443"}'
{
"flags": [],
"is_suppressed": false,
"is_suppressed_from_synth": false,
"name": "Primates",
"ott_id": 913935,
"rank": "no rank",
"source": "ott3.7draft2",
"synonyms": [
"Ceciliolemuridae",
"Primata",
"primate"
],
"tax_sources": [
"ncbi:9443",
"gbif:798",
"irmng:11338"
],
"unique_name": "Primates"
If you just need the ott_id you can parse the JSON using jq:
$ curl -X POST https://api.opentreeoflife.org/v3/taxonomy/taxon_info -H 'content-type:application/json' -d '{"source_id":"ncbi:9443"}' | jq -r ".ott_id"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 350 100 325 100 25 1279 98 --:--:-- --:--:-- --:--:-- 1377
913935
Log in to answer this question.