OpenTreeOfLife / feedback

No code -- just an issue tracker for general feedback (sent here via GitHub's issues API)
1 stars 0 forks source link

Newick tree downloaded via API does not open in any tree viewing software #579

Closed open-tree-tree-explorer[bot] closed 1 month ago

open-tree-tree-explorer[bot] commented 4 months ago

First: We published our paper where we use and cite the OTOL (https://doi.org/10.1007/s10456-023-09874-9) a few months back. So thank you for this tool. We are at it again and now I am trying to download an induced tree for visualization, but the newick format does not open in any tree visualization software that I have tried so far (figtree, TreeViewX). This happens with both larger (20) and smaller (5) taxons in the POSt data. The command is:

curl -X POST https://api.opentreeoflife.org/v3/tree_of_life/induced_subtree -H "content-type:application/json" -d '{"ott_ids":[770315, 542509, 505714, 395048, 316451, 153563, 940184, 1005914, 550662, 773491, 3644159, 395686, 801608, 1096512, 13567, 1083289, 110468, 5132284, 812825]}' > tree.newick

Please let me know of any software that I can run on Linux (Mac would also work) that opens these newick files... I will try to find a work-around by myself, but it would be nice if this worked out of the box!

================================================ Metadata Do not edit below this line
Author Michael
Upvotes 0
URL /contact
Target node label
Synthetic tree id
Synthetic tree node id
Source tree id(s)
Open Tree Taxonomy id
Supporting reference None
mtholder commented 4 months ago

Hi, thanks for the report. I'll look into adding a "simplified" newick option to the web-service call. I think the problems usually arise from 2 aspects of our tree that are not common:

  1. we have labels that contain open- and closed- parentheses. We quote them properly, but not all software is happy with them. Originally we had some of these because of tip names that we imported in out taxonomy from other sources. Now some are being added my our homonym-disambiguation steps in production of the taxonomy.
  2. we emit nodes with out-degree = 1. Many tree reading tools don't like that.

I did check that newick string from your call, and I think it is valid. There are other contexts in which suppress the difficult name and "monotypic" nodes. I'll see how easy it would be to add those features to the web-service call. I'll leave this issue open until I have time to check and report back.

bredelings commented 4 months ago

I was able to open the tree in treeviewx. Running tv tree.newick didn't work, but running tv and then selecting the file from the menu did work.

Note that the curl command doesn't return newick format. Instead, it retrieves a JSON file with the newick string embedded in it. One way to extract the newick using the command line is to install the tool jq and run:

curl -X POST https://api.opentreeoflife.org/v3/tree_of_life/induced_subtree -H "content-type:application/json" -d '{"ott_ids":[770315, 542509, 505714, 395048, 316451, 153563, 940184, 1005914, 550662, 773491, 3644159, 395686, 801608, 1096512, 13567, 1083289, 110468, 5132284, 812825]}' | jq -r .newick > tree.newick

It looks like figtree hangs if the number of degree-1 nodes is too high. Perhaps the drawing time is exponential in the number of degree-1 nodes.