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

Merging changes #828

Merged
merged 207 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
207 commits
Select commit Hold shift + click to select a range
dacff3f
display downsampling
Jan 18, 2023
11f7206
update
StefanBabukov Feb 9, 2023
6b040f2
delete cell class
aerlaut Feb 10, 2023
9d49887
properly remove item from array
aerlaut Feb 10, 2023
83c50a6
fix wrong action tyep
aerlaut Feb 10, 2023
5b72ba1
switch focus to cell sets after annotation run
aerlaut Feb 10, 2023
3d8c9a7
Merge branch 'master' into delete-sctype-cluster
aerlaut Feb 14, 2023
f9b6389
fix typo
aerlaut Feb 14, 2023
b6e5c22
use else
aerlaut Feb 14, 2023
a34360d
Merge branch 'delete-sctype-cluster' of https://github.com/biomage-or…
aerlaut Feb 14, 2023
43c314e
add test for delete cell class
aerlaut Feb 14, 2023
ae54c26
Remove custom heatmap
Feb 14, 2023
d83861a
Rename Marker heatmap to Heatmap
Feb 14, 2023
825e239
Merge branch 'master' into remove-custom-heatmap
Kristian-A Feb 14, 2023
d32eb0c
Rename variables to better reflect current name of qc
cosa65 Feb 14, 2023
61a3904
done
StefanBabukov Feb 15, 2023
ae9e015
disable deletion of metadata key
aerlaut Feb 15, 2023
9661579
fix rendering for hierarchical tree
aerlaut Feb 15, 2023
e202991
merge conf
StefanBabukov Feb 15, 2023
b117498
add tests
aerlaut Feb 15, 2023
dca733e
Merge branch 'master' into delete-sctype-cluster
aerlaut Feb 15, 2023
e14f243
fix race condition
StefanBabukov Feb 15, 2023
094ec49
further test added
StefanBabukov Feb 15, 2023
f394466
updated title
StefanBabukov Feb 15, 2023
4253956
updated test title
StefanBabukov Feb 15, 2023
9137328
update title condition
StefanBabukov Feb 15, 2023
c8de23c
comments
StefanBabukov Feb 16, 2023
7fd3b1a
selecting different samples
StefanBabukov Feb 16, 2023
46352f6
change
StefanBabukov Feb 16, 2023
af4ccff
snapshot
StefanBabukov Feb 16, 2023
156ee13
add multiple input selection box
aerlaut Feb 16, 2023
cec82c1
set default
aerlaut Feb 16, 2023
8621843
change embedding to only show selected cell sets
aerlaut Feb 17, 2023
f5553f1
add additional info in panel
aerlaut Feb 17, 2023
6f8fb43
comments
StefanBabukov Feb 17, 2023
f9ecf07
disable menus
StefanBabukov Feb 17, 2023
68d8c2f
another disabled menu
StefanBabukov Feb 17, 2023
fea2bcc
more changes
StefanBabukov Feb 17, 2023
0650e04
didnt commit this
StefanBabukov Feb 17, 2023
38160b2
send cellsets to get pseudotime
aerlaut Feb 17, 2023
2ac2cb4
better plot control
aerlaut Feb 17, 2023
2f7e22f
implemented tests
kafkasl Feb 18, 2023
e0ddf48
added debug logs
kafkasl Feb 19, 2023
f149e98
Merge branch 'master' of github.com:biomage-org/ui into precompute-em…
kafkasl Feb 19, 2023
9761655
skip test to allow build
aerlaut Feb 20, 2023
21aa437
Merge branch 'master' into trajectory-cell-set
aerlaut Feb 20, 2023
db8c2c1
Merge branch 'master' of github.com:biomage-org/ui into precompute-em…
kafkasl Feb 20, 2023
6d7816d
update wrong message in node selector
aerlaut Feb 20, 2023
d8f4563
Merge branch 'trajectory-cell-set' of https://github.com/biomage-org/…
aerlaut Feb 20, 2023
5c23455
fix text
aerlaut Feb 20, 2023
f1c1e96
fix select ordr
aerlaut Feb 20, 2023
6f74c76
Merge branch 'master' into trajectory-cell-set
aerlaut Feb 20, 2023
885f082
fix cell set searching
aerlaut Feb 20, 2023
82574c9
Merge branch 'trajectory-cell-set' of https://github.com/biomage-org/…
aerlaut Feb 20, 2023
e174dc7
fix tests
aerlaut Feb 20, 2023
74759d4
toggle display settings
aerlaut Feb 20, 2023
f0f5f49
enable test
aerlaut Feb 20, 2023
8f80053
fix can not remove node by click
aerlaut Feb 21, 2023
b811253
remove selected nodes when getting starting nodes
aerlaut Feb 21, 2023
936ffde
fix reset root nodes
aerlaut Feb 21, 2023
fdacac2
add tests for multiple cell set selction
aerlaut Feb 21, 2023
21fe9ad
make the pseudotime dot size same as embedding
aerlaut Feb 21, 2023
0ba91c7
Merge branch 'master' into enable-downsampling
saracastel Feb 21, 2023
d98d71b
Merge branch 'master' into enable-downsampling
saracastel Feb 21, 2023
1cec934
Show a message when gene list is empty. Do not render table if empty
Feb 21, 2023
4ee115b
Merge branch 'master' into remove-custom-heatmap
Feb 21, 2023
47c1b62
allow for prefixed samples
aerlaut Feb 21, 2023
42a729a
Merge branch 'master' into relax-file-upload-requirements
aerlaut Feb 21, 2023
ec621c5
added comment regarding workerVersion matching APIs
kafkasl Feb 22, 2023
1c3c07f
Merge branch 'master' into precompute-embeding
kafkasl Feb 22, 2023
060464b
Merge branch 'master' into violin-plots-DP
ivababukova Feb 22, 2023
72b1e87
add tests for file inspector
aerlaut Feb 22, 2023
50fa058
Merge branch 'master' into trajectory-cell-set
aerlaut Feb 22, 2023
e6ff1e5
Merge pull request #183 from biomage-org/precompute-embeding
kafkasl Feb 22, 2023
0ad8519
Merge branch 'master' into relax-file-upload-requirements
aerlaut Feb 22, 2023
00f4054
change `node_id` to `nodeId`
aerlaut Feb 22, 2023
89c15b5
use multi select
aerlaut Feb 22, 2023
42bf358
delete multiple cell set
aerlaut Feb 22, 2023
3c85e50
Merge branch 'master' into remove-custom-heatmap
aerlaut Feb 22, 2023
4d7c203
Improve gene selection
Feb 22, 2023
addee6b
Merge branch 'master' into trajectory-cell-set
aerlaut Feb 22, 2023
4d261c2
Merge branch 'master' into violin-plots-DP
ivababukova Feb 22, 2023
10bf906
change
StefanBabukov Feb 22, 2023
f05c537
Merge branch 'violin-plots-DP' of github.com:biomage-org/ui into viol…
StefanBabukov Feb 22, 2023
001edcd
use multiselect
aerlaut Feb 22, 2023
11f344e
Merge branch 'trajectory-cell-set' of https://github.com/biomage-org/…
aerlaut Feb 22, 2023
64d04b2
combine trajectory analysis panels
aerlaut Feb 23, 2023
e663060
Merge pull request #178 from biomage-org/violin-plots-DP
StefanBabukov Feb 23, 2023
eced3f7
push instead of filter
aerlaut Feb 23, 2023
5e5c259
Merge branch 'master' into 2302-resume-qc-from-error-step
cosa65 Feb 23, 2023
8a1ba2a
Merge branch 'master' into relax-file-upload-requirements
aerlaut Feb 23, 2023
b79b3e9
Merge branch 'master' into trajectory-cell-set
aerlaut Feb 23, 2023
e10aece
Merge pull request #179 from biomage-org/2302-resume-qc-from-error-step
cosa65 Feb 23, 2023
a602ef2
Merge branch 'master' into relax-file-upload-requirements
aerlaut Feb 23, 2023
b7f00bd
Merge branch 'master' into trajectory-cell-set
cosa65 Feb 23, 2023
25d3d60
Merge pull request #182 from biomage-org/trajectory-cell-set
aerlaut Feb 23, 2023
d37aed9
rename function
aerlaut Feb 24, 2023
d58aaed
Merge branch 'relax-file-upload-requirements' of https://github.com/b…
aerlaut Feb 24, 2023
b8002af
Merge branch 'master' into relax-file-upload-requirements
aerlaut Feb 24, 2023
1482e2c
Merge branch 'master' into delete-sctype-cluster
aerlaut Feb 24, 2023
5176816
Merge pull request #187 from biomage-org/relax-file-upload-requirements
aerlaut Feb 24, 2023
666577f
Merge branch 'master' into delete-sctype-cluster
aerlaut Feb 27, 2023
41d65ba
Merge pull request #172 from biomage-org/delete-sctype-cluster
aerlaut Feb 27, 2023
d2b865e
Add poc implementation
cosa65 Feb 27, 2023
7378191
Update flux to use v2
aerlaut Feb 27, 2023
e3f80fa
Move ExpressionMatrix into expression
cosa65 Feb 27, 2023
805a314
Add a downsampledMatrix to initialState
cosa65 Feb 27, 2023
cc1ea92
Maintain downsampledExpressionMatrix updated with new data and access…
cosa65 Feb 27, 2023
75944cb
Rework to make heatmaps in plots and tables use downsampled expressio…
cosa65 Feb 27, 2023
7270a3b
Merge pull request #191 from biomage-org/fix-flux-auth
aerlaut Feb 27, 2023
3f7d891
WIP
cosa65 Feb 27, 2023
5d49c1a
Update loadMarkerGenes calls to match new call params required, broke…
cosa65 Feb 28, 2023
6b5b85e
Some fixes
cosa65 Feb 28, 2023
eb07d93
Rename populateHeatmapData to getHeatmapCellOrder which is more accurate
cosa65 Feb 28, 2023
bd64ada
Remove ideal NMarkerGenes calculation, no longer necessary
cosa65 Feb 28, 2023
aafcfd1
Remove calculateIdealNamrkerGenes
cosa65 Feb 28, 2023
cb89a28
Test if gene list renders properly
Feb 28, 2023
757e161
Merge branch 'master' into remove-custom-heatmap
Kristian-A Feb 28, 2023
73b8a9a
Move cellOrder generation into loadMarkerGenes since we need it to be…
cosa65 Feb 28, 2023
33f45b4
Make the downsample cell ids calculation no longer depend on the enab…
cosa65 Feb 28, 2023
bcc02b9
Make generateVitessceData rerun not when any heatmapSettings elem cha…
cosa65 Feb 28, 2023
1873f15
Some improvements
cosa65 Feb 28, 2023
beb1703
Fix so that group by being added doesn't break matrix
cosa65 Feb 28, 2023
ebe91a7
Merge pull request #176 from biomage-org/remove-custom-heatmap
Kristian-A Mar 1, 2023
bdbc8cb
Add cell set dependency for marker heatamp
cosa65 Mar 1, 2023
8a29998
Switch to detemrinistic sampling
cosa65 Mar 1, 2023
4ac4eb5
Fix get gene expression trying to download all of the not fully loade…
cosa65 Mar 2, 2023
5bffa8a
Update loadMarkerGenes calls in plots and tables so they match new in…
cosa65 Mar 2, 2023
1b680f1
Make downsample=false setting work now, but it is likely to run into …
cosa65 Mar 2, 2023
dd986c5
Fix merge conflicts
cosa65 Mar 2, 2023
7494cc5
Fixes to make plots and tables heatmap not crash
cosa65 Mar 3, 2023
ef42a5e
Switch useEffect with useConditionalEffect so selected gene changes d…
cosa65 Mar 3, 2023
ec4dfd5
Back to sampling by picking first n elems
cosa65 Mar 3, 2023
a2444b8
TMP disable unit tests to be able to tst in staging
cosa65 Mar 3, 2023
252f51d
Disable no downsampling option
cosa65 Mar 3, 2023
e484f67
Remove unnecessary folder
cosa65 Mar 3, 2023
bae2ee3
Stop generating own cellOrder, start using the result of the work req…
cosa65 Mar 3, 2023
b99cc8c
Merge branch 'master' of github.com:biomage-org/ui into enable-downsa…
kafkasl Mar 6, 2023
7bd0d59
Correctly format wokr request body loadMarkerGenes
cosa65 Mar 6, 2023
675cbff
Remove getHeatmapCellOrder
cosa65 Mar 6, 2023
a7c3ac8
Add ETag tracking on marker genes so that an old work result doesn't …
cosa65 Mar 6, 2023
81bbac4
Make hidden cell sets trigger a new load marker genes request
cosa65 Mar 6, 2023
ac485e1
Update snapshot
cosa65 Mar 6, 2023
1b4728b
Remove unnecessary param from loadMarkerGenes and update a test
cosa65 Mar 6, 2023
0d81b6f
Rmove unnecessary param and update test
cosa65 Mar 6, 2023
ff25a01
Fix some more tests
cosa65 Mar 6, 2023
904182d
Fix test
cosa65 Mar 6, 2023
077721f
Remove vega-lite package from dependencies
ivababukova Mar 6, 2023
0dea4a3
Merge pull request #196 from biomage-org/remove-vega-lite
ivababukova Mar 7, 2023
2025994
Refactor to make easier to understand and less likely to break in the…
cosa65 Mar 7, 2023
7ff03a0
Update markerGenesLoading test
cosa65 Mar 7, 2023
9862915
Remove heatmapSettings from state, it's not necessary
cosa65 Mar 7, 2023
ca9ff7f
Fix
cosa65 Mar 7, 2023
c6913a0
Minor fix
cosa65 Mar 7, 2023
eec0d8a
Update snapshots
cosa65 Mar 7, 2023
c6923a9
Update snapshot
cosa65 Mar 7, 2023
5946bcd
Update snapshots
cosa65 Mar 7, 2023
5a36c0b
Update snapshot
cosa65 Mar 7, 2023
4cb6184
Update snapshot
cosa65 Mar 7, 2023
7e69076
Set default to enrichr
cosa65 Mar 7, 2023
9b50a77
Update tests
cosa65 Mar 7, 2023
7e865a3
Convert set to array
cosa65 Mar 7, 2023
afef394
Fix, add extra params where encessary
cosa65 Mar 7, 2023
22d4414
Some tests updated
cosa65 Mar 7, 2023
60bdc6e
Make louvain reoslutoon changes trigger loadMarker
cosa65 Mar 7, 2023
f651e59
Switch back to setGeneExpression
cosa65 Mar 7, 2023
88ebc12
Merge branch 'master' into 2278-maker-heatmap-freezing
cosa65 Mar 7, 2023
6426f56
Merge pull request #198 from biomage-org/change-default-to-enrichr
cosa65 Mar 8, 2023
927eff6
Add handling for no cells found error after Select Data settings
cosa65 Mar 8, 2023
7f9ad9c
Merge branch 'master' into enable-downsampling
kafkasl Mar 8, 2023
cd84ea7
Remove if
cosa65 Mar 8, 2023
331af3f
Refactor checks nested ifs
cosa65 Mar 8, 2023
460bf20
Further refactor
cosa65 Mar 8, 2023
db34259
Merge branch 'master' into 2278-maker-heatmap-freezing
cosa65 Mar 8, 2023
d37069c
Add snapshot
cosa65 Mar 9, 2023
9274766
Fix test
cosa65 Mar 9, 2023
0112193
Update error emssage to be less plots-and-tables specific
cosa65 Mar 9, 2023
344c9a4
Update CalculationConfig.jsx
kafkasl Mar 9, 2023
9824a0c
Handle all cell sets hidden in data exploratio
cosa65 Mar 9, 2023
5889702
Handle no cellids matching Select Data settings in plots and tables h…
cosa65 Mar 9, 2023
afc6c9c
Update test
cosa65 Mar 9, 2023
d5a9f8d
Update snapshot
cosa65 Mar 9, 2023
91221c9
Update test
cosa65 Mar 9, 2023
3a0011d
Remove test of removed piece of code
cosa65 Mar 9, 2023
26cc132
Update test
cosa65 Mar 9, 2023
f1c7aae
Remove checks that block new loadMarkerGenes calls from going through
cosa65 Mar 9, 2023
5885bef
Reenable unit tests
cosa65 Mar 9, 2023
8b65daf
Make grid not trigger hover events in any way
cosa65 Mar 9, 2023
5c07a51
Make embedding tooltip beahvior less annoying
cosa65 Mar 9, 2023
7dea7ee
clear cell info on mouse leave
cosa65 Mar 9, 2023
d47627b
Merge pull request #199 from biomage-org/fix-flickering-on-embedding
cosa65 Mar 9, 2023
06bcd9f
Merge branch 'master' into enable-downsampling
kafkasl Mar 10, 2023
8636c8f
Merge pull request #173 from biomage-org/enable-downsampling
kafkasl Mar 10, 2023
ec03eaa
Merge branch 'master' into 2278-maker-heatmap-freezing
cosa65 Mar 10, 2023
a5ef3b3
Add test
cosa65 Mar 10, 2023
dbd24d3
Remove check that is never reached
cosa65 Mar 10, 2023
bf25187
Merge the two useEffects that trigger loadMarkerGenes
cosa65 Mar 10, 2023
47988cf
Add tooltip to scType
cosa65 Mar 10, 2023
16cee66
Merge remote-tracking branch 'biomage/master' into biomage-changes-3
alexvpickering Mar 13, 2023
bf4799e
fix imports
alexvpickering Mar 14, 2023
ae78afc
Merge pull request #201 from biomage-org/2423-add-tooltip-sctype
cosa65 Mar 16, 2023
10af1a7
fix tests
alexvpickering Mar 18, 2023
df0c81b
Merge remote-tracking branch 'biomage/master' into biomage-changes-3
alexvpickering Mar 21, 2023
4829e86
Merge branch 'master' into 2278-maker-heatmap-freezing
cosa65 Mar 22, 2023
0428cae
Merge pull request #190 from biomage-org/2278-maker-heatmap-freezing
cosa65 Mar 22, 2023
5abe19a
Merge remote-tracking branch 'biomage/master' into biomage-changes-3
alexvpickering Mar 23, 2023
b72bcaf
bump codecov allowance
alexvpickering Mar 28, 2023
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
5 changes: 3 additions & 2 deletions .flux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ spec:
ref:
branch: FILLED_IN_BY_CI
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImageRepository
metadata:
name: FILLED_IN_BY_CI
namespace: FILLED_IN_BY_CI
spec:
image: FILLED_IN_BY_CI
interval: 2m0s
provider: aws
---
apiVersion: image.toolkit.fluxcd.io/v1beta1
apiVersion: image.toolkit.fluxcd.io/v1beta2
kind: ImagePolicy
metadata:
name: FILLED_IN_BY_CI
Expand Down
2 changes: 1 addition & 1 deletion codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ coverage:
project: # measuring the overall project coverage
default:
target: auto
threshold: 0.07%
threshold: 0.35%

