Skip to content

Draft API docs

Emily Jane McTavish edited this page Sep 29, 2022 · 1 revision

This page is part of the Open Tree of Life Web APIs.

URL Verb Summary
/dates/node_dates/{SYNTH_NODE_ID} GET Returns a dictionary with dates for that node for each dated study that aligns with that node in the synth tree
/dates/dated_node_dump GET Returns a dictionary with metadata and node ages for every node in the syth tree for which there are dates

node_dates

If no dated trees in phylesystem have a node that aligns with that synth node (which is true for most nodes in the tree) it will return a dictionary {'ot:source_node_ages':[]}

Input parameters

Parameters with bold type definitions are required.

  • node : (string) A synth node id

Output parameters a dictionary with the keys

  • query : queried node
  • synth_node_id : node returned from synth tree
  • ot:source_node_ages: [list of dictionaries, with keys as below]
  • age: (float)
  • source_id : (string) study_id@tree_id
  • source_node : (string) index of matched node in source tree
  • time_unit : (string) time unit

Example command:

$ curl -X GET https://dates.opentreeoflife.org/v4/dates/synth_node_age/mrcaott1000311ott3643727 -H "content-type:application/json"

Example result:

{"query": "mrcaott1000311ott3643727", "synth_node_id": "mrcaott1000311ott3643727", "ot:source_node_ages": [{"age": 9.325001, "source_id": "ot_1592@tree1", "source_node": "node22956"}]}

dated_tree

curl -X POST https://dates.opentreeoflife.org/v4/dates/dated_tree -d '{"node_ids":["ott38587", "ott906290"], "max_age":"180"}'

Example result:

{
  "dated_trees_newick_list": [
    "((((((((((((((((((((((((((((((((((((((((((((((((ott906290:4.357510)mrcaott331716ott906290:4.357510)mrcaott65695ott331716:4.357511)mrcaott65695ott3620290:4.357510)mrcaott65695ott105710:2.489389)ott413976:4.741665)mrcaott65695ott285023:4.741665)mrcaott65695ott914514:4.741665)mrcaott65695ott121259:4.741665)mrcaott65695ott254163:4.741665)mrcaott44382ott65695:4.741665)mrcaott22583ott44382:4.741665)mrcaott22583ott100573:4.741665)mrcaott1321ott22583:8.354588)mrcaott177ott1321:8.354584)mrcaott177ott29310:8.354585)mrcaott177ott2199:51.202896)mrcaott177ott7464:7.818665)mrcaott114ott177:7.818665)mrcaott114ott309463:10.100006)ott535804:0.719406)mrcaott114ott18818:0.719391)mrcaott114ott37876:0.719406)mrcaott114ott3129:0.719406)ott991547:0.719406)ott471197:0.719406)ott544595:0.719391)ott229562:0.719406)ott4940726:0.719406)ott458402:0.719391)ott114654:0.719406)ott114656:0.719406)ott278114:0.719406)ott801601:0.719406)ott947318:0.719391)mrcaott42ott658:0.719406)ott125642:0.719406)ott147604:0.719391)mrcaott42ott49:0.719406)ott117569:0.719406)mrcaott42ott150:0.719406)mrcaott42ott570365:0.719406)mrcaott42ott3989:0.719391)ott691846:0.719406)mrcaott42ott34294:0.719406)ott5246131:0.719391)ott332573:0.719406)ott304358:0.719402,((((((((((((((((((((((ott38587:7.826087)ott668486:7.826087)mrcaott30142ott143480:7.826086)ott799500:7.826088)ott800609:7.826088)mrcaott7311ott72798:7.826084)mrcaott721ott7311:7.826088)mrcaott89ott721:7.826088)mrcaott89ott143:7.826088)mrcaott89ott1966:7.826088)mrcaott89ott277:7.826088)mrcaott89ott79418:7.826080)mrcaott89ott90:7.826088)mrcaott89ott19781:7.826088)mrcaott50ott89:7.826088)mrcaott50ott51461:7.826088)mrcaott50ott6117:7.826080)mrcaott50ott107113:7.826096)mrcaott50ott1100:7.826080)mrcaott50ott73:7.826096)mrcaott50ott184:7.826080)mrcaott50ott3311:7.826096)ott844192:7.826087)ott93302:1.000000;"
  ],
  "topology_sources": [
    "pg_2757@tree6369",
    "pg_2822@tree6569",
    "ot_508@tree2",
    "pg_423@tree2857",
    "ot_1732@tree1",
    "ot_1164@tree3",
    "pg_2710@tree6291",
    "pg_1217@tree2455",
    "pg_2448@tree5223",
    "pg_2542@tree5590",
    "ot_1164@tree2"
  ],
  "date_sources": [
    "ot_508@tree5",
    "ot_508@tree3",
    "ot_508@tree9",
    "ot_2049@tree1",
    "ot_2025@tree1",
    "ot_508@tree6",
    "ot_508@tree8",
    "pg_2822@tree6569",
    "ot_508@tree2",
    "ot_508@tree4",
    "ot_409@tree2",
    "ot_508@tree7"
  ]
}
curl -X POST https://dates.opentreeoflife.org/v4/dates/dated_tree -d '{"node_id":"mrcaott57890ott65740"}'
{
  "dated_trees_newick_list": [
    "(((((ott57890:18.475565,ott630758:18.475565)mrcaott57890ott630758:2.643929,((ott143789:15.983004,((ott358140:9.732888,ott624720:9.732888)mrcaott358140ott624720:1.704182,(ott662026:8.162501,ott5924428:8.162501)mrcaott662026ott5924428:3.274569)mrcaott358140ott662026:4.545934)mrcaott143789ott358140:2.501148,ott211408:18.484152)mrcaott143789ott211408:2.635342)mrcaott57890ott143789:5.663099,((ott143751:9.965997,ott143784:9.965997)mrcaott143751ott143784:3.916127,((ott143764:9.409473,ott417203:9.409473)mrcaott143764ott417203:2.742354,ott143775:12.151828)mrcaott143764ott143775:1.730296)mrcaott143751ott143764:12.900469)mrcaott57890ott143751:2.845320,((ott630754:0.464390,ott768842:0.464390)mrcaott630754ott768842:18.994898,(ott1000311:9.325001,ott3643727:9.325001)mrcaott1000311ott3643727:10.134287)mrcaott630754ott1000311:10.168625)mrcaott57890ott630754:9.142481,((ott65740:13.922840,ott6140072:13.922840,ott7061026:13.922840)ott65739:13.922840,(ott398376:13.922840)ott200397:13.922840)mrcaott65740ott398376:10.924713)mrcaott57890ott65740:1.000000;"
  ],
  "topology_sources": [
    "ot_1592@tree1"
  ],
  "date_sources": [
    "ot_409@tree2",
    "ot_1592@tree1"
  ]
}

