From 755a86b16806ea88abc9f13d6ff4c59f27d2111a Mon Sep 17 00:00:00 2001 From: Jean Chang Date: Mon, 12 Aug 2024 17:14:11 -0400 Subject: [PATCH 1/8] add visual cue that .obsm key name is required --- .../components/upload/ClusteringFileForm.jsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/javascript/components/upload/ClusteringFileForm.jsx b/app/javascript/components/upload/ClusteringFileForm.jsx index 8da795f2af..7011d4c389 100644 --- a/app/javascript/components/upload/ClusteringFileForm.jsx +++ b/app/javascript/components/upload/ClusteringFileForm.jsx @@ -20,7 +20,7 @@ export default function ClusteringFileForm({ updateFile, saveFile, deleteFile, - associatedClusterFileOptions=[], + associatedClusterFileOptions = [], updateCorrespondingClusters, bucketName, isInitiallyExpanded, @@ -30,7 +30,7 @@ export default function ClusteringFileForm({ .map(id => associatedClusterFileOptions.find(opt => opt.value === id)) if (isAnnDataExperience) { - requiredFields.push({ label: '.obsm key name', propertyName: 'obsm_key_name'}) + requiredFields.push({ label: '.obsm key name', propertyName: 'obsm_key_name' }) } const validationMessages = validateFile({ file, allFiles, allowedFileExts, requiredFields, isAnnDataExperience @@ -47,7 +47,7 @@ export default function ClusteringFileForm({ trigger={['hover', 'focus']} rootClose placement="top" overlay={obsmKeyNameHelpContent()}> - .obsm key name + .obsm key name * @@ -70,15 +70,15 @@ export default function ClusteringFileForm({ if (isAnnDataExperience) { return
- +
-
} else { - return + return } } @@ -87,7 +87,7 @@ export default function ClusteringFileForm({ allowedFileExts, deleteFile, validationMessages, bucketName, isInitiallyExpanded, isAnnDataExperience, isLastClustering }}> {nameFields(isAnnDataExperience)} - { (file.is_spatial && !isAnnDataExperience) && + {(file.is_spatial && !isAnnDataExperience) &&
} + fieldName="description" file={file} updateFile={updateFile}/>
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
From 0662005b7aebfc3752f10679f2f79fc5e8ccca1f Mon Sep 17 00:00:00 2001 From: Eric Weitz Date: Thu, 15 Aug 2024 11:07:08 -0400 Subject: [PATCH 8/8] Prevent erroring gene expression scatter plot on legend filter; test --- app/javascript/lib/plot.js | 1 + test/js/explore/plot-utils.test.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/javascript/lib/plot.js b/app/javascript/lib/plot.js index 7c6331ed29..48717b1a33 100644 --- a/app/javascript/lib/plot.js +++ b/app/javascript/lib/plot.js @@ -25,6 +25,7 @@ const SPECIAL_LEGEND_ENTRIES = [UNSPECIFIED_ANNOTATION_NAME, FILTERED_TRACE_NAME * central memory CD4-positive, alpha-beta T cell */ export function safenLabels(labels) { + if (!labels) {return labels} // Prevents erroring gene exp scatter on legend filter if (Array.isArray(labels)) { return labels.map(label => label.replaceAll(',', '-')) } else { diff --git a/test/js/explore/plot-utils.test.js b/test/js/explore/plot-utils.test.js index 8ba7ad0e55..1d9b23a512 100644 --- a/test/js/explore/plot-utils.test.js +++ b/test/js/explore/plot-utils.test.js @@ -1,4 +1,4 @@ -import PlotUtils from 'lib/plot' +import PlotUtils, { safenLabels } from 'lib/plot' describe('Plot grouping function cache', () => { it('makes traces based on the annotation groups', async () => { @@ -165,4 +165,10 @@ describe('Plot grouping function cache', () => { ...data }) }) + + it('does not error when raw labels are undefined', async () => { + // This prevents erroring gene expression scatter plots up applying a legend filter + const safeLabels = safenLabels(undefined) + expect(safeLabels).toBeUndefined() + }) })