diff --git a/src/components/tree/phyloTree/layouts.ts b/src/components/tree/phyloTree/layouts.ts index 51f9e18bf..7b87bb3ac 100644 --- a/src/components/tree/phyloTree/layouts.ts +++ b/src/components/tree/phyloTree/layouts.ts @@ -103,7 +103,7 @@ export function streamLayout(this: PhyloTreeType): void { const founderNode = this.nodes[this.streams.streams[streamGroup[0]].founderIdx]; const streamGroupDisplayOrderRange = [_getDisplayOrder(founderNode.n, false), _getDisplayOrder(founderNode.n)] let floor = streamGroupDisplayOrderRange[1]; // range is [smallerNumber, biggerNumber] - const tipMultiplier = (streamGroupDisplayOrderRange[1]-streamGroupDisplayOrderRange[0]) / founderNode.n.tipCount; // includes any and all substreams + const tipMultiplier = (streamGroupDisplayOrderRange[1]-streamGroupDisplayOrderRange[0]) / founderNode.n.fullTipCount; // includes any and all substreams // console.log("STREAM GROUP", streamGroup, "nTips",founderNode.n.tipCount, "streamGroupDisplayOrderRange", streamGroupDisplayOrderRange, tipMultiplier) for (const streamIdx of _orderStreamGroup(streamGroup)) { // start at the bottom of the available range diff --git a/src/util/partitionIntoStreams.js b/src/util/partitionIntoStreams.js index 1559f6f05..fc972c589 100644 --- a/src/util/partitionIntoStreams.js +++ b/src/util/partitionIntoStreams.js @@ -24,6 +24,7 @@ export function partitionIntoStreams(enabled, branchLabel, nodes, visibility, co const stream = {}; stream.founderIdx = founderInfo.idx; // index of the root node (not part of the stream as it's not a tip) stream.founderVisibility = visibility[stream.founderIdx]===NODE_VISIBLE; + stream.branchLabel = founderInfo.branchLabel; stream.originatingNodeIdx = founderInfo.originatingNodeIdx; stream.originatingStreamIdx = foundersPostorder.reduce((ret, v, i) => v.idx===founderInfo.originatingStreamFounderIdx ? i : ret, null) @@ -147,7 +148,6 @@ function groupNodesIntoIntervals(nodes, intervals) { } export function countsByCategory(nodes, nodeIdxsByPivot, visibility, colorBy, categories) { - console.log("countsByCategory") return categories.map((category) => { return nodeIdxsByPivot.map((nodeIdxs) => { return nodeIdxs.filter( @@ -176,7 +176,7 @@ function getFounderTree(treeNodes, branchLabel) { let newNode; if (node?.branch_attrs?.labels?.[branchLabel]) { // add this as a child to the appropriate parent not in streamFounderTree - newNode = {children: [], parent: streamParentNode, arrayIdx:node.arrayIdx, name: node.name} + newNode = {children: [], parent: streamParentNode, arrayIdx:node.arrayIdx, name: node.name, branchLabel: node.branch_attrs.labels[branchLabel]} streamParentNode.children.push(newNode) nodesInStreamFounderTree.push(newNode) } @@ -213,6 +213,7 @@ function getFounderTree(treeNodes, branchLabel) { foundersPostorder.push({ idx: node.arrayIdx, rootName: node.name, + branchLabel: node.branchLabel, originatingNodeIdx: treeNodes[node.arrayIdx].parent.arrayIdx, originatingStreamFounderIdx: Object.hasOwn(node.parent, "arrayIdx") ? node.parent.arrayIdx : null, childStreamFounders: node?.children?.map((c) => c.arrayIdx) || [],