Skip to content

Commit

Permalink
Filter SV by custom driver annotations in oncoprint and study page
Browse files Browse the repository at this point in the history
  • Loading branch information
Bas Leenknegt committed Apr 25, 2023
1 parent c5d86ba commit 4626705
Show file tree
Hide file tree
Showing 49 changed files with 464 additions and 332 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ jobs:
- v10-cbio-database-files-{{ checksum "/tmp/db_data_md5key" }}
- restore_cache:
keys:
- v11-keycloak-database-files-{{ checksum "e2e-localdb-workspace/keycloak/keycloak-config-generated.json" }}
- v12-keycloak-database-files-{{ checksum "e2e-localdb-workspace/keycloak/keycloak-config-generated.json" }}
- run:
name: Init database
command: |
Expand Down Expand Up @@ -329,7 +329,7 @@ jobs:
- save_cache:
paths:
- /tmp/repo/e2e-localdb-workspace/kc_db_data
key: v11-keycloak-database-files-{{ checksum "e2e-localdb-workspace/keycloak/keycloak-config-generated.json" }}
key: v12-keycloak-database-files-{{ checksum "e2e-localdb-workspace/keycloak/keycloak-config-generated.json" }}
- run:
name: Run end-2-end tests with studies in local database
command: |
Expand Down
26 changes: 12 additions & 14 deletions end-to-end-test/local/specs/annotation-filter-menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const studyViewUrl = `${CBIOPORTAL_URL}/study/summary?id=study_es_0`;
const comparisonResultsViewUrl = `${CBIOPORTAL_URL}/results/comparison?genetic_profile_ids_PROFILE_MUTATION_EXTENDED=study_es_0_mutations&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=study_es_0_gistic&cancer_study_list=study_es_0&Z_SCORE_THRESHOLD=2.0&RPPA_SCORE_THRESHOLD=2.0&data_priority=0&profileFilter=0&case_set_id=study_es_0_cnaseq&gene_list=ABLIM1%2520TP53&geneset_list=%20&tab_index=tab_visualize&Action=Submit&comparison_subtab=alterations`;
const selectSamplesButton = 'button=Select Samples';

