From 25086cb56c4c6446a5a48551808e5cebf043226e Mon Sep 17 00:00:00 2001 From: Albert Tian Chen Date: Thu, 26 Aug 2021 16:00:25 -0400 Subject: [PATCH] Fix v2.2.3 (#396) * point to correct data file in GCS * Change order of PDB ID input and protein selector * Clear PDB ID on protein change, or set to a default PDB ID if available * Add link to RCSB COVID-19 resource page * more lenient default settings for the surveillance plot * Set default sort mode to descending counts, and disable sorting inputs * Hide surveillance settings under an accordion * Fix clicking on map to select country in global seq plot * bump version --- package-lock.json | 2 +- package.json | 2 +- .../GroupReport/GroupStructuralViewer.js | 38 ++- src/components/Pages/GroupReportTab.js | 6 + src/components/Vega/SurveillancePlot.js | 254 ++++++++++-------- .../Vega/SurveillancePlot.styles.js | 34 +++ src/stores/plotSettingsStore.js | 8 +- src/utils/version.js | 2 +- src/vega_specs/global_seq_v2.vg.json | 2 +- src/vega_specs/group_tree_v2.vg.json | 2 +- static_data/default_structures.json | 3 + 11 files changed, 216 insertions(+), 137 deletions(-) create mode 100644 static_data/default_structures.json diff --git a/package-lock.json b/package-lock.json index 5ff415fa3..30b2934f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "covidcg", - "version": "2.2.2", + "version": "2.2.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e973deae7..37d09bf41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "covidcg", - "version": "2.2.2", + "version": "2.2.3", "description": "", "engines": { "node": ">=8", diff --git a/src/components/GroupReport/GroupStructuralViewer.js b/src/components/GroupReport/GroupStructuralViewer.js index 6b648ad79..e37e7c3aa 100644 --- a/src/components/GroupReport/GroupStructuralViewer.js +++ b/src/components/GroupReport/GroupStructuralViewer.js @@ -8,6 +8,7 @@ import { colorHeatmap, getMoleculeAssemblies } from '../LiteMol/litemolutils'; import { reds } from '../../constants/colors'; import { hexToRgb } from '../../utils/color'; import { getAllProteins } from '../../utils/gene_protein'; +import defaultStructures from '../../../static_data/default_structures.json'; import EmptyPlot from '../Common/EmptyPlot'; import DownloadPymolScriptModal from '../Modals/DownloadPymolScriptModal'; @@ -64,11 +65,24 @@ const StructuralViewer = observer(() => { }; const onChangeReportStructureActiveProtein = (event) => { const newProtein = event.target.value; + + if (newProtein === state.activeProtein) { + return; + } + setState({ ...state, activeProtein: newProtein, activeProteinChanged: newProtein != plotSettingsStore.reportStructureActiveProtein, + // Clear PDB ID when protein changes + pdbId: Object.keys(defaultStructures).includes(newProtein) + ? defaultStructures[newProtein] + : '', + validPdbId: Object.keys(defaultStructures).includes(newProtein) + ? true + : false, + pdbIdChanged: true, }); }; const onChangePdbId = (event) => { @@ -300,17 +314,6 @@ const StructuralViewer = observer(() => { Download Data - - - + + +
Download PyMOL Script diff --git a/src/components/Pages/GroupReportTab.js b/src/components/Pages/GroupReportTab.js index 8df894677..7e99548db 100644 --- a/src/components/Pages/GroupReportTab.js +++ b/src/components/Pages/GroupReportTab.js @@ -100,6 +100,12 @@ const GroupReportTab = observer(() => { compatibility, so it is possible to, for example, erroneously map nsp12 SNVs onto a Spike structure. +
  • + More structures available at the{' '} + + RCSB COVID-19 resource page + +
  • } > diff --git a/src/components/Vega/SurveillancePlot.js b/src/components/Vega/SurveillancePlot.js index e3b7d7031..ebf3282ae 100644 --- a/src/components/Vega/SurveillancePlot.js +++ b/src/components/Vega/SurveillancePlot.js @@ -36,6 +36,7 @@ import { LegendItemContainer, LegendItemName, LegendItemCounts, + CollapseButton, } from './SurveillancePlot.styles'; const maxCharsPerLine = 10; @@ -198,8 +199,16 @@ const SurveillancePlot = observer(({ width }) => { }, signalListeners: {}, legendItems: [], + showSettings: false, }); + const onToggleShowSettings = () => { + setState({ + ...state, + showSettings: !state.showSettings, + }); + }; + const onDismissWarning = () => { setState({ ...state, @@ -349,127 +358,140 @@ const SurveillancePlot = observer(({ width }) => { {' '} - Sort by{' '} - - - - - - - - - Displayed {groupName} - To improve readability, ${groupName} which do not meet these conditions in any of the six continents are removed from the plots. For example, if one ${groupName} fails these conditions in 5 continents but passes in the last one, it will still be shown. If one ${groupName} fails these conditions in all 6 continents, it will be excluded.

    Min Counts is defined as the minimum number of sequences with this ${groupName} in a given continent on a given week

    Min Percent is defined as the minimum percent of sequences with this ${groupName} in a given continent on a given week

    `} - data-html="true" - data-place="right" - data-for="main-tooltip" - style={{ marginRight: 8 }} + + {state.showSettings ? 'Hide' : 'Show'} Settings{' '} + + +
    + - - - - - -
    - - Highlighted {groupName} - Choose ${groupName} to highlight and display in the legend. ${groupName} which pass these conditions in at least one of six continents will be highlighted. Non-highlighted ${groupName} are still displayed but not colored.

    Min Counts is defined as the minimum number of sequences with this ${groupName} in a given continent on a given week

    Min Percent is defined as the minimum percent of sequences with this ${groupName} in a given continent on a given week

    Min Correlation is defined as the minimum Pearson correlation of the % sequences of this ${groupName}. For the correlation calculations, the last ${config.surv_end_date_days_ago} days from today are omitted, to reduce noise in this metric.

    `} - data-html="true" - data-place="right" - data-for="main-tooltip" - style={{ marginRight: 8 }} - /> - - - - - - - - + + + +
    + + Highlighted {groupName} + Choose ${groupName} to highlight and display in the legend. ${groupName} which pass these conditions in at least one of six continents will be highlighted. Non-highlighted ${groupName} are still displayed but not colored.

    Min Counts is defined as the minimum number of sequences with this ${groupName} in a given continent on a given week

    Min Percent is defined as the minimum percent of sequences with this ${groupName} in a given continent on a given week

    Min Correlation is defined as the minimum Pearson correlation of the % sequences of this ${groupName}. For the correlation calculations, the last ${config.surv_end_date_days_ago} days from today are omitted, to reduce noise in this metric.

    `} + data-html="true" + data-place="right" + data-for="main-tooltip" + style={{ marginRight: 8 }} /> - - -
    + + + + + + + + + + + + )} - -
    -