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 mutations table and fisher exact two-sided p value to comparison lollipop #4556

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,21 @@ describe('group comparison page screenshot tests', function() {
);
assertScreenShotMatch(res);
});

it('group comparison page mutations tab two groups', function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.borderedChart svg').waitForDisplayed({ timeout: 20000 });
var res = browser.checkElement(
'[data-test="ComparisonPageMutationsTabPlot"]',
'',
{
viewportChangePause: 4000,
}
); // hide these things because the timing of data loading makes this test so flaky
assertScreenShotMatch(res);
});
});

describe('delete group from session', function() {
Expand Down
178 changes: 177 additions & 1 deletion end-to-end-test/remote/specs/core/groupComparisonLollipop.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ var goToUrlAndSetLocalStorage = require('../../../shared/specUtils')
var setInputText = require('../../../shared/specUtils').setInputText;
var setSettingsMenuOpen = require('../../../shared/specUtils')
.setSettingsMenuOpen;
const { getElementByTestHandle } = require('../../../shared/specUtils');
const {
jsApiHover,
getElementByTestHandle,
} = require('../../../shared/specUtils');

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

Expand Down Expand Up @@ -815,4 +818,177 @@ describe('group comparison mutations tab tests', function() {
);
});
});

describe('displaying fisher exact test label', function() {
before(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('fisher test text and tooltip dynamically changes when filtering and selecting', function() {
// filter value
getElementByTestHandle('missense_putative_driver_only').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for filtered mutations - (A) Metastasis vs (B) Primary: 4.21e-8'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'3 patients have more than one mutation in AR'
);

// select value
$('.lollipop-3').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for selected mutations - (A) Metastasis vs (B) Primary: 0.0305'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'1 patient has more than one mutation in AR'
);

// default value
$('button=Remove filter').click();

assert.equal(
getElementByTestHandle('fisherTestLabel').getText(),
'Fisher Exact Two-Sided Test p-value for all mutations - (A) Metastasis vs (B) Primary: 7.200e-6'
);

jsApiHover(getElementByTestHandle('infoIcon'));

getElementByTestHandle(
'patientMultipleMutationsMessage'
).waitForExist();
assert.equal(
getElementByTestHandle(
'patientMultipleMutationsMessage'
).getText(),
'4 patients have more than one mutation in AR'
);
});
});

describe('displaying table header and pagination status text', function() {
before(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('displays correct text and number of mutations and protein changes when filtering and selecting', function() {
// filter value
$('strong=Inframe').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'14 Mutations (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-14 of 14 Mutations'
);

// select value
$('.lollipop-1').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'1 Mutation (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-1 of 1 Mutation'
);

// default value
$('button=Remove filter').click();

assert.equal(
getElementByTestHandle('LazyMobXTable_CountHeader').getText(),
'16 Mutations (page 1 of 1)'
);

assert.equal(
$('.topPagination').getText(),
'Showing 1-16 of 16 Mutations'
);
});
});

describe('mutation table filtering options', function() {
beforeEach(function() {
goToUrlAndSetLocalStorage(
`${CBIOPORTAL_URL}/comparison/mutations?sessionId=5cf89323e4b0ab413787436c&selectedGene=AR`
);
$('.lollipop-svgnode').waitForDisplayed({
timeout: 30000,
});
});

it('filters table with search box', () => {
var searchInput = '[data-test=table-search-input]';
var numberOfRowsBefore = $$('tr').length;
$(searchInput).setValue('w7');
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with enriched in dropdown', () => {
var numberOfRowsBefore = $$('tr').length;
getElementByTestHandle('enrichedInDropdown').click();
$('#react-select-6-option-0-0').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with significant only checkbox', () => {
var numberOfRowsBefore = $$('tr').length;
getElementByTestHandle('significantOnlyCheckbox').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with protein badge filtering', () => {
var numberOfRowsBefore = $$('tr').length;
$('strong=Missense').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});

it('filters table with lollipop selection', () => {
var numberOfRowsBefore = $$('tr').length;
$('.lollipop-1').click();
browser.waitUntil(() => $$('tr').length < numberOfRowsBefore);
assert($$('tr').length < numberOfRowsBefore);
});
});
});
2 changes: 2 additions & 0 deletions packages/oncokb-frontend-commons/src/components/OncoKB.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export interface IOncoKbProps {
userDisplayName?: string;
disableFeedback?: boolean;
contentPadding?: number;
hasMultipleCancerTypes?: boolean;
}

