From 1925bd073d63754bcdf47f9a54dc4f183d2ccff8 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Thu, 16 Nov 2023 15:24:53 -0300 Subject: [PATCH 01/10] Rename test file to fit the files name that it is testing Signed-off-by: cosa65 --- ...PipelineLoadingScreen.test.jsx => Gem2SLoadingScreen.test.jsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/__test__/components/{PipelineLoadingScreen.test.jsx => Gem2SLoadingScreen.test.jsx} (100%) diff --git a/src/__test__/components/PipelineLoadingScreen.test.jsx b/src/__test__/components/Gem2SLoadingScreen.test.jsx similarity index 100% rename from src/__test__/components/PipelineLoadingScreen.test.jsx rename to src/__test__/components/Gem2SLoadingScreen.test.jsx From 64663dd2cab061e26de9f64d54faa49ded8f9e5d Mon Sep 17 00:00:00 2001 From: cosa65 Date: Thu, 16 Nov 2023 15:25:14 -0300 Subject: [PATCH 02/10] Remove unused Signed-off-by: cosa65 --- src/__test__/components/Gem2SLoadingScreen.test.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/__test__/components/Gem2SLoadingScreen.test.jsx b/src/__test__/components/Gem2SLoadingScreen.test.jsx index fa34bd7218..f0fc49f2bb 100644 --- a/src/__test__/components/Gem2SLoadingScreen.test.jsx +++ b/src/__test__/components/Gem2SLoadingScreen.test.jsx @@ -10,7 +10,7 @@ import fetchAPI from 'utils/http/fetchAPI'; import GEM2SLoadingScreen from 'components/GEM2SLoadingScreen'; import '__test__/test-utils/setupTests'; -const { Title, Text } = Typography; +const { Title } = Typography; const mockStore = configureMockStore([thunk]); From df6aa57e6559abec67c06a4bfa48b6cfc3e2f55b Mon Sep 17 00:00:00 2001 From: cosa65 Date: Thu, 16 Nov 2023 15:31:42 -0300 Subject: [PATCH 03/10] Remove empty file validateSeurat Signed-off-by: cosa65 --- src/__test__/utils/upload/processSeuratUpload.test.js | 2 -- src/utils/upload/sampleValidators.js | 3 +-- src/utils/upload/validateSeurat.js | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) delete mode 100644 src/utils/upload/validateSeurat.js diff --git a/src/__test__/utils/upload/processSeuratUpload.test.js b/src/__test__/utils/upload/processSeuratUpload.test.js index a04942b9d8..26874d80d6 100644 --- a/src/__test__/utils/upload/processSeuratUpload.test.js +++ b/src/__test__/utils/upload/processSeuratUpload.test.js @@ -14,7 +14,6 @@ import UploadStatus from 'utils/upload/UploadStatus'; import processUpload from 'utils/upload/processUpload'; -import validate from 'utils/upload/validateSeurat'; import pushNotificationMessage from 'utils/pushNotificationMessage'; import mockFile from '__test__/test-utils/mockFile'; @@ -76,7 +75,6 @@ jest.mock('axios', () => ({ })); jest.mock('utils/pushNotificationMessage'); -jest.mock('utils/upload/validateSeurat'); let store = null; diff --git a/src/utils/upload/sampleValidators.js b/src/utils/upload/sampleValidators.js index 6e0ef92521..58aedb8474 100644 --- a/src/utils/upload/sampleValidators.js +++ b/src/utils/upload/sampleValidators.js @@ -2,13 +2,12 @@ import { sampleTech } from 'utils/constants'; import validate10x from 'utils/upload/validate10x'; import validateRhapsody from 'utils/upload/validateRhapsody'; -import validateSeurat from 'utils/upload/validateSeurat'; import validateH5 from 'utils/upload/validateH5'; const sampleValidators = { [sampleTech['10X']]: validate10x, [sampleTech.RHAPSODY]: validateRhapsody, - [sampleTech.SEURAT]: validateSeurat, + [sampleTech.SEURAT]: () => { }, [sampleTech.H5]: validateH5, }; diff --git a/src/utils/upload/validateSeurat.js b/src/utils/upload/validateSeurat.js deleted file mode 100644 index 0d7b8c4ee4..0000000000 --- a/src/utils/upload/validateSeurat.js +++ /dev/null @@ -1,3 +0,0 @@ -const validateSeurat = async () => {}; - -export default validateSeurat; From 7cb59e8fa4e0ee250f4931e605ce81e697043ff6 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 17 Nov 2023 09:09:53 -0300 Subject: [PATCH 04/10] Add null option to track whether any cell set is selected or not Signed-off-by: cosa65 --- .../data-exploration/cell-sets-tool/CellSetsTool.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx b/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx index 1f9f0ac681..6be18e291b 100644 --- a/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx +++ b/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx @@ -72,7 +72,7 @@ const CellSetsTool = (props) => { setTreeData(composeTree(hierarchy, properties)); }, [hierarchy, properties]); - const [numSelectedCellSetKeys, setNumSelectedCellSetKeys] = useState(0); + const [numSelectedCellSetKeys, setNumSelectedCellSetKeys] = useState(null); useEffect(() => { const louvainClusters = hierarchy.find(({ key }) => key === 'louvain')?.children; @@ -89,6 +89,11 @@ const CellSetsTool = (props) => { }, [hierarchy]); useEffect(() => { + if (selectedCellSetKeys.length === 0) { + setNumSelectedCellSetKeys(null); + return; + } + const selectedCells = union(selectedCellSetKeys, properties); const numSelectedFiltered = new Set([...selectedCells] @@ -124,7 +129,7 @@ const CellSetsTool = (props) => { const renderContent = () => { let operations = null; - if (numSelectedCellSetKeys > 0) { + if (numSelectedCellSetKeys !== null) { operations = ( Date: Fri, 17 Nov 2023 10:25:06 -0300 Subject: [PATCH 05/10] Remove unnecessary test Signed-off-by: cosa65 --- .../utils/upload/processSeuratUpload.test.js | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/__test__/utils/upload/processSeuratUpload.test.js b/src/__test__/utils/upload/processSeuratUpload.test.js index 26874d80d6..5d4e3b0057 100644 --- a/src/__test__/utils/upload/processSeuratUpload.test.js +++ b/src/__test__/utils/upload/processSeuratUpload.test.js @@ -231,34 +231,4 @@ describe('processUpload', () => { expect(axios.request).not.toHaveBeenCalled(); }); }); - - it('Should not validate .rds files', async () => { - const mockAxiosCalls = []; - const uploadSuccess = (params) => { - mockAxiosCalls.push(params); - return Promise.resolve({ headers: { etag: 'etag-blah' } }); - }; - - axios.request.mockImplementation(uploadSuccess); - - validate.mockImplementationOnce( - () => (['Some file error']), - ); - - await processUpload( - getValidFiles(), - sampleType, - store.getState().samples, - mockExperimentId, - store.dispatch, - ); - - // We expect uploads to happen - await waitFor(() => { - expect(); - expect(pushNotificationMessage).toHaveBeenCalledTimes(0); - expect(axios.request).toHaveBeenCalledTimes(2); - expect(validate).toHaveBeenCalledTimes(1); - }); - }); }); From 67bde7fe58fcefd2da2bc2733e6994d561c20a39 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 17 Nov 2023 10:30:08 -0300 Subject: [PATCH 06/10] Rollback seurat valdiator changes Signed-off-by: cosa65 --- src/utils/upload/sampleValidators.js | 3 ++- src/utils/upload/validateSeurat | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/utils/upload/validateSeurat diff --git a/src/utils/upload/sampleValidators.js b/src/utils/upload/sampleValidators.js index 58aedb8474..6e0ef92521 100644 --- a/src/utils/upload/sampleValidators.js +++ b/src/utils/upload/sampleValidators.js @@ -2,12 +2,13 @@ import { sampleTech } from 'utils/constants'; import validate10x from 'utils/upload/validate10x'; import validateRhapsody from 'utils/upload/validateRhapsody'; +import validateSeurat from 'utils/upload/validateSeurat'; import validateH5 from 'utils/upload/validateH5'; const sampleValidators = { [sampleTech['10X']]: validate10x, [sampleTech.RHAPSODY]: validateRhapsody, - [sampleTech.SEURAT]: () => { }, + [sampleTech.SEURAT]: validateSeurat, [sampleTech.H5]: validateH5, }; diff --git a/src/utils/upload/validateSeurat b/src/utils/upload/validateSeurat new file mode 100644 index 0000000000..44d1d4ec5d --- /dev/null +++ b/src/utils/upload/validateSeurat @@ -0,0 +1,5 @@ +const validateSeurat = () => { + // Currently there is no content checking for H5 files +}; + +export default validateSeurat; From 4dd462225aaddc6c665c622819c182b48a08aa92 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 17 Nov 2023 10:58:56 -0300 Subject: [PATCH 07/10] Add async Signed-off-by: cosa65 --- src/utils/upload/validateSeurat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/upload/validateSeurat b/src/utils/upload/validateSeurat index 44d1d4ec5d..2f83d34999 100644 --- a/src/utils/upload/validateSeurat +++ b/src/utils/upload/validateSeurat @@ -1,4 +1,4 @@ -const validateSeurat = () => { +const validateSeurat = async () => { // Currently there is no content checking for H5 files }; From 4ebf405add2157c7fe2e7e1d921dab36a2b4a2ce Mon Sep 17 00:00:00 2001 From: cosa65 Date: Fri, 17 Nov 2023 11:46:53 -0300 Subject: [PATCH 08/10] Fixes Signed-off-by: cosa65 --- src/__test__/utils/upload/processSeuratUpload.test.js | 1 - src/utils/upload/{validateSeurat => validateSeurat.js} | 0 2 files changed, 1 deletion(-) rename src/utils/upload/{validateSeurat => validateSeurat.js} (100%) diff --git a/src/__test__/utils/upload/processSeuratUpload.test.js b/src/__test__/utils/upload/processSeuratUpload.test.js index 5d4e3b0057..a3f97db096 100644 --- a/src/__test__/utils/upload/processSeuratUpload.test.js +++ b/src/__test__/utils/upload/processSeuratUpload.test.js @@ -14,7 +14,6 @@ import UploadStatus from 'utils/upload/UploadStatus'; import processUpload from 'utils/upload/processUpload'; -import pushNotificationMessage from 'utils/pushNotificationMessage'; import mockFile from '__test__/test-utils/mockFile'; const FILE_SIZE = 1024 * 1024 * 15; diff --git a/src/utils/upload/validateSeurat b/src/utils/upload/validateSeurat.js similarity index 100% rename from src/utils/upload/validateSeurat rename to src/utils/upload/validateSeurat.js From 21a58ed246972d2239694df9272dd47ec89c5570 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Tue, 21 Nov 2023 08:43:34 -0300 Subject: [PATCH 09/10] Add test bakc in Signed-off-by: cosa65 --- .../utils/upload/processSeuratUpload.test.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/__test__/utils/upload/processSeuratUpload.test.js b/src/__test__/utils/upload/processSeuratUpload.test.js index a3f97db096..a04942b9d8 100644 --- a/src/__test__/utils/upload/processSeuratUpload.test.js +++ b/src/__test__/utils/upload/processSeuratUpload.test.js @@ -14,6 +14,8 @@ import UploadStatus from 'utils/upload/UploadStatus'; import processUpload from 'utils/upload/processUpload'; +import validate from 'utils/upload/validateSeurat'; +import pushNotificationMessage from 'utils/pushNotificationMessage'; import mockFile from '__test__/test-utils/mockFile'; const FILE_SIZE = 1024 * 1024 * 15; @@ -74,6 +76,7 @@ jest.mock('axios', () => ({ })); jest.mock('utils/pushNotificationMessage'); +jest.mock('utils/upload/validateSeurat'); let store = null; @@ -230,4 +233,34 @@ describe('processUpload', () => { expect(axios.request).not.toHaveBeenCalled(); }); }); + + it('Should not validate .rds files', async () => { + const mockAxiosCalls = []; + const uploadSuccess = (params) => { + mockAxiosCalls.push(params); + return Promise.resolve({ headers: { etag: 'etag-blah' } }); + }; + + axios.request.mockImplementation(uploadSuccess); + + validate.mockImplementationOnce( + () => (['Some file error']), + ); + + await processUpload( + getValidFiles(), + sampleType, + store.getState().samples, + mockExperimentId, + store.dispatch, + ); + + // We expect uploads to happen + await waitFor(() => { + expect(); + expect(pushNotificationMessage).toHaveBeenCalledTimes(0); + expect(axios.request).toHaveBeenCalledTimes(2); + expect(validate).toHaveBeenCalledTimes(1); + }); + }); }); From a7ee8351863bfe223a43bf4326a3dc8c12b03ba6 Mon Sep 17 00:00:00 2001 From: cosa65 Date: Wed, 22 Nov 2023 09:13:47 -0300 Subject: [PATCH 10/10] Minor refacotring Signed-off-by: cosa65 --- .../cell-sets-tool/CellSetsTool.jsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx b/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx index 6be18e291b..5bf55e6483 100644 --- a/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx +++ b/src/components/data-exploration/cell-sets-tool/CellSetsTool.jsx @@ -72,7 +72,7 @@ const CellSetsTool = (props) => { setTreeData(composeTree(hierarchy, properties)); }, [hierarchy, properties]); - const [numSelectedCellSetKeys, setNumSelectedCellSetKeys] = useState(null); + const [selectedCellsCount, setSelectedCellsCount] = useState(0); useEffect(() => { const louvainClusters = hierarchy.find(({ key }) => key === 'louvain')?.children; @@ -89,17 +89,12 @@ const CellSetsTool = (props) => { }, [hierarchy]); useEffect(() => { - if (selectedCellSetKeys.length === 0) { - setNumSelectedCellSetKeys(null); - return; - } - const selectedCells = union(selectedCellSetKeys, properties); const numSelectedFiltered = new Set([...selectedCells] .filter((cellIndex) => filteredCellIds.current.has(cellIndex))); - setNumSelectedCellSetKeys(numSelectedFiltered.size); + setSelectedCellsCount(numSelectedFiltered.size); }, [selectedCellSetKeys, properties]); const onNodeUpdate = useCallback((key, data) => { @@ -129,7 +124,7 @@ const CellSetsTool = (props) => { const renderContent = () => { let operations = null; - if (numSelectedCellSetKeys !== null) { + if (selectedCellSetKeys.length > 0) { operations = ( { helpTitle='Create new cell set from the complement of the selected sets in the current tab.' /> - {`${numSelectedCellSetKeys} cell${numSelectedCellSetKeys === 1 ? '' : 's'} selected`} + {`${selectedCellsCount} cell${selectedCellsCount === 1 ? '' : 's'} selected`} );