Skip to content

Commit

Permalink
Cleanup and fix failing tests
Browse files Browse the repository at this point in the history
Former-commit-id: 714a254b16de0f7d3d885d5692d5606bdd4fedb1
  • Loading branch information
kalletlak committed Nov 6, 2019
1 parent 1d0621b commit b562bf4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 32 deletions.
18 changes: 9 additions & 9 deletions end-to-end-test/remote/specs/core/studyview.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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);
});
Expand Down Expand Up @@ -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();
Expand All @@ -352,16 +352,16 @@ 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);
toStudyViewSummaryTab();
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);
Expand Down
2 changes: 1 addition & 1 deletion env/feature-sv-url.sh
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 4 additions & 9 deletions src/pages/studyView/StudyViewPageStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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[] {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
18 changes: 6 additions & 12 deletions src/pages/studyView/TableUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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]),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/studyView/tabs/SummaryTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b562bf4

Please sign in to comment.