dates_dump

Example command:

curl -X GET https://dates.opentreeoflife.org/v4/dates/dated_nodes_dump

Example result:

{
  "metadata": {
    "synth_tree_about": {
      "date_created": "2021-06-18 11:13:49",
      "filtered_flags": [
        "barren",
        "environmental",
        "hidden",
        "hybrid",
        "inconsistent",
        "major_rank_conflict",
        "major_rank_conflict_inherited",
        "merged",
        "not_otu",
        "viral",
        "was_container"
      ],
      "num_source_studies": 1184,
      "num_source_trees": 1239,
      "root": {
        "node_id": "ott93302",
        "num_tips": 2392042,
        "taxon": {
          "name": "cellular organisms",
          "ott_id": 93302,
          "rank": "no rank",
          "tax_sources": [
            "ncbi:131567"
          ],
          "unique_name": "cellular organisms"
        }
      },
      "synth_id": "opentree13.4",
      "taxonomy_version": "3.3draft1"
    },
    "date": "2022-03-24",
    "phylesystem_sha": "22432cd981a395de804a3018fb8155b2b2474eb0"
  },
  "node_ages": {
    "mrcaott111030ott227303": [
      {
        "source_id": "pg_1969@tree4022",
        "age": 10.218035049772752,
        "source_node": "node750313"
      },
      {
        "source_id": "ot_2025@tree1",
        "age": 10.218035,
        "source_node": "node168"
      },
      {
        "source_id": "ot_409@tree2",
        "age": 12.163626,
        "source_node": "node56139"
      },
      {
        "source_id": "ot_254@Tr87680",
        "age": 17.272713,
        "source_node": "Tn12950583"
      },
      {
        "source_id": "pg_1952@tree3976",
        "age": 8.778131484661097,
        "source_node": "node743949"
      }
    ],
...
Clone this wiki locally