Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tip_label settable through json default #1703

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/server/convertJsonSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ const setVaccineChoicesOnNodes = (v2, v1meta) => {
*/
const setLabels = (v2) => {
traverseTree(v2.tree, (node) => {
/* are their aa mutations? */
/* are there aa mutations? */
if (node.branch_attrs && node.branch_attrs.mutations) {
const mutations = node.branch_attrs.mutations;
const aaMutsToLabel = Object.keys(mutations)
Expand Down
8 changes: 4 additions & 4 deletions src/actions/recomputeReduxState.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ const restoreQueryableStateToDefaults = (state) => {

state["panelLayout"] = calcBrowserDimensionsInitialState().width > twoColumnBreakpoint ? "grid" : "full";
state.panelsToDisplay = state.panelsAvailable.slice();
state.tipLabelKey = strainSymbol;
state.scatterVariables = {};

state.showAllBranchLabels = false;
Expand Down Expand Up @@ -238,8 +237,8 @@ const modifyStateViaMetadata = (state, metadata, genomeMap) => {
state.filters[strainSymbol] = [];
state.filters[genotypeSymbol] = []; // this doesn't necessitate that mutations are defined
if (metadata.displayDefaults) {
const keysToCheckFor = ["geoResolution", "colorBy", "distanceMeasure", "layout", "mapTriplicate", "selectedBranchLabel", 'sidebar', "showTransmissionLines", "normalizeFrequencies"];
const expectedTypes = ["string", "string", "string", "string", "boolean", "string", 'string', "boolean" , "boolean"];
const keysToCheckFor = ["geoResolution", "colorBy", "distanceMeasure", "layout", "mapTriplicate", "selectedBranchLabel", 'sidebar', "showTransmissionLines", "normalizeFrequencies", "tipLabelKey"];
const expectedTypes = ["string", "string", "string", "string", "boolean", "string", 'string', "boolean" , "boolean" , "string" ];

for (let i = 0; i < keysToCheckFor.length; i += 1) {
if (Object.hasOwnProperty.call(metadata.displayDefaults, keysToCheckFor[i])) {
Expand Down Expand Up @@ -305,7 +304,7 @@ const modifyStateViaMetadata = (state, metadata, genomeMap) => {
state.panelsAvailable = state.panelsAvailable.filter((item) => item !== "entropy");
state.panelsToDisplay = state.panelsToDisplay.filter((item) => item !== "entropy");
if (Object.keys(metadata.colorings).includes('gt')) {
console.error("Genotype coloring ('gt') was specified as an option in the JSON, however the data does not support this: " +
console.error("Genotype coloring ('gt') was specified as an option in the JSON, however the data does not support this: " +
"check that 'metadata.genome_annotations' is correct and that mutations have been assigned to 'branch_attrs' on the tree.")
delete metadata.colorings.gt;
}
Expand Down Expand Up @@ -745,6 +744,7 @@ const createMetadataStateFromJSON = (json) => {
geo_resolution: "geoResolution",
distance_measure: "distanceMeasure",
branch_label: "selectedBranchLabel",
tip_label: "tipLabelKey",
map_triplicate: "mapTriplicate",
layout: "layout",
language: "language",
Expand Down