From e68942be9d1ff015c006f4e71067c911529d3fe6 Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 12:14:33 +0000 Subject: [PATCH 1/6] bugfixes Signed-off-by: stefanbabukov --- src/components/plots/ContinuousEmbeddingPlot.jsx | 3 ++- src/components/plots/MultiViewGrid.jsx | 2 +- src/components/plots/PlotContainer.jsx | 1 + .../plots/styling/AxesWithRangesDesign.jsx | 2 +- .../plots-and-tables/embedding-continuous/index.jsx | 2 +- .../[experimentId]/plots-and-tables/violin/index.jsx | 2 +- src/redux/reducers/componentConfig/initialState.js | 12 ++++++------ src/utils/getDefaultEmbeddingAxesName.js | 5 +++++ .../plotSpecs/generateEmbeddingContinuousSpec.js | 5 +++-- src/utils/ssr/getExperimentInfo.js | 3 ++- 10 files changed, 23 insertions(+), 14 deletions(-) create mode 100644 src/utils/getDefaultEmbeddingAxesName.js diff --git a/src/components/plots/ContinuousEmbeddingPlot.jsx b/src/components/plots/ContinuousEmbeddingPlot.jsx index e0f603b1d9..cf130519e1 100644 --- a/src/components/plots/ContinuousEmbeddingPlot.jsx +++ b/src/components/plots/ContinuousEmbeddingPlot.jsx @@ -103,7 +103,8 @@ const ContinuousEmbeddingPlot = (props) => { || loading || !cellSets.accessible || embeddingLoading - || Object.keys(plotSpec).length === 0) { + || Object.keys(plotSpec).length === 0 + || !plotData?.length) { return (
diff --git a/src/components/plots/MultiViewGrid.jsx b/src/components/plots/MultiViewGrid.jsx index 044c821a88..b4faf6a65d 100644 --- a/src/components/plots/MultiViewGrid.jsx +++ b/src/components/plots/MultiViewGrid.jsx @@ -94,7 +94,7 @@ const MultiViewGrid = (props) => { dispatch(updatePlotConfig(firstPlotUuid, { shownGene: highestDispersionGene, title: { text: highestDispersionGene } })); } - }, [plotConfigs]); + }, [plotConfigs, highestDispersionGene]); useEffect(() => { // initial set up if there are no plots diff --git a/src/components/plots/PlotContainer.jsx b/src/components/plots/PlotContainer.jsx index 8bf41b4cc8..9a02bef299 100644 --- a/src/components/plots/PlotContainer.jsx +++ b/src/components/plots/PlotContainer.jsx @@ -37,6 +37,7 @@ const PlotContainer = (props) => { const [isResetDisabled, setIsResetDisabled] = useState(true); const [tileDirection, setTileDirection] = useState(DEFAULT_ORIENTATION); + console.log('PLOT UUIUID IS ', plotUuid); const { config } = useSelector((state) => state.componentConfig[plotUuid] || {}); const debounceSave = useCallback( _.debounce(() => dispatch(savePlotConfig(experimentId, plotUuid)), saveDebounceTime), [plotUuid], diff --git a/src/components/plots/styling/AxesWithRangesDesign.jsx b/src/components/plots/styling/AxesWithRangesDesign.jsx index 7773ff9d35..cac8b93e2a 100644 --- a/src/components/plots/styling/AxesWithRangesDesign.jsx +++ b/src/components/plots/styling/AxesWithRangesDesign.jsx @@ -12,7 +12,7 @@ const AxesWithRangesDesign = (props) => { const { config, onUpdate, } = props; - + console.log('CONFIG IS ', config); const hideXRange = typeof config.axesRanges.xAxisAuto === 'undefined'; const hideYRange = typeof config.axesRanges.yAxisAuto === 'undefined'; diff --git a/src/pages/experiments/[experimentId]/plots-and-tables/embedding-continuous/index.jsx b/src/pages/experiments/[experimentId]/plots-and-tables/embedding-continuous/index.jsx index 90ef4626b6..0db3245b02 100644 --- a/src/pages/experiments/[experimentId]/plots-and-tables/embedding-continuous/index.jsx +++ b/src/pages/experiments/[experimentId]/plots-and-tables/embedding-continuous/index.jsx @@ -147,7 +147,7 @@ const ContinuousEmbeddingPage = ({ experimentId }) => { extraControlPanels={renderExtraPanels()} defaultActiveKey='view-multiple-plots' onPlotReset={() => dispatch( - updatePlotConfig(multiViewUuid, { nrows: 1, ncols: 1, plotUuids: [] }), + updatePlotConfig(multiViewUuid, { nrows: 1, ncols: 1, plotUuids: [`${plotUuid}-0`] }), )} onUpdate={updateAll ? updateAllWithChanges : updatePlotWithChanges} > diff --git a/src/pages/experiments/[experimentId]/plots-and-tables/violin/index.jsx b/src/pages/experiments/[experimentId]/plots-and-tables/violin/index.jsx index 74385b18b3..b03aa57435 100644 --- a/src/pages/experiments/[experimentId]/plots-and-tables/violin/index.jsx +++ b/src/pages/experiments/[experimentId]/plots-and-tables/violin/index.jsx @@ -58,7 +58,7 @@ const ViolinIndex = ({ experimentId }) => { }, []); const resetMultiView = () => { - updateMultiViewWithChanges({ nrows: 1, ncols: 1, plotUuids: [] }); + updateMultiViewWithChanges({ nrows: 1, ncols: 1, plotUuids: [`${plotUuid}-0`] }); }; const plotStylingConfig = [ diff --git a/src/redux/reducers/componentConfig/initialState.js b/src/redux/reducers/componentConfig/initialState.js index 5020b6ee4a..64ccd22bc0 100644 --- a/src/redux/reducers/componentConfig/initialState.js +++ b/src/redux/reducers/componentConfig/initialState.js @@ -25,8 +25,8 @@ const embeddingCategoricalInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: 'Umap 1', - yAxisText: 'Umap 2', + xAxisText: '', + yAxisText: '', defaultValues: ['x', 'y'], offset: 0, }, @@ -57,8 +57,8 @@ const embeddingContinuousInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: 'Umap 1', - yAxisText: 'Umap 2', + xAxisText: '', + yAxisText: '', defaultValues: ['x', 'y'], offset: 10, }, @@ -297,8 +297,8 @@ const trajectoryAnalysisInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: 'Umap 1', - yAxisText: 'Umap 2', + xAxisText: '', + yAxisText: '', defaultValues: ['x', 'y'], }, axesRanges: axesRangesBaseState, diff --git a/src/utils/getDefaultEmbeddingAxesName.js b/src/utils/getDefaultEmbeddingAxesName.js new file mode 100644 index 0000000000..938c5f90c1 --- /dev/null +++ b/src/utils/getDefaultEmbeddingAxesName.js @@ -0,0 +1,5 @@ +const getDefaultEmbeddingAxesName = (method) => { + +}; + +export default getDefaultEmbeddingAxesName; diff --git a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js index 9944409f80..9c1a5d95c0 100644 --- a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js +++ b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js @@ -3,6 +3,7 @@ import { getAllCells, getSampleCells } from 'utils/cellSets'; const generateSpec = (config, method, plotData) => { + console.log('METHOD IS ', method, typeof (config.axes.xAxisText), 'yes'); const xScaleDomain = config.axesRanges.xAxisAuto ? { data: 'plotData', field: 'x' } : [config.axesRanges.xMin, config.axesRanges.xMax]; @@ -78,7 +79,7 @@ const generateSpec = (config, method, plotData) => { grid: true, domain: true, orient: 'bottom', - title: config.axes.xAxisText ?? `${method} 1`, + title: config.axes.xAxisText || `${method} 1`, titleFont: config.fontStyle.font, labelFont: config.fontStyle.font, labelColor: config.colour.masterColour, @@ -105,7 +106,7 @@ const generateSpec = (config, method, plotData) => { gridWidth: (config.axes.gridWidth / 20), tickColor: config.colour.masterColour, offset: config.axes.offset, - title: config.axes.yAxisText ?? `${method} 2`, + title: config.axes.yAxisText || `${method} 2`, titleFont: config.fontStyle.font, labelFont: config.fontStyle.font, labelColor: config.colour.masterColour, diff --git a/src/utils/ssr/getExperimentInfo.js b/src/utils/ssr/getExperimentInfo.js index 9ed2ac08cc..f9554bf647 100644 --- a/src/utils/ssr/getExperimentInfo.js +++ b/src/utils/ssr/getExperimentInfo.js @@ -45,6 +45,7 @@ const getExperimentInfo = async (context, store, Auth) => { let user; try { user = await Auth.currentAuthenticatedUser(); + console.log('HRELLO!!!!'); } catch (e) { if (e === 'The user is not authenticated') { throw new APIError(httpStatusCodes.UNAUTHORIZED); @@ -55,7 +56,7 @@ const getExperimentInfo = async (context, store, Auth) => { const jwt = user.getSignInUserSession().getIdToken().getJwtToken(); const url = `${req.protocol}://${req.get('host')}${req.originalUrl}`; - + console.log('HELLO AGAIN!!!!!'); const experimentDataV2 = await fetchAPI( `/v2/experiments/${experimentId}`, {}, From a273710db5c068042c51cdfde51d449eb64c59c9 Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 12:43:13 +0000 Subject: [PATCH 2/6] fix Signed-off-by: stefanbabukov --- src/components/plots/PlotContainer.jsx | 2 +- src/components/plots/styling/AxesWithRangesDesign.jsx | 1 - src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js | 4 ++-- src/utils/plotSpecs/generateEmbeddingContinuousSpec.js | 1 - src/utils/ssr/getExperimentInfo.js | 3 +-- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/plots/PlotContainer.jsx b/src/components/plots/PlotContainer.jsx index 9a02bef299..81a722607a 100644 --- a/src/components/plots/PlotContainer.jsx +++ b/src/components/plots/PlotContainer.jsx @@ -37,7 +37,7 @@ const PlotContainer = (props) => { const [isResetDisabled, setIsResetDisabled] = useState(true); const [tileDirection, setTileDirection] = useState(DEFAULT_ORIENTATION); - console.log('PLOT UUIUID IS ', plotUuid); + const { config } = useSelector((state) => state.componentConfig[plotUuid] || {}); const debounceSave = useCallback( _.debounce(() => dispatch(savePlotConfig(experimentId, plotUuid)), saveDebounceTime), [plotUuid], diff --git a/src/components/plots/styling/AxesWithRangesDesign.jsx b/src/components/plots/styling/AxesWithRangesDesign.jsx index cac8b93e2a..319f2a4bde 100644 --- a/src/components/plots/styling/AxesWithRangesDesign.jsx +++ b/src/components/plots/styling/AxesWithRangesDesign.jsx @@ -12,7 +12,6 @@ const AxesWithRangesDesign = (props) => { const { config, onUpdate, } = props; - console.log('CONFIG IS ', config); const hideXRange = typeof config.axesRanges.xAxisAuto === 'undefined'; const hideYRange = typeof config.axesRanges.yAxisAuto === 'undefined'; diff --git a/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js b/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js index e2874ed70f..164acc12b7 100644 --- a/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js +++ b/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js @@ -204,7 +204,7 @@ const generateSpec = (config, method, plotData, cellSetLegendsData) => { grid: true, domain: true, orient: 'bottom', - title: config?.axes.xAxisText ?? `${method} 1`, + title: config?.axes.xAxisText || `${method} 1`, titleFont: config?.fontStyle.font, labelFont: config?.fontStyle.font, labelColor: config?.colour.masterColour, @@ -231,7 +231,7 @@ const generateSpec = (config, method, plotData, cellSetLegendsData) => { gridWidth: (config?.axes.gridWidth / 20), tickColor: config?.colour.masterColour, offset: config?.axes.offset, - title: config?.axes.yAxisText ?? `${method} 2`, + title: config?.axes.yAxisText || `${method} 2`, titleFont: config?.fontStyle.font, labelFont: config?.fontStyle.font, labelColor: config?.colour.masterColour, diff --git a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js index 9c1a5d95c0..93b4f6b5c2 100644 --- a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js +++ b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js @@ -3,7 +3,6 @@ import { getAllCells, getSampleCells } from 'utils/cellSets'; const generateSpec = (config, method, plotData) => { - console.log('METHOD IS ', method, typeof (config.axes.xAxisText), 'yes'); const xScaleDomain = config.axesRanges.xAxisAuto ? { data: 'plotData', field: 'x' } : [config.axesRanges.xMin, config.axesRanges.xMax]; diff --git a/src/utils/ssr/getExperimentInfo.js b/src/utils/ssr/getExperimentInfo.js index f9554bf647..9ed2ac08cc 100644 --- a/src/utils/ssr/getExperimentInfo.js +++ b/src/utils/ssr/getExperimentInfo.js @@ -45,7 +45,6 @@ const getExperimentInfo = async (context, store, Auth) => { let user; try { user = await Auth.currentAuthenticatedUser(); - console.log('HRELLO!!!!'); } catch (e) { if (e === 'The user is not authenticated') { throw new APIError(httpStatusCodes.UNAUTHORIZED); @@ -56,7 +55,7 @@ const getExperimentInfo = async (context, store, Auth) => { const jwt = user.getSignInUserSession().getIdToken().getJwtToken(); const url = `${req.protocol}://${req.get('host')}${req.originalUrl}`; - console.log('HELLO AGAIN!!!!!'); + const experimentDataV2 = await fetchAPI( `/v2/experiments/${experimentId}`, {}, From d2db09712c98944bd83183cd070d9cc3d5bc122e Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 12:44:50 +0000 Subject: [PATCH 3/6] remove unused file Signed-off-by: stefanbabukov --- src/utils/getDefaultEmbeddingAxesName.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 src/utils/getDefaultEmbeddingAxesName.js diff --git a/src/utils/getDefaultEmbeddingAxesName.js b/src/utils/getDefaultEmbeddingAxesName.js deleted file mode 100644 index 938c5f90c1..0000000000 --- a/src/utils/getDefaultEmbeddingAxesName.js +++ /dev/null @@ -1,5 +0,0 @@ -const getDefaultEmbeddingAxesName = (method) => { - -}; - -export default getDefaultEmbeddingAxesName; From d5ab6ad8ff10395a25e22a6ada0d3760e731134c Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 13:00:26 +0000 Subject: [PATCH 4/6] update snapshot Signed-off-by: stefanbabukov --- .../componentConfig/__snapshots__/updateConfig.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap b/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap index 7e51f74018..2137b71df3 100644 --- a/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap +++ b/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap @@ -16,8 +16,8 @@ exports[`updateConfig Checking if empty update doesnt change anything 1`] = ` "offset": 0, "titleFontSize": 13, "xAxisRotateLabels": false, - "xAxisText": "Umap 1", - "yAxisText": "Umap 2", + "xAxisText": "", + "yAxisText": "", }, "axesRanges": { "xAxisAuto": true, From 6451d1e8e0184c9f66d9ae59d8e47612b714feb5 Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 15:51:34 +0000 Subject: [PATCH 5/6] fix axes Signed-off-by: stefanbabukov --- .../reducers/componentConfig/initialState.js | 36 +++++++++---------- .../generateEmbeddingCategoricalSpec.js | 4 +-- .../generateEmbeddingContinuousSpec.js | 4 +-- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/redux/reducers/componentConfig/initialState.js b/src/redux/reducers/componentConfig/initialState.js index 64ccd22bc0..0b6a047079 100644 --- a/src/redux/reducers/componentConfig/initialState.js +++ b/src/redux/reducers/componentConfig/initialState.js @@ -25,8 +25,8 @@ const embeddingCategoricalInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 0, }, @@ -57,8 +57,8 @@ const embeddingContinuousInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -297,8 +297,8 @@ const trajectoryAnalysisInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], }, axesRanges: axesRangesBaseState, @@ -339,8 +339,8 @@ const embeddingPreviewBySampleInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -373,8 +373,8 @@ const embeddingPreviewByCellSetsInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -405,8 +405,8 @@ const embeddingPreviewMitochondrialContentInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -435,8 +435,8 @@ const embeddingPreviewDoubletScoreInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -463,8 +463,8 @@ const embeddingPreviewNumOfGenesInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, @@ -490,8 +490,8 @@ const embeddingPreviewNumOfUmisInitialConfig = { }, axes: { ...axesBaseState, - xAxisText: '', - yAxisText: '', + xAxisText: null, + yAxisText: null, defaultValues: ['x', 'y'], offset: 10, }, diff --git a/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js b/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js index 164acc12b7..e2874ed70f 100644 --- a/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js +++ b/src/utils/plotSpecs/generateEmbeddingCategoricalSpec.js @@ -204,7 +204,7 @@ const generateSpec = (config, method, plotData, cellSetLegendsData) => { grid: true, domain: true, orient: 'bottom', - title: config?.axes.xAxisText || `${method} 1`, + title: config?.axes.xAxisText ?? `${method} 1`, titleFont: config?.fontStyle.font, labelFont: config?.fontStyle.font, labelColor: config?.colour.masterColour, @@ -231,7 +231,7 @@ const generateSpec = (config, method, plotData, cellSetLegendsData) => { gridWidth: (config?.axes.gridWidth / 20), tickColor: config?.colour.masterColour, offset: config?.axes.offset, - title: config?.axes.yAxisText || `${method} 2`, + title: config?.axes.yAxisText ?? `${method} 2`, titleFont: config?.fontStyle.font, labelFont: config?.fontStyle.font, labelColor: config?.colour.masterColour, diff --git a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js index 93b4f6b5c2..9944409f80 100644 --- a/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js +++ b/src/utils/plotSpecs/generateEmbeddingContinuousSpec.js @@ -78,7 +78,7 @@ const generateSpec = (config, method, plotData) => { grid: true, domain: true, orient: 'bottom', - title: config.axes.xAxisText || `${method} 1`, + title: config.axes.xAxisText ?? `${method} 1`, titleFont: config.fontStyle.font, labelFont: config.fontStyle.font, labelColor: config.colour.masterColour, @@ -105,7 +105,7 @@ const generateSpec = (config, method, plotData) => { gridWidth: (config.axes.gridWidth / 20), tickColor: config.colour.masterColour, offset: config.axes.offset, - title: config.axes.yAxisText || `${method} 2`, + title: config.axes.yAxisText ?? `${method} 2`, titleFont: config.fontStyle.font, labelFont: config.fontStyle.font, labelColor: config.colour.masterColour, From 7dd27246dfe58d5529482a42c2d2b461eb65c070 Mon Sep 17 00:00:00 2001 From: stefanbabukov Date: Thu, 4 Jan 2024 15:56:53 +0000 Subject: [PATCH 6/6] update snapshot Signed-off-by: stefanbabukov --- .../componentConfig/__snapshots__/updateConfig.test.js.snap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap b/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap index 2137b71df3..388284d07d 100644 --- a/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap +++ b/src/__test__/redux/reducers/componentConfig/__snapshots__/updateConfig.test.js.snap @@ -16,8 +16,8 @@ exports[`updateConfig Checking if empty update doesnt change anything 1`] = ` "offset": 0, "titleFontSize": 13, "xAxisRotateLabels": false, - "xAxisText": "", - "yAxisText": "", + "xAxisText": null, + "yAxisText": null, }, "axesRanges": { "xAxisAuto": true,