export function sortValue(
Expand Down Expand Up @@ -213,6 +214,7 @@ function tooltipContent(
handleFeedbackOpen={
props.disableFeedback ? undefined : handleFeedbackOpen
}
hasMultipleCancerTypes={props.hasMultipleCancerTypes}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type OncoKbCardProps = {
indicator?: IndicatorQueryResp;
displayHighestLevelInTabTitle?: boolean;
handleFeedbackOpen?: React.EventHandler<any>;
hasMultipleCancerTypes?: boolean;
};

export const OncoKbCard: React.FunctionComponent<OncoKbCardProps> = (
Expand Down Expand Up @@ -51,6 +52,7 @@ export const OncoKbCard: React.FunctionComponent<OncoKbCardProps> = (
? props.indicator.query.tumorType
: ''
}
displayCancerTypeInTitle={!props.hasMultipleCancerTypes}
/>
)}
<OncoKbCardBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type OncoKbCardDefaultTitleProps = {
hugoSymbol: string;
variant: string;
tumorType: string;
displayCancerTypeInTitle?: boolean;
};

export const OncoKbCardTitle: React.FunctionComponent<OncoKbCardDefaultTitleProps> = (
Expand All @@ -22,7 +23,7 @@ export const OncoKbCardTitle: React.FunctionComponent<OncoKbCardDefaultTitleProp
if (props.variant) {
titleContent.push(props.variant);
}
if (props.tumorType) {
if (props.tumorType && props.displayCancerTypeInTitle) {
if (titleContent.length > 0) {
titleContent.push('in');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface IOncoKbTooltipProps {
isCancerGene: boolean;
geneNotExist: boolean;
usingPublicOncoKbInstance: boolean;
hasMultipleCancerTypes?: boolean;
}

export const OncoKbTooltip: React.FunctionComponent<IOncoKbTooltipProps> = (
Expand Down Expand Up @@ -48,6 +49,7 @@ export const OncoKbTooltip: React.FunctionComponent<IOncoKbTooltipProps> = (
indicator={props.indicator}
handleFeedbackOpen={props.handleFeedbackOpen}
displayHighestLevelInTabTitle={true}
hasMultipleCancerTypes={props.hasMultipleCancerTypes}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export type AnnotationProps = {
{ [genomicLocation: string]: VariantAnnotation } | undefined
>;
userDisplayName?: string;
hasMultipleCancerTypes?: boolean;
};

export type GenericAnnotationProps = {
Expand All @@ -79,6 +80,7 @@ export type GenericAnnotationProps = {
oncoKbContentPadding?: number;
pubMedCache?: MobxCache;
userDisplayName?: string;
hasMultipleCancerTypes?: boolean;
};

export interface IAnnotation {
Expand Down Expand Up @@ -326,6 +328,7 @@ export function GenericAnnotation(props: GenericAnnotationProps): JSX.Element {
userDisplayName,
mergeOncoKbIcons,
oncoKbContentPadding,
hasMultipleCancerTypes,
} = props;

return (
Expand All @@ -344,6 +347,7 @@ export function GenericAnnotation(props: GenericAnnotationProps): JSX.Element {
mergeAnnotationIcons={mergeOncoKbIcons}
userDisplayName={userDisplayName}
contentPadding={oncoKbContentPadding}
hasMultipleCancerTypes={hasMultipleCancerTypes}
/>
)}
{/* only show reVUE when reVUE is enabled and there are reVUE mutations in the query */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class PercentToggle extends React.Component<IPercentToggleProps, {}> {
<div
style={{
marginLeft: 10,
marginRight: 10,
}}
>
<div style={{ textAlign: 'center' }}>Y-Axis:</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styles from './filterResetPanel.module.scss';
type FilterResetPanelProps = {
resetFilters: () => void;
filterInfo?: JSX.Element | string;
additionalInfo?: JSX.Element | string;
className?: string;
buttonText?: string;
buttonClass?: string;
Expand Down Expand Up @@ -34,14 +35,16 @@ export class FilterResetPanel extends React.Component<
data-test="filter-reset-panel"
>
<span style={{ verticalAlign: 'middle' }}>
{this.props.filterInfo}
<strong>{this.props.filterInfo}</strong>
<button
className={this.props.buttonClass}
style={{ cursor: 'pointer', marginLeft: 6 }}
onClick={this.props.resetFilters}
>
{this.props.buttonText}
</button>
<br />
{this.props.additionalInfo}
</span>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { DataFilter } from '../model/DataFilter';

export type ProteinChangeFilter = DataFilter<string>;
1 change: 1 addition & 0 deletions packages/react-mutation-mapper/src/model/DataFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export enum DataFilterType {
CANCER_TYPE = 'cancerType',
PROTEIN_IMPACT_TYPE = 'proteinImpactType',
MUTATION_STATUS = 'mutationStatus',
PROTEIN_CHANGE = 'proteinChange',
}

export type DataFilter<T = any> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ import {
applyDefaultMutationFilter,
applyDefaultMutationStatusFilter,
applyDefaultPositionFilter,
applyDefaultProteinChangeFilter,
applyDefaultProteinImpactTypeFilter,
} from '../util/FilterUtils';
import { defaultOncoKbFilter } from 'oncokb-frontend-commons';
import { ProteinChangeFilter } from '../filter/ProteinChangeFilter';

export class DefaultMutationMapperFilterApplier implements FilterApplier {
protected get customFilterAppliers(): {
Expand All @@ -36,6 +38,7 @@ export class DefaultMutationMapperFilterApplier implements FilterApplier {
[DataFilterType.PROTEIN_IMPACT_TYPE]: this
.applyProteinImpactTypeFilter,
[DataFilterType.MUTATION_STATUS]: this.applyMutationStatusFilter,
[DataFilterType.PROTEIN_CHANGE]: this.applyProteinChangeFilter,
...this.filterAppliersOverride,
};
}
Expand Down Expand Up @@ -112,6 +115,14 @@ export class DefaultMutationMapperFilterApplier implements FilterApplier {
) {
return applyDefaultMutationStatusFilter(filter, mutation);
}

@autobind
alisman marked this conversation as resolved.
Show resolved Hide resolved
protected applyProteinChangeFilter(
filter: ProteinChangeFilter,
mutation: Mutation
) {
return applyDefaultProteinChangeFilter(filter, mutation);
}
}

export default DefaultMutationMapperFilterApplier;
Loading