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

Filter all branches with button instead of using brush

Open Sombiri opened this issue 3 years ago • 1 comments

Hello there,

I just started using phylotree js. However, alongside the tree-selection using 'brush' features. I want to be able to make the same selection using a click-on button to select all branches (i.e on clicking the select all button, I should select all branches with the dotted lines as shown in the pics).
Screenshot 2022-02-25 at 10 34 38 (achieved the selection in the above picture by using the brush feature)

Currently, when I make the selection, it selects the branches with the bold lines using the implementation from html file. Below is the code. Screenshot 2022-02-25 at 10 55 49

$(".select-unselect-mode").on ("change", function (e) { if ($(this).is(':checked')) { if ($(this).data ("mode") == "select") { console.log('i am working') tree.modify_selection (function (d) { return true;}); } else { console.log('i am working 2') tree.modify_selection (function (d) { return false;}); } } });

I will appreciate any help on how to make the selection with the dotted lines using the button instead of the brush features.

Sombiri avatar Feb 25 '22 10:02 Sombiri

Dear @Sombiri,

Sorry for the delay responding.

You want to call something like


//select all
rendered_tree.modifySelection (_.map (rendered_tree.links.filter(rendered_tree.edgeVisible), (e)=>e.target),"tag", true, false, "true");

//unselect all
rendered_tree.modifySelection (_.map (rendered_tree.links.filter(rendered_tree.edgeVisible), (e)=>e.target),"tag", true, false, "false");


Best, Sergei

spond avatar Apr 05 '22 16:04 spond