From b562bf45582d3d52ee7e23a92a50716b77e709bd Mon Sep 17 00:00:00 2001 From: Karthik Kalletla Date: Mon, 4 Nov 2019 10:33:25 -0500 Subject: [PATCH] Cleanup and fix failing tests Former-commit-id: 714a254b16de0f7d3d885d5692d5606bdd4fedb1 --- .../remote/specs/core/studyview.spec.js | 18 +++++++++--------- env/feature-sv-url.sh | 2 +- src/pages/studyView/StudyViewPageStore.ts | 13 ++++--------- src/pages/studyView/TableUtils.tsx | 18 ++++++------------ src/pages/studyView/tabs/SummaryTab.tsx | 2 +- 5 files changed, 21 insertions(+), 32 deletions(-) diff --git a/end-to-end-test/remote/specs/core/studyview.spec.js b/end-to-end-test/remote/specs/core/studyview.spec.js index 150b446bac0..4e2b4c93d56 100644 --- a/end-to-end-test/remote/specs/core/studyview.spec.js +++ b/end-to-end-test/remote/specs/core/studyview.spec.js @@ -104,8 +104,8 @@ describe('study laml_tcga tests', () => { browser.pause(); browser.click("[data-test='add-chart-option-other-sample-id'] input"); - browser.waitForVisible("[data-test='chart-container-SAMPLE_OTHER_SAMPLE_ID']", WAIT_FOR_VISIBLE_TIMEOUT); - const res = browser.checkElement("[data-test='chart-container-SAMPLE_OTHER_SAMPLE_ID']"); + browser.waitForVisible("[data-test='chart-container-OTHER_SAMPLE_ID']", WAIT_FOR_VISIBLE_TIMEOUT); + const res = browser.checkElement("[data-test='chart-container-OTHER_SAMPLE_ID']"); assertScreenShotMatch(res); }); @@ -229,7 +229,7 @@ describe('add chart should not be shown in other irrelevant tabs', () => { describe('check the filters are working properly', ()=>{ before(function() { - const url = `${CBIOPORTAL_URL}/study?id=laml_tcga&filters=%7B%22clinicalDataEqualityFilters%22%3A%20%5B%7B%22attributeId%22%3A%20%22SEX%22%2C%22values%22%3A%20%5B%22Female%22%5D%7D%5D%2C%22clinicalDataIntervalFilters%22%3A%20%5B%7B%22attributeId%22%3A%20%22AGE%22%2C%22values%22%3A%20%5B%7B%22start%22%3A%2025%2C%22end%22%3A%2030%7D%2C%20%7B%22start%22%3A%2030%2C%22end%22%3A%2035%7D%2C%20%7B%22start%22%3A%2035%2C%22end%22%3A%2040%7D%2C%20%7B%22start%22%3A%2040%2C%22end%22%3A%2045%7D%2C%20%7B%22start%22%3A%2045%2C%22end%22%3A%2050%7D%2C%20%7B%22start%22%3A%2050%2C%22end%22%3A%2055%7D%2C%20%7B%22start%22%3A%2055%2C%22end%22%3A%2060%7D%2C%20%7B%22start%22%3A%2060%2C%22end%22%3A%2065%7D%2C%20%7B%22start%22%3A%2065%2C%22end%22%3A%2070%7D%2C%20%7B%22start%22%3A%2070%2C%22end%22%3A%2075%7D%2C%20%7B%22start%22%3A%2075%2C%22end%22%3A%2080%7D%5D%7D%5D%2C%22mutatedGenes%22%3A%20%5B%7B%22hugoGeneSymbols%22%3A%20%5B2322%2C%204869%5D%7D%5D%2C%22cnaGenes%22%3A%20%5B%7B%22alterations%22%3A%20%5B%7B%22alteration%22%3A%20-2%2C%22hugoGeneSymbol%22%3A%202521%7D%2C%20%7B%22alteration%22%3A%202%2C%22hugoGeneSymbol%22%3A%204297%7D%5D%7D%5D%7D`; + const url = `${CBIOPORTAL_URL}/study?id=laml_tcga&filters=%7B%22clinicalDataEqualityFilters%22%3A%20%5B%7B%22attributeId%22%3A%20%22SEX%22%2C%22values%22%3A%20%5B%22Female%22%5D%7D%5D%2C%22clinicalDataIntervalFilters%22%3A%20%5B%7B%22attributeId%22%3A%20%22AGE%22%2C%22values%22%3A%20%5B%7B%22start%22%3A%2025%2C%22end%22%3A%2030%7D%2C%20%7B%22start%22%3A%2030%2C%22end%22%3A%2035%7D%2C%20%7B%22start%22%3A%2035%2C%22end%22%3A%2040%7D%2C%20%7B%22start%22%3A%2040%2C%22end%22%3A%2045%7D%2C%20%7B%22start%22%3A%2045%2C%22end%22%3A%2050%7D%2C%20%7B%22start%22%3A%2050%2C%22end%22%3A%2055%7D%2C%20%7B%22start%22%3A%2055%2C%22end%22%3A%2060%7D%2C%20%7B%22start%22%3A%2060%2C%22end%22%3A%2065%7D%2C%20%7B%22start%22%3A%2065%2C%22end%22%3A%2070%7D%2C%20%7B%22start%22%3A%2070%2C%22end%22%3A%2075%7D%2C%20%7B%22start%22%3A%2075%2C%22end%22%3A%2080%7D%5D%7D%5D%2C%22mutatedGenes%22%3A%20%5B%7B%22hugoGeneSymbols%22%3A%20%5B%22FLT3%22%2C%20%22NPM1%22%5D%7D%5D%2C%22cnaGenes%22%3A%20%5B%7B%22alterations%22%3A%20%5B%7B%22alteration%22%3A%20-2%2C%22hugoGeneSymbol%22%3A%20%22FUS%22%7D%2C%20%7B%22alteration%22%3A%202%2C%22hugoGeneSymbol%22%3A%20%22KMT2A%22%7D%5D%7D%5D%7D`; goToUrlAndSetLocalStorage(url); waitForNetworkQuiet(60000); }); @@ -274,7 +274,7 @@ describe('check the filters are working properly', ()=>{ describe('check the fusion filter is working properly', ()=>{ before(function() { - const url = `${CBIOPORTAL_URL}/study/summary?filters=%7B%2522fusionGenes%2522%3A%5B%7B%2522hugoGeneSymbols%2522%3A%5B2313%5D%7D%5D%7D&id=es_dfarber_broad_2014`; + const url = `${CBIOPORTAL_URL}/study/summary?id=es_dfarber_broad_2014&filters=%7B%22fusionGenes%22%3A%20%5B%7B%22hugoGeneSymbols%22%3A%20%5B%22FLI1%22%5D%7D%5D%7D`; goToUrlAndSetLocalStorage(url); waitForNetworkQuiet(60000); }); @@ -340,9 +340,9 @@ describe('crc_msk_2017 study tests', () => { browser.waitForVisible(ADD_CHART_BUTTON, WAIT_FOR_VISIBLE_TIMEOUT); browser.click(ADD_CHART_BUTTON); - browser.waitForVisible("[data-test='chart-container-SAMPLE_MSI_SCORE']", WAIT_FOR_VISIBLE_TIMEOUT); + browser.waitForVisible("[data-test='chart-container-MSI_SCORE']", WAIT_FOR_VISIBLE_TIMEOUT); - const res = checkElementWithMouseDisabled("[data-test='chart-container-SAMPLE_MSI_SCORE'] svg"); + const res = checkElementWithMouseDisabled("[data-test='chart-container-MSI_SCORE'] svg"); assertScreenShotMatch(res); toStudyViewClinicalDataTab(); @@ -352,8 +352,8 @@ describe('crc_msk_2017 study tests', () => { }); describe('study view lgg_tcga study tests', () => { - const pieChart = "[data-test='chart-container-PATIENT_SEX']"; - const table = "[data-test='chart-container-SAMPLE_CANCER_TYPE_DETAILED']"; + const pieChart = "[data-test='chart-container-SEX']"; + const table = "[data-test='chart-container-CANCER_TYPE_DETAILED']"; before(() => { const url = `${CBIOPORTAL_URL}/study?id=lgg_tcga`; goToUrlAndSetLocalStorage(url); @@ -361,7 +361,7 @@ describe('study view lgg_tcga study tests', () => { waitForNetworkQuiet(); }); describe('bar chart', () => { - const barChart = "[data-test='chart-container-SAMPLE_DAYS_TO_COLLECTION']"; + const barChart = "[data-test='chart-container-DAYS_TO_COLLECTION']"; it('the log scale should be used for Sample Collection', () => { browser.waitForVisible(barChart, WAIT_FOR_VISIBLE_TIMEOUT); browser.moveToObject(barChart); diff --git a/env/feature-sv-url.sh b/env/feature-sv-url.sh index d03e437437c..a87bcac000d 100644 --- a/env/feature-sv-url.sh +++ b/env/feature-sv-url.sh @@ -1,2 +1,2 @@ -export CBIOPORTAL_URL="https://cbioportal-feature-sv-u-o2unal.herokuapp.com" +export CBIOPORTAL_URL="https://beta.cbioportal.org" export GENOME_NEXUS_URL="https://www.genomenexus.org" \ No newline at end of file diff --git a/src/pages/studyView/StudyViewPageStore.ts b/src/pages/studyView/StudyViewPageStore.ts index 53007385ae8..0698a5e21b4 100644 --- a/src/pages/studyView/StudyViewPageStore.ts +++ b/src/pages/studyView/StudyViewPageStore.ts @@ -128,7 +128,6 @@ import {DataType} from "public-lib/components/downloadControls/DownloadControls" import { AppStore } from 'AppStore'; import { getCnaUniqueKey, - getMutationUniqueKey, parseCnaUniqueKey } from "pages/studyView/TableUtils"; import { GeneTableRow } from './table/GeneTable'; @@ -228,10 +227,6 @@ export type CustomChartIdentifierWithValue = CustomChartIdentifier & { value: string } -export type CopyNumberAlterationIdentifier = CopyNumberGeneFilterElement & { - hugoGeneSymbol: string -} - export type StatusMessage = { status: 'success' | 'warning' | 'danger' | 'info', message: string @@ -1573,7 +1568,7 @@ export class StudyViewPageStore { } public getCNAGenesTableFilters() { - return _.flatMap(this._cnaGeneFilter, filter => filter.alterations); + return _.flatMap(this._cnaGeneFilter, filter => filter.alterations).map(alteration => getCnaUniqueKey(alteration.hugoGeneSymbol, alteration.alteration)); } public getClinicalDataFiltersByUniqueKey(uniqueKey: string): string[] { @@ -3049,7 +3044,7 @@ export class StudyViewPageStore { return mutatedGenes.map(item => { return { ...item, - uniqueKey: getMutationUniqueKey(item.entrezGeneId, item.hugoGeneSymbol), + uniqueKey: item.hugoGeneSymbol, oncokbAnnotated: this.oncokbCancerGeneFilterEnabled ? this.oncokbAnnotatedGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbOncogene: this.oncokbCancerGeneFilterEnabled ? this.oncokbOncogeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbTumorSuppressorGene: this.oncokbCancerGeneFilterEnabled ? this.oncokbTumorSuppressorGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, @@ -3077,7 +3072,7 @@ export class StudyViewPageStore { return fusionGenes.map(item => { return { ...item, - uniqueKey: getMutationUniqueKey(item.entrezGeneId, item.hugoGeneSymbol), + uniqueKey: item.hugoGeneSymbol, oncokbAnnotated: this.oncokbCancerGeneFilterEnabled ? this.oncokbAnnotatedGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbOncogene: this.oncokbCancerGeneFilterEnabled ? this.oncokbOncogeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbTumorSuppressorGene: this.oncokbCancerGeneFilterEnabled ? this.oncokbTumorSuppressorGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, @@ -3105,7 +3100,7 @@ export class StudyViewPageStore { return cnaGenes.map(item => { return { ...item, - uniqueKey: getCnaUniqueKey(item.entrezGeneId, item.hugoGeneSymbol, item.alteration), + uniqueKey: getCnaUniqueKey(item.hugoGeneSymbol, item.alteration), oncokbAnnotated: this.oncokbCancerGeneFilterEnabled ? this.oncokbAnnotatedGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbOncogene: this.oncokbCancerGeneFilterEnabled ? this.oncokbOncogeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, isOncokbTumorSuppressorGene: this.oncokbCancerGeneFilterEnabled ? this.oncokbTumorSuppressorGeneEntrezGeneIds.result.includes(item.entrezGeneId) : false, diff --git a/src/pages/studyView/TableUtils.tsx b/src/pages/studyView/TableUtils.tsx index 651dee4d6f5..fb75e2719a7 100644 --- a/src/pages/studyView/TableUtils.tsx +++ b/src/pages/studyView/TableUtils.tsx @@ -7,11 +7,9 @@ import {ICON_FILTER_OFF, ICON_FILTER_ON} from "shared/lib/Colors"; import {GenePanelList} from "pages/studyView/table/GenePanelModal"; import {getFrequencyStr} from "pages/studyView/StudyViewUtils"; import {CSSProperties} from "react"; -import { - CopyNumberAlterationIdentifier -} from "pages/studyView/StudyViewPageStore"; import * as _ from "lodash"; import {GeneTableUserSelectionWithIndex} from "pages/studyView/table/GeneTable"; +import { CopyNumberGeneFilterElement } from 'shared/api/generated/CBioPortalAPIInternal'; export type AlteredGenesTableUserSelectionWithIndex = { entrezGeneId: number; @@ -21,20 +19,16 @@ export type AlteredGenesTableUserSelectionWithIndex = { const UNIQUE_KEY_SEPARATOR = '*'; -export function getMutationUniqueKey(entrezGeneId: number, hugoGeneSymbol: string) { - return [entrezGeneId, hugoGeneSymbol].join(UNIQUE_KEY_SEPARATOR); +export function getCnaUniqueKey(hugoGeneSymbol: string, alteration: number) { + return [hugoGeneSymbol, alteration].join(UNIQUE_KEY_SEPARATOR); } -export function getCnaUniqueKey(entrezGeneId: number, hugoGeneSymbol: string, alteration: number) { - return [entrezGeneId, hugoGeneSymbol, alteration].join(UNIQUE_KEY_SEPARATOR); -} - -export function parseCnaUniqueKey(uniqueKey: string): CopyNumberAlterationIdentifier { +export function parseCnaUniqueKey(uniqueKey: string): CopyNumberGeneFilterElement { const parts = uniqueKey.split(UNIQUE_KEY_SEPARATOR); return { - hugoGeneSymbol: parts[1], - alteration: Number(parts[2]), + hugoGeneSymbol: parts[0], + alteration: Number(parts[1]), } } diff --git a/src/pages/studyView/tabs/SummaryTab.tsx b/src/pages/studyView/tabs/SummaryTab.tsx index b811c407185..a47bb634bec 100644 --- a/src/pages/studyView/tabs/SummaryTab.tsx +++ b/src/pages/studyView/tabs/SummaryTab.tsx @@ -3,7 +3,7 @@ import styles from "./studySummaryTabStyles.module.scss"; import chartHeaderStyles from "../chartHeader/styles.module.scss"; import {ChartContainer, IChartContainerProps} from 'pages/studyView/charts/ChartContainer'; import {observable} from 'mobx'; -import {CopyNumberAlterationIdentifier, StudyViewPageStore} from 'pages/studyView/StudyViewPageStore'; +import {StudyViewPageStore} from 'pages/studyView/StudyViewPageStore'; import {SampleIdentifier} from 'shared/api/generated/CBioPortalAPI'; import { ClinicalDataIntervalFilterValue,