theosanderson / taxonium

A tool for exploring very large trees in the browser
http://taxonium.org
GNU General Public License v3.0
99 stars 17 forks source link

bug: newlines in Newick break metadata lookup #467

Closed GuilhemSempere closed 1 year ago

GuilhemSempere commented 1 year ago

It must be myself doing something wrong but I can't get my metadata to be taken into account (doesn't appear in the tooltip when mousing over nodes)

Also... I'd like to know if it's possible to use the colorMapping feature on a per-metadata field basis, rather than specifying a color for each and every node.

Thanks if you can help. And for the great work! newick+metadata.zip

theosanderson commented 1 year ago

Thanks for reporting this and providing your data! Your Newick has lots of newlines in it, which mean that Taxonium thinks your nodes are called "my_node\n" instead of "my_node", so it doesn't find any matches in your metadata. I will fix this so that these trees are supported, but in the meantime you can just use find and replace to remove the newlines from your tree file, like _nj.230124221522967.o.nh.txt.

The colorMapping is not for every node. You are simply providing a color for the value, e.g. {"XI-adm":[255,0,0],.....}

theosanderson commented 1 year ago

Should be fixed for the original file too now!

GuilhemSempere commented 1 year ago

Many thanks for your quick response! It's great if such files can be supported out of the box as this is how they are produced by the online mafft service. Is the fix meant to be applied to the live https://taxonium.org/ site already? It doesn't seem so to me

theosanderson commented 1 year ago

Is the fix meant to be applied to the live https://taxonium.org/ site already? It doesn't seem so to me

It is. I've just checked with the files from your ZIP above and I get: image

Please could you try the exact files from the zip and check if they work for you, if not then try clearing your cache. If you still have issues, let me know and if you have issues with other files also let me know.

Thanks

GuilhemSempere commented 1 year ago

You are right I was using the wrong tree. Many thanks again