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 alerts on patient view alteration tables when one sample of many is not profiled #4391

Merged
merged 5 commits into from
Oct 20, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 14 additions & 10 deletions end-to-end-test/remote/specs/core/patient.logic.spec.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
var assert = require('assert');
var goToUrlAndSetLocalStorage = require('../../../shared/specUtils')
.goToUrlAndSetLocalStorage;

var {
goToUrlAndSetLocalStorage,
getElementByTestHandle,
} = require('../../../shared/specUtils');

const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');

describe('patient page', function() {
this.retries(2);
before(() => {
goToUrlAndSetLocalStorage(CBIOPORTAL_URL);
});

it('should show all samples button for single sample view of multi sample patient', function() {
it('should show "all samples button" for single sample view of multi sample patient', function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/patient?studyId=lgg_ucsf_2014&tab=summaryTab&sampleId=P04_Pri`
);

$('.//*[text()[contains(.,"Show all")]]').waitForExist();
$('button=Show all 4 samples').waitForExist();
});

assert.equal(
$('.//*[text()[contains(.,"Show all")]]')
.getText()
.toLowerCase(),
'show all 4 samples'.toLowerCase()
it('show appropriate messaging when a patient has only some profiled samples', () => {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/patient?studyId=mpcproject_broad_2021&caseId=MPCPROJECT_0013`
);

// there is one partial profile message for CNA and sample 2
getElementByTestHandle('patientview-mutation-table').waitForDisplayed();
});
});
19 changes: 18 additions & 1 deletion end-to-end-test/remote/specs/core/patient.screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ var assert = require('assert');
const {
goToUrlAndSetLocalStorage,
checkOncoprintElement,
checkElementWithMouseDisabled,
waitForNetworkQuiet,
} = require('../../../shared/specUtils');
const { assertScreenShotMatch } = require('../../../shared/lib/testUtils');

const CBIOPORTAL_URL = process.env.CBIOPORTAL_URL.replace(/\/$/, '');

describe('Patient Cohort View Custom Tab Tests', () => {
const patientUrl = `https://www.cbioportal.org/patient?studyId=coadread_tcga_pub&caseId=TCGA-A6-2670#navCaseIds=coadread_tcga_pub:TCGA-A6-2670,coadread_tcga_pub:TCGA-A6-2672`;
const patientUrl = `${CBIOPORTAL_URL}/patient?studyId=coadread_tcga_pub&caseId=TCGA-A6-2670#navCaseIds=coadread_tcga_pub:TCGA-A6-2670,coadread_tcga_pub:TCGA-A6-2672`;

it('Patient page valid after cohort navigation', function() {
goToUrlAndSetLocalStorage(patientUrl);
Expand All @@ -32,3 +35,17 @@ describe('Patient Cohort View Custom Tab Tests', () => {
assertScreenShotMatch(res2);
});
});

// describe('patient page', function() {
// before(() => {
// goToUrlAndSetLocalStorage(CBIOPORTAL_URL);
// });
//
// it('should show all samples button for single sample view of multi sample patient', function() {
// goToUrlAndSetLocalStorage(
// `${CBIOPORTAL_URL}/patient?studyId=lgg_ucsf_2014&tab=summaryTab&sampleId=P04_Pri`
// );
//
// checkElementWithMouseDisabled();
// });
// });
2 changes: 1 addition & 1 deletion end-to-end-test/remote/specs/core/screenshot.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ describe('results page pathways tab with unprofiled genes', function() {
});

it(`results page pathwaymapper tab with unprofiled genes`, function() {
$('#cy').waitForDisplayed({ timeout: 15000 });
$('#cy').waitForDisplayed({ timeout: 30000 });

waitForNetworkQuiet(15000);

Expand Down
5 changes: 5 additions & 0 deletions end-to-end-test/shared/specUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ function setSettingsMenuOpen(open, buttonId = 'GlobalSettingsButton') {
);
}

function getElementByTestHandle(handle) {
return $(`[data-test=${handle}]`);
}

function setOncoprintMutationsMenuOpen(open) {
const mutationColorMenuButton = '#mutationColorDropdown';
const mutationColorMenuDropdown =
Expand Down Expand Up @@ -753,4 +757,5 @@ module.exports = {
jq,
setServerConfiguration,
selectClinicalTabPlotType,
getElementByTestHandle,
};
501 changes: 121 additions & 380 deletions src/pages/patientView/PatientViewPageTabs.tsx

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions src/pages/patientView/PatientViewPageUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import TumorColumnFormatter from './mutation/column/TumorColumnFormatter';
import _ from 'lodash';
import {
IGenePanelDataByProfileIdAndSample,
isSampleProfiledInProfile,
} from 'shared/lib/isSampleProfiled';

export function checkNonProfiledGenesExist(
sampleIds: string[],
Expand All @@ -17,3 +21,33 @@ export function checkNonProfiledGenesExist(
return _.values(profiledSamples).includes(false);
});
}

export function getSamplesProfiledStatus(
sampleIds: string[],
genePanelData: IGenePanelDataByProfileIdAndSample,
profileId: string | undefined
) {
const notProfiledIds: string[] = sampleIds.reduce(
(aggr: string[], sampleId: string) => {
const isProfiled = isSampleProfiledInProfile(
genePanelData,
profileId,
sampleId
);
if (!isProfiled) {
aggr.push(sampleId);
}
return aggr;
},
[]
);

const noneProfiled = notProfiledIds.length === sampleIds.length;
const someProfiled = notProfiledIds.length < sampleIds.length;

return {
noneProfiled,
someProfiled,
notProfiledIds,
};
}

This file was deleted.

Loading