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

Add Clinical Attributes to Mutations Tab in Results View #3793

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 22 additions & 8 deletions end-to-end-test/remote/specs/core/mutationTable.spec.js
Expand Up @@ -36,8 +36,12 @@ describe('Mutation Table', function() {

// click on column button
browser.click('button*=Columns');
// scroll down to activated "exon" selection
browser.scroll(1000, 1000);
// scroll down to activated "Exon" selection
browser.execute(
'document.getElementsByClassName("ReactVirtualized__Grid")[0].scroll(1000, 1000)'
);
// wait for exon checkbox to appear
browser.pause(2000);
// click "exon"
browser.click('//*[text()="Exon"]');
// check if three exact matches for 6 appear
Expand Down Expand Up @@ -114,13 +118,15 @@ describe('Mutation Table', function() {
60000
);
// show the gnomad column
browser.scroll(1000, 0);
browser.scroll(0, 1000);
// click on column button
browser.click('button*=Columns');
// scroll down to activated "GNOMAD" selection
browser.scroll(1000, 1000);
// wait for gnomad checkbox appear
browser.waitForVisible('[data-id=gnomAD]', 60000);
browser.execute(
'document.getElementsByClassName("ReactVirtualized__Grid")[0].scroll(1000, 1000)'
);
// wait for gnomad checkbox to appear
browser.pause(2000);
// click "GNOMAD"
browser.click('//*[text()="gnomAD"]');
// find frequency
Expand Down Expand Up @@ -172,7 +178,11 @@ describe('Mutation Table', function() {
// click on column button
browser.click('button*=Columns');
// scroll down to activated "ClinVar" selection
browser.scroll(1000, 1000);
browser.execute(
'document.getElementsByClassName("ReactVirtualized__Grid")[0].scroll(1000, 1000)'
);
// wait for clinvar checkbox to appear
browser.pause(2000);
// click "clinvar"
browser.click('//*[text()="ClinVar"]');
let res;
Expand Down Expand Up @@ -206,7 +216,11 @@ describe('Mutation Table', function() {
// click on column button
browser.click('button*=Columns');
// scroll down to activated "dbSNP" selection
browser.scroll(1000, 1000);
browser.execute(
'document.getElementsByClassName("ReactVirtualized__Grid")[0].scroll(1000, 1000)'
);
// wait for dbSNP checkbox to appear
browser.pause(2000);
// click "dbSNP"
browser.click('//*[text()="dbSNP"]');
let res;
Expand Down
44 changes: 44 additions & 0 deletions src/pages/resultsView/ResultsViewPageStore.ts
Expand Up @@ -69,6 +69,7 @@ import GenomeNexusCache from 'shared/cache/GenomeNexusCache';
import GenomeNexusMutationAssessorCache from 'shared/cache/GenomeNexusMutationAssessorCache';
import CancerTypeCache from 'shared/cache/CancerTypeCache';
import MutationCountCache from 'shared/cache/MutationCountCache';
import ClinicalAttributeCache from 'shared/cache/ClinicalAttributeCache';
import DiscreteCNACache from 'shared/cache/DiscreteCNACache';
import PdbHeaderCache from 'shared/cache/PdbHeaderCache';
import {
Expand Down Expand Up @@ -1143,6 +1144,26 @@ export class ResultsViewPageStore {
},
});

// TODO: Should include all clinical attributes, not just server attributes
readonly mutationsTabClinicalAttributes = remoteData<ClinicalAttribute[]>({
await: () => [this.studyIds],
invoke: async () => {
const clinicalAttributes = await client.fetchClinicalAttributesUsingPOST(
{
studyIds: this.studyIds.result!,
}
);
const excludeList = ['CANCER_TYPE_DETAILED', 'MUTATION_COUNT'];

return _.uniqBy(
clinicalAttributes.filter(
x => !excludeList.includes(x.clinicalAttributeId)
),
x => x.clinicalAttributeId
);
},
});

readonly clinicalAttributeIdToClinicalAttribute = remoteData({
await: () => [this.clinicalAttributes],
invoke: () =>
Expand Down Expand Up @@ -1255,6 +1276,22 @@ export class ResultsViewPageStore {
},
});

readonly clinicalAttributeIdToAvailableFrequency = remoteData({
await: () => [
this.clinicalAttributeIdToAvailableSampleCount,
this.samples,
],
invoke: () => {
const numSamples = this.samples.result!.length;
return Promise.resolve(
_.mapValues(
this.clinicalAttributeIdToAvailableSampleCount.result!,
count => (100 * count) / numSamples
)
);
},
});

readonly cnSegments = remoteData<CopyNumberSeg[]>(
{
await: () => [this.filteredSamples],
Expand Down Expand Up @@ -3428,6 +3465,7 @@ export class ResultsViewPageStore {
this.oncoKbCancerGenes,
() => this.mutationsByGene.result![gene.hugoGeneSymbol] || [],
() => this.mutationCountCache,
() => this.clinicalAttributeCache,
() => this.genomeNexusCache,
() => this.genomeNexusMutationAssessorCache,
() => this.discreteCNACache,
Expand All @@ -3442,6 +3480,8 @@ export class ResultsViewPageStore {
this.uniqueSampleKeyToTumorType.result!,
this.generateGenomeNexusHgvsgUrl,
this.clinicalDataGroupedBySampleMap,
this.mutationsTabClinicalAttributes,
this.clinicalAttributeIdToAvailableFrequency,
this.genomeNexusClient,
this.genomeNexusInternalClient,
() => this.urlWrapper.query.mutations_transcript_id
Expand Down Expand Up @@ -5325,6 +5365,10 @@ export class ResultsViewPageStore {
return new MutationCountCache();
}

@cached @computed get clinicalAttributeCache() {
return new ClinicalAttributeCache();
}

@cached @computed get pdbHeaderCache() {
return new PdbHeaderCache();
}
Expand Down