Skip to content

Commit

Permalink
Merge branch 'master' into add-cell-level-to-differential-expression
Browse files Browse the repository at this point in the history
  • Loading branch information
cosa65 authored Nov 15, 2023
2 parents a0fc7f7 + 5e58da0 commit 72e84be
Show file tree
Hide file tree
Showing 57 changed files with 99,736 additions and 2,831 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ describe('Embedding', () => {
},
genes: {
expression: {
loading: false,
matrix: new ExpressionMatrix(),
full: {
loading: false,
matrix: new ExpressionMatrix(),
},
},
},
cellInfo: {
Expand Down Expand Up @@ -120,8 +122,8 @@ describe('Embedding', () => {
expect(vitesscePropsSpy.obsEmbedding).toEqual(
{
data: [[-13, 6, 43, 57], [32, 7, 9, 3]],
shape: [2, 4]
}
shape: [2, 4],
},
);
expect(vitesscePropsSpy.obsEmbeddingIndex).toEqual(['0', '1', '2', '3']);
});
Expand Down Expand Up @@ -211,9 +213,7 @@ describe('Embedding', () => {
it('renders CrossHair and CellInfo components when user hovers over cell', () => {
store = mockStore(initialState);

const mockProjectFromId = jest.fn((cellId) => {
return store.getState().embeddings.umap.data[cellId];
});
const mockProjectFromId = jest.fn((cellId) => store.getState().embeddings.umap.data[cellId]);

const cellCoordinates = {
projectFromId: mockProjectFromId,
Expand Down Expand Up @@ -248,9 +248,7 @@ describe('Embedding', () => {
it('does not render CrossHair and CellInfo components when user zooms in or out of the embedding', () => {
store = mockStore(initialState);

const mockProjectFromId = jest.fn((cellId) => {
return store.getState().embeddings.umap.data[cellId];
});
const mockProjectFromId = jest.fn((cellId) => store.getState().embeddings.umap.data[cellId]);

const cellCoordinates = {
projectFromId: mockProjectFromId,
Expand Down Expand Up @@ -284,8 +282,10 @@ describe('Embedding', () => {
genes: {
...initialState.genes,
expression: {
loading: [],
matrix: getTwoGenesExpressionMatrix(),
full: {
loading: [],
matrix: getTwoGenesExpressionMatrix(),
},
},
},
cellInfo: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ const backendStatus = {
const initialState = {
genes: {
expression: {
loading: [],
matrix: getTwoGenesExpressionMatrix(),

full: {
loading: [],
matrix: getTwoGenesExpressionMatrix(),
},
views: {
[componentType]: {
data: ['Gzma', 'Lyz2'],
Expand Down Expand Up @@ -70,7 +71,7 @@ describe('ComponentActions', () => {

component = mount(
<Provider store={store}>
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} />
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} useDownsampledExpression={false} />
</Provider>,
);

Expand All @@ -91,7 +92,7 @@ describe('ComponentActions', () => {

component = mount(
<Provider store={store}>
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} />
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} useDownsampledExpression={false} />
</Provider>,
);

Expand All @@ -109,7 +110,7 @@ describe('ComponentActions', () => {

component = mount(
<Provider store={store}>
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} />
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} useDownsampledExpression={false} />
</Provider>,
);

Expand All @@ -122,6 +123,7 @@ describe('ComponentActions', () => {
expect(fetchWork).toHaveBeenCalledWith(
experimentId,
{
downsampled: false,
name: 'GeneExpression',
genes: ['GeneA', 'GeneB', 'GeneC'],
},
Expand All @@ -148,23 +150,21 @@ describe('ComponentActions', () => {

component = mount(
<Provider store={store}>
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} />
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} useDownsampledExpression={false} />
</Provider>,
);

const menuButtons = component.find(Dropdown).props().overlay;
menuButtons.props.children[1].props.onClick();

// Wait for side-effect to propagate (properties loading and loaded).
await waitForActions(store, [GENES_EXPRESSION_LOADING, GENES_EXPRESSION_LOADED]);
// Wait for side-effect to propagate (genes loaded).
await waitForActions(store, [GENES_EXPRESSION_LOADED]);

expect(fetchWork).toHaveBeenCalledTimes(0);

expect(store.getActions().length).toEqual(2);
expect(store.getActions().length).toEqual(1);

expect(store.getActions()[0]).toMatchSnapshot();

expect(store.getActions()[1]).toMatchSnapshot();
});

it('Dispatches loadGeneExpression action with the right list of genes when Overwrite is clicked', async () => {
Expand All @@ -178,20 +178,19 @@ describe('ComponentActions', () => {

component = mount(
<Provider store={store}>
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} />
<ComponentActions name='fakeName' experimentId={experimentId} componentType={componentType} useDownsampledExpression={false} />
</Provider>,
);

const menuButtons = component.find(Dropdown).props().overlay;
menuButtons.props.children[2].props.onClick();

// Wait for side-effect to propagate (properties loading and loaded).
await waitForActions(store, [GENES_EXPRESSION_LOADING, GENES_EXPRESSION_LOADED]);
await waitForActions(store, [GENES_EXPRESSION_LOADED]);

expect(fetchWork).toHaveBeenCalledTimes(0);

expect(store.getActions().length).toEqual(2);
expect(store.getActions().length).toEqual(1);
expect(store.getActions()[0]).toMatchSnapshot();
expect(store.getActions()[1]).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,6 @@ exports[`ComponentActions Dispatches loadGeneExpression action with the right li
`;

exports[`ComponentActions Dispatches loadGeneExpression action with the right list of genes when Overwrite is clicked 1`] = `
{
"payload": {
"componentUuid": "asd",
"experimentId": "1234",
"genes": [
"Gzma",
],
},
"type": "genes/expressionLoading",
}
`;

exports[`ComponentActions Dispatches loadGeneExpression action with the right list of genes when Overwrite is clicked 2`] = `
{
"payload": {
"componentUuid": "asd",
Expand All @@ -173,19 +160,6 @@ exports[`ComponentActions Dispatches loadGeneExpression action with the right li
`;

exports[`ComponentActions Dispatches loadGeneExpression action with the right list of genes when Remove is clicked 1`] = `
{
"payload": {
"componentUuid": "asd",
"experimentId": "1234",
"genes": [
"Lyz2",
],
},
"type": "genes/expressionLoading",
}
`;

exports[`ComponentActions Dispatches loadGeneExpression action with the right list of genes when Remove is clicked 2`] = `
{
"payload": {
"componentUuid": "asd",
Expand Down
Loading

0 comments on commit 72e84be

Please sign in to comment.