patch: # measuring the coverage of new changes
default:
Expand Down
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@
"uint8array-json-parser": "0.0.1",
"uuid": "^8.1.0",
"vega": "^5.21.0",
"vega-lite": "^4.13.0",
"vega-webgl-renderer": "^1.0.0-beta.2",
"virtualizedtableforantd4": "^1.2.2",
"vitessce": "github:hms-dbmi-cellenics/vitessce",
Expand Down
Binary file removed public/static/media/heatmap.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { dispatchWorkRequest } from 'utils/work/seekWorkResponse';
import mockAPI, { generateDefaultMockAPIResponses, promiseResponse } from '__test__/test-utils/mockAPI';
import { loadBackendStatus } from 'redux/actions/backendStatus';

enableFetchMocks();

jest.mock('utils/work/seekWorkResponse', () => ({
seekFromS3: jest.fn(),
dispatchWorkRequest: jest.fn(),
Expand Down Expand Up @@ -54,6 +56,27 @@ jest.mock('utils/AppRouteProvider', () => ({

const cellSetsData = require('__test__/data/cell_sets.json');

const cellSetsWithAnnotatedCellClass = _.cloneDeep(cellSetsData);
cellSetsWithAnnotatedCellClass.cellSets.push(
{
key: 'annotated-cell-class-key',
name: 'Annotated cell class',
rootNode: true,
children: [
{
key: 'annotated-cell-set-key',
name: 'Annotated cell set',
color: '#8c564b',
rootNode: false,
cellIds: [
1, 2, 3, 4, 5,
],
},
],
type: 'cellSets',
},
);

const louvainClusters = cellSetsData.cellSets.find(({ key }) => key === 'louvain').children;
const sampleList = cellSetsData.cellSets.find(({ key }) => key === 'sample').children;

Expand Down Expand Up @@ -91,8 +114,9 @@ const mockAPIResponse = _.merge(

describe('CellSetsTool', () => {
beforeEach(async () => {
enableFetchMocks();
fetchMock.mockClear();
jest.clearAllMocks();

fetchMock.resetMocks();
fetchMock.mockIf(/.*/, mockAPI(mockAPIResponse));

storeState = makeStore();
Expand Down Expand Up @@ -670,76 +694,144 @@ describe('CellSetsTool', () => {
);
});

// Enable when AnnotateClustersTool panel is enabled
describe.skip('AnnotateClustersTool', () => {
beforeEach(async () => {
jest.clearAllMocks();

await storeState.dispatch(loadBackendStatus(experimentId));

await act(async () => {
render(
<Provider store={storeState}>
{cellSetsToolFactory()}
</Provider>,
);
});

// Switch to tab
const annotateClustersTabTitle = screen.getByText('Annotate clusters');

// Switch to tab
userEvent.click(annotateClustersTabTitle);
});

it('Renders correctly', async () => {
// Check displays correct text
screen.getByText(/ScType/);
screen.getByText(/Tissue Type/);
screen.getByText(/Species/);
screen.getByText(/Compute/);

// Displays correct placeholder in selects
screen.getByText('Select a tissue type');
screen.getByText('Select a species');

// Displays button and it's disabled
expect(screen.getByRole('button', { name: /Compute/ })).toBeDisabled();
});

it('Can dispatch work request', async () => {
const tissueSelector = screen.getAllByRole('combobox')[0];
const speciesSelector = screen.getAllByRole('combobox')[1];

// Select options
await act(async () => {
await selectOption(/Liver/, tissueSelector);
await selectOption(/mouse/, speciesSelector);
});

// Now the button's enabled
const button = screen.getByRole('button', { name: /Compute/ });
expect(button).toBeEnabled();

// Click the button
act(() => {
userEvent.click(button);
});

// It dispatches a work request
await waitFor(() => {
expect(dispatchWorkRequest).toHaveBeenCalledWith(
experimentId,
{
name: 'ScTypeAnnotate',
species: 'mouse',
tissue: 'Liver',
},
expect.anything(),
expect.anything(),
{ PipelineRunETag: '2021-10-20T12:51:44.755Z', broadcast: true },
);
});
it('Annotated cell sets has delete buttons', async () => {
const mockAPICellClassAPIResponse = {
...mockAPIResponse,
[`experiments/${experimentId}/cellSets`]: () => promiseResponse(JSON.stringify(cellSetsWithAnnotatedCellClass)),
};

fetchMock.mockIf(/.*/, mockAPI(mockAPICellClassAPIResponse));

await act(async () => {
render(
<Provider store={storeState}>
{cellSetsToolFactory()}
</Provider>,
);
});

// The annotated cell clas is the last class in the hierarchy
const annotatedCellSetsGroup = screen.getAllByRole('img', { name: 'down' }).pop();
userEvent.click(annotatedCellSetsGroup);

// There should only be one delete button for the annotated cell class
const deleteButtons = screen.getAllByLabelText(/Delete/);
expect(deleteButtons.length).toEqual(1);
});

it('Deleting annotated cell class deletes the cell class and the cell sets', async () => {
const mockAPICellClassAPIResponse = {
...mockAPIResponse,
[`experiments/${experimentId}/cellSets`]: () => promiseResponse(JSON.stringify(cellSetsWithAnnotatedCellClass)),
};

fetchMock.mockIf(/.*/, mockAPI(mockAPICellClassAPIResponse));

await act(async () => {
render(
<Provider store={storeState}>
{cellSetsToolFactory()}
</Provider>,
);
});

// The annotated cell clas is the last class in the hierarchy
const deleteAnnotatedCellClassButton = screen.getByLabelText(/Delete/);
act(() => {
userEvent.click(deleteAnnotatedCellClassButton);
});

// get all the cell set groups
const numCellGroupsAfterDelete = screen.getAllByRole('img', { name: 'down' }).length;

await waitFor(() => {
// This test used to assert that "Annotated cell set" text is not found in "screen"
// in order to verify that deletion was successful.
// 4 Cell groups: louvain, custom cell sets, sample, Track_1 (metadata)
expect(numCellGroupsAfterDelete).toEqual(4);

expect(screen.queryByText('Annotated cell class')).toBeNull();

// Check that cell class does not exist anymore in redux
const isClassInRedux = Object.keys(storeState.getState().cellSets.properties).includes('annotated-cell-class-key');
expect(isClassInRedux).toBe(false);

// Check that cell set does not exist anymore in redux
const isCellSetInRedux = Object.keys(storeState.getState().cellSets.properties).includes('annotated-cell-set-key');
expect(isCellSetInRedux).toBe(false);
});
});
});

// Enable when AnnotateClustersTool panel is enabled
describe('AnnotateClustersTool', () => {
beforeEach(async () => {
jest.clearAllMocks();

await storeState.dispatch(loadBackendStatus(experimentId));

await act(async () => {
render(
<Provider store={storeState}>
{cellSetsToolFactory()}
</Provider>,
);
});

// Switch to tab
const annotateClustersTabTitle = screen.getByText('Annotate clusters');

// Switch to tab
userEvent.click(annotateClustersTabTitle);
});

it('Renders correctly', async () => {
// Check displays correct text
screen.getByText(/ScType/);
screen.getByText(/Tissue Type/);
screen.getByText(/Species/);
screen.getByText(/Compute/);

// Displays correct placeholder in selects
screen.getByText('Select a tissue type');
screen.getByText('Select a species');

// Displays button and it's disabled
expect(screen.getByRole('button', { name: /Compute/ })).toBeDisabled();
});

it('Can dispatch work request', async () => {
const tissueSelector = screen.getAllByRole('combobox')[0];
const speciesSelector = screen.getAllByRole('combobox')[1];

// Select options
await act(async () => {
await selectOption(/Liver/, tissueSelector);
await selectOption(/mouse/, speciesSelector);
});

// Now the button's enabled
const button = screen.getByRole('button', { name: /Compute/ });
expect(button).toBeEnabled();

// Click the button
act(() => {
userEvent.click(button);
});

// It dispatches a work request
await waitFor(() => {
expect(dispatchWorkRequest).toHaveBeenCalledWith(
experimentId,
{
name: 'ScTypeAnnotate',
species: 'mouse',
tissue: 'Liver',
},
expect.anything(),
expect.anything(),
{ PipelineRunETag: '2021-10-20T12:51:44.755Z', broadcast: true },
);
});
});
});
Loading