Skip to content

Commit

Permalink
Merge pull request #1577 from nextstrain/bug/date-confidence
Browse files Browse the repository at this point in the history
Reenable tree confidence intervals
  • Loading branch information
jameshadfield authored Oct 21, 2022
2 parents 8a1411d + 4e61fd5 commit 6b31ab7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ const modifyControlsStateViaTree = (state, tree, treeToo, colorings) => {
coloringsToCheck = Object.keys(colorings);
}
let [aaMuts, nucMuts] = [false, false];
let num_date_confidence = false; /* flag. Is confidence defined anywhere on the tree? */
const examineNodes = function examineNodes(nodes) {
nodes.forEach((node) => {
/* check colorBys */
Expand All @@ -380,6 +381,10 @@ const modifyControlsStateViaTree = (state, tree, treeToo, colorings) => {
if (keys.length > 1 || (keys.length === 1 && keys[0]!=="nuc")) aaMuts = true;
if (keys.includes("nuc")) nucMuts = true;
}
/* check num_date confidence */
if (!num_date_confidence && getTraitFromNode(node, "num_date", {confidence: true})) {
num_date_confidence = true;
}
});
};
examineNodes(tree.nodes);
Expand Down Expand Up @@ -419,9 +424,8 @@ const modifyControlsStateViaTree = (state, tree, treeToo, colorings) => {
state.selectedBranchLabel = "clade";
}

state.temporalConfidence = getTraitFromNode(tree.nodes[0], "num_date", {confidence: true}) ?
{exists: true, display: true, on: false} :
{exists: false, display: false, on: false};
state.temporalConfidence = {exists: num_date_confidence, display: num_date_confidence, on: false};

return state;
};

Expand Down

0 comments on commit 6b31ab7

Please sign in to comment.