// Note: not all SV elements outside of visible area are rendered:
const SV_COUNTS = {
AGAP3: '2',
AGK: '4',
Expand All @@ -26,10 +27,10 @@ const SV_COUNTS = {
FAM131B: '1',
GIPC2: '1',
MKRN1: '2',
NCOA4: '2',
NCOA4: '3',
PIEZO1: '1',
PRKAR2B: '1',
RBM33: '1',
RET: '1',
SND1: '10',
TMPRSS2: '2',
TNS3: '1',
Expand Down Expand Up @@ -197,10 +198,9 @@ describe('alteration filter menu', function() {
MSH3: '1',
MYB: '1',
});
assert.deepStrictEqual(
geneTableCounts('structural variants-table'),
SV_COUNTS
);

// For Structural Variants: see custom-driver-annotations-in-study-view.spec.js

assert.deepStrictEqual(
geneTableCounts('copy number alterations-table'),
{
Expand Down Expand Up @@ -235,10 +235,9 @@ describe('alteration filter menu', function() {
ADAMTS20: '1',
OR11H1: '1',
});
assert.deepStrictEqual(
geneTableCounts('structural variants-table'),
SV_COUNTS
);

// For Structural Variants: see custom-driver-annotations-in-study-view.spec.js

assert.deepStrictEqual(
geneTableCounts('copy number alterations-table'),
{
Expand Down Expand Up @@ -274,10 +273,9 @@ describe('alteration filter menu', function() {
OR11H1: '1',
TMEM247: '1',
});
assert.deepStrictEqual(
geneTableCounts('structural variants-table'),
SV_COUNTS
);

// For Structural Variants: see custom-driver-annotations-in-study-view.spec.js

assert.deepStrictEqual(
geneTableCounts('copy number alterations-table'),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ const oncoprintTabUrlCna =
CBIOPORTAL_URL +
'/results/oncoprint?Action=Submit&RPPA_SCORE_THRESHOLD=2.0&Z_SCORE_THRESHOLD=2.0&cancer_study_list=study_es_0&case_set_id=study_es_0_cnaseq&data_priority=0&gene_list=ACAP3%2520AGRN&geneset_list=%20&genetic_profile_ids_PROFILE_COPY_NUMBER_ALTERATION=study_es_0_gistic&genetic_profile_ids_PROFILE_MUTATION_EXTENDED=study_es_0_mutations&profileFilter=0&tab_index=tab_visualize&show_samples=true';

describe('custom driver annotations feature', function() {
const oncoprintTabUrlStructVar =
CBIOPORTAL_URL +
'/results/oncoprint?Action=Submit&cancer_study_list=study_es_0&Z_SCORE_THRESHOLD=2.0&RPPA_SCORE_THRESHOLD=2.0&profileFilter=mutations%2Cstructural_variants%2Cgistic&case_set_id=study_es_0_cnaseq&gene_list=TMPRSS2&geneset_list=%20&tab_index=tab_visualize';

describe('custom driver annotations feature in result view', function() {
describe('oncoprint tab - mutations', () => {
beforeEach(() => {
goToUrlAndSetLocalStorage(oncoprintTabUrl, true);
Expand Down Expand Up @@ -58,7 +62,6 @@ describe('custom driver annotations feature', function() {
$('input[data-test=HideVUS]').click();
waitForOncoprint();
assert($('div.alert-info*=1 mutation').isExisting());

$('label*=Class 1')
.$('input')
.click();
Expand Down Expand Up @@ -172,4 +175,58 @@ describe('custom driver annotations feature', function() {
assert(tiersCheckboxes[1].isSelected());
});
});

describe('oncoprint tab - structural variants', () => {
beforeEach(() => {
goToUrlAndSetLocalStorage(oncoprintTabUrlStructVar, true);
waitForOncoprint();
setSettingsMenuOpen(true, 'GlobalSettingsButton');
});

it('shows custom driver annotation elements in config menu', () => {
var topCheckBox = $('input[data-test=annotateCustomBinary]');
assert(topCheckBox.isSelected());

var tiersCheckboxes = $('span[data-test=annotateCustomTiers]').$$(
'input'
);
assert(tiersCheckboxes[0].isSelected());
});

it('allows deselection of Tiers checkboxes', () => {
var class1Checkbox = $('label*=Class 1').$('input');
class1Checkbox.click();
waitForOncoprint();
assert(!class1Checkbox.isSelected());
});

it('updates selected samples when VUS alterations are excluded', () => {
$('input[data-test=annotateHotspots]').click();
$('input[data-test=annotateOncoKb]').click();
$('input[data-test=HideVUS]').click();
waitForOncoprint();
assert($('div.alert-info*=1 structural variant').isExisting());

$('label*=Class 1')
.$('input')
.click();
waitForOncoprint();
assert($('div.alert-info*=2 structural variants').isExisting());
});

it('(de-)selects custom driver checkboxes with main annotation select option', () => {
$('input[data-test=ColorByDriver]').click();
waitForOncoprint();
var topCheckBox = $('input[data-test=annotateCustomBinary]');
var tiersCheckboxes = $('span[data-test=annotateCustomTiers]').$$(
'input'
);
assert(!topCheckBox.isSelected());
assert(!tiersCheckboxes[0].isSelected());

$('input[data-test=ColorByDriver]').click();
assert(topCheckBox.isSelected());
assert(tiersCheckboxes[0].isSelected());
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
const assert = require('assert');
const { waitForNetworkQuiet } = require('../../shared/specUtils');
const goToUrlAndSetLocalStorage = require('../../shared/specUtils')
.goToUrlAndSetLocalStorage;

const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');
const STUDY_VIEW_URL = `${CBIOPORTAL_URL}/study/summary?id=study_es_0`;
const ALTERATION_MENU_BTN = `button[data-test="AlterationFilterButton"]`;
const SHOW_UNKNOWN_TIER = `input[data-test="ShowUnknownTier"]`;
const SV_TABLE = `div[data-test="structural variants-table"]`;
const ANY_ROW = `div[aria-rowindex]`;
const BRAF_ROW = `div[aria-rowindex="1"]`;
const GENE_NAME = `div[data-test="geneNameCell"]`;
const ALTERATIONS_TOTAL = `span[data-test="numberOfAlterations"]`;
const ALTERATION_CASES = `span[data-test="numberOfAlteredCasesText"]`;
const SHOW_CLASS_3 = `input[data-test="Class_3"]`;
const SHOW_CLASS_4 = `input[data-test="Class_4"]`;
const SHOW_PUTATIVE_DRIVERS = `input[data-test="ShowDriver"]`;
const SHOW_UNKNOWN_ONCOGENICITY = `input[data-test="ShowUnknownOncogenicity"]`;

describe('custom driver annotations feature in study view', function() {
describe('structural variants', () => {
beforeEach(() => {
goToUrlAndSetLocalStorage(STUDY_VIEW_URL, true);
waitForNetworkQuiet();
});

it('shows all structural variants', () => {
$(SV_TABLE)
.$(BRAF_ROW)
.waitForDisplayed();
assert($(SV_TABLE).$$(ANY_ROW).length === 21);
let geneName = $(SV_TABLE)
.$(BRAF_ROW)
.$(GENE_NAME)
.getText();
assert(geneName === 'BRAF');
const alterations = $(SV_TABLE)
.$(BRAF_ROW)
.$(ALTERATIONS_TOTAL);
assert(alterations.getText() === '36');
const alterationCases = $(SV_TABLE)
.$(BRAF_ROW)
.$(ALTERATION_CASES)
.getText();
assert(alterationCases === '35');
});

it('can exclude unknown (and NULL) driver tiers', () => {
$(ALTERATION_MENU_BTN).click();
$(SHOW_UNKNOWN_TIER).waitForDisplayed(5000);
assert($(SHOW_UNKNOWN_TIER).isSelected());
$(SHOW_UNKNOWN_TIER).click();
$(SV_TABLE)
.$(BRAF_ROW)
.waitForDisplayed();
assert($(SV_TABLE).$$(ANY_ROW).length === 10);
const alterations = $(SV_TABLE)
.$(BRAF_ROW)
.$(ALTERATIONS_TOTAL)
.getText();
assert(alterations === '1');
const brafCases = $(SV_TABLE)
.$(BRAF_ROW)
.$(ALTERATION_CASES)
.getText();
assert(brafCases === '1');
});

it('can exclude custom driver tiers', () => {
$(ALTERATION_MENU_BTN).click();
$(SHOW_UNKNOWN_TIER).waitForDisplayed(5000);
assert($(SHOW_UNKNOWN_TIER).isSelected());
$(SHOW_UNKNOWN_TIER).click();

assert($(SHOW_CLASS_3).isSelected());
$(SHOW_CLASS_3).click();

assert($(SHOW_CLASS_4).isSelected());
$(SHOW_CLASS_4).click();

$(SV_TABLE)
.$(ANY_ROW)
.waitForDisplayed();

assert($(SV_TABLE).$$(ANY_ROW).length === 5);
assert(getAllGeneNames() === 'ALK,EGFR,EML4,ERG,TMPRSS2');
});

it('can exclude custom drivers', () => {
$(ALTERATION_MENU_BTN).click();
$(SHOW_UNKNOWN_TIER).waitForDisplayed(5000);

assert($(SHOW_PUTATIVE_DRIVERS).isSelected());
$(SHOW_PUTATIVE_DRIVERS).click();

assert($(SHOW_UNKNOWN_ONCOGENICITY).isSelected());
$(SHOW_UNKNOWN_ONCOGENICITY).click();

$(SV_TABLE)
.$(ANY_ROW)
.waitForDisplayed();

assert($(SV_TABLE).$$(ANY_ROW).length === 2);
assert(getAllGeneNames() === 'NCOA4,RET');
});
});
});

function getAllGeneNames() {
return $(SV_TABLE)
.$$(ANY_ROW)
.map(e => e.$(GENE_NAME).getText())
.sort()
.join();
}
22 changes: 11 additions & 11 deletions src/pages/patientView/clinicalInformation/PatientViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ import CancerTypeCache from 'shared/cache/CancerTypeCache';
import MutationCountCache from 'shared/cache/MutationCountCache';
import {
concatMutationData,
evaluateDiscreteCNAPutativeDriverInfo,
evaluateMutationPutativeDriverInfo,
existsSomeMutationWithAscnPropertyInCollection,
fetchClinicalData,
fetchClinicalDataForPatient,
Expand Down Expand Up @@ -105,6 +103,8 @@ import {
fetchStructuralVariantOncoKbData,
parseOtherBiomarkerQueryId,
tumorTypeResolver,
evaluatePutativeDriverInfoWithHotspots,
evaluatePutativeDriverInfo,
} from 'shared/lib/StoreUtils';
import {
computeGenePanelInformation,
Expand Down Expand Up @@ -156,10 +156,6 @@ import {
} from 'cbioportal-utils';
import { makeGeneticTrackData } from 'shared/components/oncoprint/DataUtils';
import { GeneticTrackDatum } from 'shared/components/oncoprint/Oncoprint';
import {
AnnotatedExtendedAlteration,
CustomDriverNumericGeneMolecularData,
} from 'pages/resultsView/ResultsViewPageStore';
import {
cna_profile_data_to_string,
getMutationSubType,
Expand Down Expand Up @@ -197,6 +193,8 @@ import { IGenePanelDataByProfileIdAndSample } from 'shared/lib/isSampleProfiled'
import { NamespaceColumnConfig } from 'shared/components/namespaceColumns/NamespaceColumnConfig';
import { buildNamespaceColumnConfig } from 'shared/components/namespaceColumns/namespaceColumnsUtils';
import { SiteError } from 'shared/model/appMisc';
import { AnnotatedExtendedAlteration } from 'shared/model/AnnotatedExtendedAlteration';
import { CustomDriverNumericGeneMolecularData } from 'shared/model/CustomDriverNumericGeneMolecularData';

type PageMode = 'patient' | 'sample';
type ResourceId = string;
Expand Down Expand Up @@ -2059,7 +2057,7 @@ export class PatientViewPageStore {
getOncoKBAnnotationFunc(cnaDatum);

// Note: custom driver annotations are part of the incoming datum
return evaluateDiscreteCNAPutativeDriverInfo(
return evaluatePutativeDriverInfo(
cnaDatum,
oncoKbDatum,
false,
Expand Down Expand Up @@ -2521,13 +2519,15 @@ export class PatientViewPageStore {
// - custom driver annotations are part of the incoming datum
// - cbio counts, cosmic and custom driver annnotations are
// not used for driver evaluation
return evaluateMutationPutativeDriverInfo(
return evaluatePutativeDriverInfoWithHotspots(
mutation,
oncoKbDatum,
true,
isHotspotDriver,
false,
undefined
undefined,
{
hotspotAnnotationsActive: true,
hotspotDriver: isHotspotDriver,
}
);
});
},
Expand Down
Loading

0 comments on commit 4626705

Please sign in to comment.