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

feat: cell type info and info panel refactor #1043

Merged
merged 29 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
543642f
feat: cell type info and info panel refactor
kaloster Jul 18, 2024
1fd5909
chore: Updated [rdev] values.yaml image tags to sha-543642f3
kaloster Jul 18, 2024
6548442
chore: style cleanup and constants
kaloster Jul 19, 2024
3ea8d5d
chore: Updated [rdev] values.yaml image tags to sha-6548442e
kaloster Jul 19, 2024
0ba7d94
Merge branch 'main' into kaloster/cell-type-info
kaloster Jul 19, 2024
ddc0fec
fix: mypy typing
kaloster Jul 19, 2024
cd60fde
Merge branch 'main' into kaloster/cell-type-info
kaloster Jul 19, 2024
50dae4e
fix: existing tests after refactor
kaloster Jul 19, 2024
04ccae5
chore: Updated [rdev] values.yaml image tags to sha-50dae4ef
kaloster Jul 20, 2024
c36b9bf
chore: e2e and unit tests
kaloster Jul 22, 2024
da9947f
Merge branch 'main' into kaloster/cell-type-info
kaloster Jul 22, 2024
dc6815e
fix: error handling and tweaks
kaloster Jul 22, 2024
3882bc0
chore: Updated [rdev] values.yaml image tags to sha-dc6815ed
kaloster Jul 22, 2024
4f1d534
fix: some visual tweaks
kaloster Jul 23, 2024
136d8c0
chore: Updated [rdev] values.yaml image tags to sha-4f1d534a
kaloster Jul 23, 2024
9a210ab
fix: selected point size
kaloster Jul 23, 2024
d9777c1
chore: Updated [rdev] values.yaml image tags to sha-9a210aba
kaloster Jul 23, 2024
23f53c6
fix: Update SDS theme font to Roboto Condensed
tihuan Jul 23, 2024
a6dc7df
chore: font cleanup
kaloster Jul 23, 2024
3579de2
chore: Updated [rdev] values.yaml image tags to sha-a6dc7df8
kaloster Jul 23, 2024
cdc787e
fix: address feedback
kaloster Jul 23, 2024
8857820
fix: address feedback
kaloster Jul 23, 2024
6064234
chore: Updated [rdev] values.yaml image tags to sha-88578202
kaloster Jul 23, 2024
ba17a04
Merge branch 'main' into kaloster/cell-type-info
kaloster Jul 23, 2024
4f8f19f
chore: Updated [rdev] values.yaml image tags to sha-ba17a049
kaloster Jul 23, 2024
48718b8
fix: remove enum
kaloster Jul 23, 2024
da9ec60
Merge branch 'main' into kaloster/cell-type-info
kaloster Jul 23, 2024
bf4bef9
chore: update types
kaloster Jul 23, 2024
f3a8ba1
chore: Updated [rdev] values.yaml image tags to sha-bf4bef92
kaloster Jul 23, 2024
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
2 changes: 1 addition & 1 deletion .infra/rdev/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ stack:
services:
explorer:
image:
tag: sha-c765d258
tag: sha-a6dc7df8
replicaCount: 1
env:
# env vars common to all deployment stages
Expand Down
43 changes: 26 additions & 17 deletions client/__tests__/e2e/cellxgeneActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,43 +602,51 @@ export async function expandGene(

export async function requestGeneInfo(gene: string, page: Page): Promise<void> {
await page.getByTestId(`get-info-${gene}`).click();
await expect(page.getByTestId(`${gene}:gene-info`)).toBeTruthy();
}

export async function requestCellTypeInfo(cell: string, page: Page) {
await page.getByTestId(`cell_type:category-expand`).click();
await page.getByTestId(`get-info-cell_type-${cell}`).click();
}

export async function assertInfoPanelExists(
gene: string,
id: string,
infoType: string,
page: Page
): Promise<void> {
await expect(page.getByTestId(`${gene}:gene-info`)).toBeTruthy();
await expect(page.getByTestId(`info-panel-header`)).toBeTruthy();
await expect(page.getByTestId(`min-info-panel`)).toBeTruthy();
await expect(
page.getByTestId(`${id}:${infoType}-info-wrapper`)
).toBeVisible();
await expect(page.getByTestId(`info-panel-header`)).toBeVisible();
await expect(page.getByTestId(`min-info-panel`)).toBeVisible();

await expect(page.getByTestId(`gene-info-synonyms`).innerText).not.toEqual(
""
);
await expect(
page.getByTestId(`${infoType}-info-synonyms`).innerText
).not.toEqual("");

await expect(page.getByTestId(`gene-info-link`)).toBeTruthy();
await expect(page.getByTestId(`${infoType}-info-link`)).toBeTruthy();
}

export async function minimizeInfoPanel(page: Page): Promise<void> {
await page.getByTestId("min-info-panel").click();
}

export async function assertInfoPanelIsMinimized(
gene: string,
id: string,
infoType: string,
page: Page
): Promise<void> {
const testIds = [
`${gene}:gene-info`,
`${id}:${infoType}-info-wrapper`,
"info-panel-header",
"max-info-panel",
"close-info-panel",
];

await tryUntil(
async () => {
for (const id of testIds) {
const result = await page.getByTestId(id).isVisible();
for (const testId of testIds) {
const result = await page.getByTestId(testId).isVisible();
await expect(result).toBe(true);
}
},
Expand All @@ -651,19 +659,20 @@ export async function closeInfoPanel(page: Page): Promise<void> {
}

export async function assertInfoPanelClosed(
gene: string,
id: string,
infoType: string,
page: Page
): Promise<void> {
const testIds = [
`${gene}:gene-info`,
`${id}:${infoType}-info-wrapper`,
"info-panel-header",
"min-info-panel",
"close-info-panel",
];
await tryUntil(
async () => {
for (const id of testIds) {
const result = await page.getByTestId(id).isVisible();
for (const testId of testIds) {
const result = await page.getByTestId(testId).isVisible();
await expect(result).toBe(false);
}
},
Expand Down
52 changes: 49 additions & 3 deletions client/__tests__/e2e/e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**

Check failure on line 1 in client/__tests__/e2e/e2e.test.ts

View workflow job for this annotation

GitHub Actions / smoke-tests

[chromium] › e2e/e2e.test.ts:1385:19 › dataset: super-cool-spatial.cxg › graph instance: layout-graph › GENE crud operations and interactions whole › open info panel and hide/remove

1) [chromium] › e2e/e2e.test.ts:1385:19 › dataset: super-cool-spatial.cxg › graph instance: layout-graph › GENE crud operations and interactions whole › open info panel and hide/remove Test timeout of 180000ms exceeded.
* Smoke test suite that will be run in GHA
* Tests included in this file are expected to be relatively stable and test core features
*
Expand Down Expand Up @@ -52,6 +52,7 @@
snapshotTestGraph,
getAllCategories,
selectLayout,
requestCellTypeInfo,
} from "./cellxgeneActions";

import { datasets } from "./data";
Expand All @@ -66,6 +67,7 @@
conditionallyToggleSidePanel,
goToPage,
shouldSkipTests,
skipIfPbmcDataset,
skipIfSidePanel,
toggleSidePanel,
} from "../util/helpers";
Expand Down Expand Up @@ -99,6 +101,7 @@

// open gene info card
const geneToRequestInfo = "SIK1";
const cellToRequestInfo = "monocyte";

const genesetDescriptionString = "fourth_gene_set: fourth description";
const genesetToCheckForDescription = "fourth_gene_set";
Expand Down Expand Up @@ -1382,6 +1385,9 @@
test("open info panel and hide/remove", async ({
page,
}, testInfo) => {
skipIfSidePanel(graphTestId, MAIN_PANEL);
skipIfPbmcDataset(testDataset, DATASET);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipping for pbmc3k.cxg dataset as there is no cell_type category

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great context! Can we add that as code comment please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I added an item in the Q3 list to consolidate e2e test dataset to just hopefully one, so we don't have to deal with so many different test datasets 😆


await setup({ option, page, url, testInfo });
await addGeneToSearch(geneToRequestInfo, page);

Expand All @@ -1390,7 +1396,11 @@
await tryUntil(
async () => {
await requestGeneInfo(geneToRequestInfo, page);
await assertInfoPanelExists(geneToRequestInfo, page);
await assertInfoPanelExists(
geneToRequestInfo,
"gene",
page
);
},
{ page }
);
Expand All @@ -1400,7 +1410,11 @@
await tryUntil(
async () => {
await minimizeInfoPanel(page);
await assertInfoPanelIsMinimized(geneToRequestInfo, page);
await assertInfoPanelIsMinimized(
geneToRequestInfo,
"gene",
page
);
},
{ page }
);
Expand All @@ -1410,7 +1424,39 @@
await tryUntil(
async () => {
await closeInfoPanel(page);
await assertInfoPanelClosed(geneToRequestInfo, page);
await assertInfoPanelClosed(
geneToRequestInfo,
"gene",
page
);
},
{ page }
);

await snapshotTestGraph(page, testInfo);

await tryUntil(
async () => {
await requestCellTypeInfo(cellToRequestInfo, page);
await assertInfoPanelExists(
cellToRequestInfo,
"cell-type",
page
);
},
{ page }
);

await snapshotTestGraph(page, testInfo);

await tryUntil(
async () => {
await minimizeInfoPanel(page);
await assertInfoPanelIsMinimized(
cellToRequestInfo,
"cell-type",
page
);
},
{ page }
);
Expand Down
7 changes: 7 additions & 0 deletions client/__tests__/util/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ export function skipIfSidePanel(graphTestId: string, MAIN_PANEL: string) {
skip(graphTestId !== MAIN_PANEL, "This test is only for the main panel");
}

export function skipIfPbmcDataset(graphTestId: string, PBMC_DATASET: string) {
skip(
graphTestId === PBMC_DATASET,
"This test is only for the spatial dataset, since there's not cell_type data in pbmc3k.cxg dataset"
);
}

export function shouldSkipTests(
graphTestId: string,
SIDE_PANEL: string
Expand Down
16 changes: 16 additions & 0 deletions client/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,21 @@ async function fetchGeneInfo(
return response;
}

interface CellTypeInfoAPI {
name: string;
summary: string;
}
/**
* Fetch cell type summary information
* @param cell human-readable name of cell type
*/
async function fetchCellTypeInfo(
cell: string
): Promise<CellTypeInfoAPI | undefined> {
const response = await fetchJson<CellTypeInfoAPI>(`cellinfo?cell=${cell}`);
return response;
}

function prefetchEmbeddings(annoMatrix: AnnoMatrix) {
/*
prefetch requests for all embeddings
Expand Down Expand Up @@ -539,6 +554,7 @@ export default {
checkExplainNewTab,
navigateCheckUserState,
selectDataset,
fetchCellTypeInfo,
fetchGeneInfo,
selectContinuousMetadataAction: selnActions.selectContinuousMetadataAction,
selectCategoricalMetadataAction: selnActions.selectCategoricalMetadataAction,
Expand Down
1 change: 1 addition & 0 deletions client/src/analytics/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export enum EVENTS {
EXPLORER_ADD_GENE_AND_SELECT_HISTOGRAM = "EXPLORER_ADD_GENE_AND_SELECT_HISTOGRAM",
EXPLORER_SELECT_HISTOGRAM = "EXPLORER_SELECT_HISTOGRAM",
EXPLORER_GENE_INFO_BUTTON_CLICKED = "EXPLORER_GENE_INFO_BUTTON_CLICKED",
EXPLORER_CELLTYPE_INFO_BUTTON_CLICKED = "EXPLORER_CELLTYPE_INFO_BUTTON_CLICKED",
EXPLORER_IMAGE_SELECT = "EXPLORER_IMAGE_SELECT",
EXPLORER_IMAGE_DESELECT = "EXPLORER_IMAGE_DESELECT",
EXPLORER_RE_CENTER_EMBEDDING = "EXPLORER_RE_CENTER_EMBEDDING",
Expand Down
27 changes: 27 additions & 0 deletions client/src/common/types/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,30 @@ export interface PublisherMetadata {
published_month: number;
published_year: number;
}

export interface CellInfo {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome types man!

cellId: string;
cellName: string;
cellDescription: string;
synonyms: string[];
references: string[];
error: string | null;
loading: boolean;
}

export interface GeneInfo {
gene: string | null;
geneName: string;
geneSummary: string;
geneSynonyms: string[];
geneUrl: string;
showWarningBanner: boolean;
infoError: string | null;
loading: boolean;
}

export enum ActiveTab {
Gene = "Gene",
Dataset = "Dataset",
CellType = "CellType",
}
Loading
Loading