phylotree.js icon indicating copy to clipboard operation
phylotree.js copied to clipboard

Assign Attributes Function in Phylotree.js

Open santule opened this issue 2 years ago • 2 comments

Hello,

I tried using the assignAttributes function but it does not work as there is problem with the node name match in the phylotree.js code.

function assignAttributes(attributes) { //return nodes; // add annotations to each matching node ___namespace.each(this.nodes, function(d) { if (___namespace.indexOf(___namespace.keys(attributes), d.name) >= 0) { d["annotations"] = attributes[d.name]; } }); }

Based on my limited knowledge, if the d.name in the above code is changed to d.data.name as the node structure has name inside the data element it would work. Similarly for the d["annotations"], should now be d.data["annotations"]. I tested this by writing the same code in my script but using the d.data.name instead.

Regards, Sanjana

santule avatar Apr 06 '22 00:04 santule

Dear @santule,

Yes, you are correct. During the development of v.1.0 of phylotree.js not all of the features from the v.0.x version were properly migrated. This seems to be the case here. I am going to implement a fix and push an updated version (there were a few other fixes) in the next day or two.

Thanks!

Best., Sergei

spond avatar Apr 06 '22 12:04 spond

Resolved via https://github.com/veg/phylotree.js/commit/b5d193f2331aa262c69c7a48a821d044d35ffef1

spond avatar Apr 06 '22 14:04 spond