Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
jfkonecn committed Feb 3, 2025
1 parent dc6ba05 commit d414ec9
Show file tree
Hide file tree
Showing 3 changed files with 288 additions and 30 deletions.
60 changes: 32 additions & 28 deletions src/main/webapp/app/pages/annotationPage/AnnotationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from 'app/config/constants';
import styles from 'app/pages/alterationPage/AlterationPage.module.scss';
import { AlterationInfo } from 'app/pages/annotationPage/AlterationInfo';
import { Col, Row, Alert } from 'react-bootstrap';
import { Col, Row, Alert, Container } from 'react-bootstrap';
import classnames from 'classnames';
import { action, computed, observable } from 'mobx';
import * as QueryString from 'querystring';
Expand Down Expand Up @@ -752,33 +752,37 @@ export default class AnnotationPage extends React.Component<
this.props.store.gene.result === DEFAULT_GENE) ? (
<UnknownGeneAlert />
) : (
<>
{this.navBreadcrumbs}
{this.pageShouldBeRendered ? (
this.props.store.annotationData.result.query.hugoSymbol ? (
this.getAnnotationComponents()
) : (
<Alert variant="warning" className={'text-center'}>
We do not have any information for this variant
</Alert>
)
) : (
<If condition={this.props.store.annotationData.isError}>
<Then>
<Alert variant="warning" className={'text-center'}>
An error occurred while annotating your variant.
</Alert>
</Then>
<Else>
<LoadingIndicator
size={LoaderSize.LARGE}
center={true}
isLoading={true}
/>
</Else>
</If>
)}
</>
<Container>
<Row className="justify-content-center">
<Col md={11}>
{this.navBreadcrumbs}
{this.pageShouldBeRendered ? (
this.props.store.annotationData.result.query.hugoSymbol ? (
this.getAnnotationComponents()
) : (
<Alert variant="warning" className={'text-center'}>
We do not have any information for this variant
</Alert>
)
) : (
<If condition={this.props.store.annotationData.isError}>
<Then>
<Alert variant="warning" className={'text-center'}>
An error occurred while annotating your variant.
</Alert>
</Then>
<Else>
<LoadingIndicator
size={LoaderSize.LARGE}
center={true}
isLoading={true}
/>
</Else>
</If>
)}
</Col>
</Row>
</Container>
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
import React from 'react';
import { observer } from 'mobx-react';

import { OncoTreeLink } from 'app/shared/utils/UrlUtils';
import {
ANNOTATION_PAGE_TAB_KEYS,
DEFAULT_MARGIN_BOTTOM_LG,
OTHER_BIOMARKERS,
} from 'app/config/constants';
import styles from 'app/pages/alterationPage/AlterationPage.module.scss';
import InfoIcon from 'app/shared/icons/InfoIcon';
import { Col, Row } from 'react-bootstrap';
import classnames from 'classnames';
import { action, computed } from 'mobx';
import autobind from 'autobind-decorator';
import {
BiologicalVariant,
VariantAnnotation,
} from 'app/shared/api/generated/OncoKbPrivateAPI';
import {
FdaImplication,
TherapeuticImplication,
} from 'app/store/AnnotationStore';
import { isCategoricalAlteration } from 'app/shared/utils/Utils';
import CancerTypeSelect from 'app/shared/dropdown/CancerTypeSelect';
import AlterationTableTabs from 'app/pages/annotationPage/AlterationTableTabs';
import { getSummaries, SummaryKey } from 'app/pages/annotationPage/Utils';
import AppStore from 'app/store/AppStore';
import { Alteration } from 'app/shared/api/generated/OncoKbAPI';

export type IAlterationView = {
appStore?: AppStore;
hugoSymbol: string;
alteration: string;
matchedAlteration: Alteration | undefined;
tumorType: string;
onChangeTumorType: (newTumorType: string) => void;
annotation: VariantAnnotation;
biologicalAlterations?: BiologicalVariant[];
relevantAlterations?: Alteration[];
fdaImplication: FdaImplication[];
therapeuticImplications: TherapeuticImplication[];
diagnosticImplications: TherapeuticImplication[];
prognosticImplications: TherapeuticImplication[];
defaultSelectedTab?: ANNOTATION_PAGE_TAB_KEYS;
onChangeTab?: (
selectedTabKey: ANNOTATION_PAGE_TAB_KEYS,
newTabKey: ANNOTATION_PAGE_TAB_KEYS
) => void;
};
@observer
export default class SomaticGermlineAlterationView extends React.Component<
IAlterationView,
{}
> {
@autobind
@action
updateTumorTypeQuery(selectedOption: any) {
this.props.onChangeTumorType(selectedOption ? selectedOption.value : '');
}

@computed
get tumorTypeSummaries() {
const orderedSummaries = this.props.tumorType
? [
SummaryKey.TUMOR_TYPE_SUMMARY,
SummaryKey.DIAGNOSTIC_SUMMARY,
SummaryKey.PROGNOSTIC_SUMMARY,
]
: [];
return getSummaries(this.props.annotation, orderedSummaries);
}

@computed get isCategoricalAlteration() {
return isCategoricalAlteration(this.props.alteration);
}

@computed
get showGeneNameLink() {
const lHugo = this.props.hugoSymbol.toLowerCase();
const altNameIncludesGene = this.props.alteration
.toLowerCase()
.includes(lHugo);
const isOtherBiomarkers = lHugo === OTHER_BIOMARKERS.toLowerCase();
return !altNameIncludesGene && !isOtherBiomarkers;
}

@computed
get relevantBiologicalVariants(): BiologicalVariant[] {
if (
this.isCategoricalAlteration &&
this.props.biologicalAlterations &&
this.props.relevantAlterations
) {
const relevantAltNames = this.props.relevantAlterations.map(
alt => alt.alteration
);
return this.props.biologicalAlterations.filter(variant =>
relevantAltNames.includes(variant.variant.alteration)
);
} else {
return [];
}
}

render() {
const dropdownColor = '#0968C3';
return (
<>
<Row className="mt-4">
<Col>
<div
className={classnames(
'd-flex',
'align-items-center',
'justify-content-left',
'flex-wrap',
DEFAULT_MARGIN_BOTTOM_LG
)}
>
<span className={classnames('mr-3', 'h6')}>
Filter this list by:
</span>
<span
className={classnames(styles.headerTumorTypeSelection, 'mr-2')}
>
<span>
<CancerTypeSelect
styles={{
control: base => ({
...base,
height: '30px',
minHeight: '30px',
borderBottomWidth: '1px',
borderBottomColor: dropdownColor,
borderStyle: 'none',
borderBottomStyle: 'solid',
borderRadius: '0px',
'&:hover': {
borderBottomColor: dropdownColor,
},
}),
indicatorsContainer: base => ({
...base,
'& div': {
color: dropdownColor,
},
'& div:hover': {
color: dropdownColor,
},
}),
indicatorSeparator: base => ({
...base,
width: '0px',
}),
dropdownIndicator: base => ({
...base,
padding: 4,
}),
clearIndicator: base => ({
...base,
padding: 4,
}),
valueContainer: base => ({
...base,
padding: '0px 6px',
}),
input: base => ({
...base,
margin: 0,
padding: 0,
}),
menu: base => ({ ...base, zIndex: 10 }),
}}
cancerType={this.props.tumorType}
onChange={(selectedOption: any) =>
this.updateTumorTypeQuery(selectedOption)
}
/>
</span>
</span>
<InfoIcon
overlay={
<span>
For cancer type specific information, please select a cancer
type from the dropdown. The cancer type is curated using{' '}
<OncoTreeLink />
</span>
}
placement="top"
/>
</div>
</Col>
</Row>
{this.props.tumorType && !this.isCategoricalAlteration ? (
<Row>
<Col>
{this.tumorTypeSummaries.map((summary, index) => {
return (
<div
className={DEFAULT_MARGIN_BOTTOM_LG}
key={`summary-${index}`}
>
<h6 className={'mb-0'}>{summary.title}</h6>
{summary.content}
</div>
);
})}
</Col>
</Row>
) : null}
<Row className="mt-2">
<Col>
<AlterationTableTabs
selectedTab={this.props.defaultSelectedTab}
appStore={this.props.appStore}
hugoSymbol={this.props.hugoSymbol}
alteration={
this.props.matchedAlteration
? {
alteration: this.props.matchedAlteration.alteration,
name: this.props.matchedAlteration.name,
}
: {
alteration: this.props.alteration,
name: this.props.alteration,
}
}
cancerType={this.props.tumorType}
biological={[]}
tx={this.props.therapeuticImplications}
dx={this.props.diagnosticImplications}
px={this.props.prognosticImplications}
fda={this.props.fdaImplication}
onChangeTab={this.props.onChangeTab}
/>
</Col>
</Row>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ import {
COLOR_ICON_WITH_INFO,
COLOR_ICON_WITHOUT_INFO,
} from 'app/config/theme';
import SomaticGermlineAlterationView from '../annotationPage/SomaticGermlineAlterationView';

function OncogenicInfo({
isUnknownOncogenicity,
Expand Down Expand Up @@ -771,6 +772,11 @@ export class SomaticGermlineAlterationPage extends React.Component<
[
{
title: 'Therapeutic',
show:
!!this.store.geneNumber.result
.highestSensitiveLevel ||
!!this.store.geneNumber.result
.highestResistanceLevel,
value: (
<div
className={classNames('d-flex', 'flex-row')}
Expand All @@ -794,6 +800,8 @@ export class SomaticGermlineAlterationPage extends React.Component<
},
{
title: 'Diagnostic',
show: !!this.store.geneNumber.result
.highestDiagnosticImplicationLevel,
value: (
<HighestLevelEvidence
type="DiagnosticImplication"
Expand All @@ -808,6 +816,8 @@ export class SomaticGermlineAlterationPage extends React.Component<
[
{
title: 'Prognostic',
show: !!this.store.geneNumber.result
.highestPrognosticImplicationLevel,
value: (
<HighestLevelEvidence
type="PrognosticImplication"
Expand All @@ -820,6 +830,8 @@ export class SomaticGermlineAlterationPage extends React.Component<
},
{
title: 'FDA',
show: !!this.store.geneNumber.result
.highestFdaLevel,
value: (
<HighestLevelEvidence
type="Fda"
Expand Down Expand Up @@ -848,7 +860,7 @@ export class SomaticGermlineAlterationPage extends React.Component<
isPending={this.store.genomicIndicators.isPending}
/>
<MiniNavBarHeader id="clinical-implications">
Clinical Implications
Clinical Implications For This Biomarker
</MiniNavBarHeader>
{this.store.cancerTypeName ? (
<CancerTypeView
Expand All @@ -875,7 +887,7 @@ export class SomaticGermlineAlterationPage extends React.Component<
onChangeTab={this.onChangeTab}
/>
) : (
<AlterationView
<SomaticGermlineAlterationView
appStore={this.props.appStore}
hugoSymbol={this.store.hugoSymbol}
alteration={this.store.alterationName}
Expand Down

0 comments on commit d414ec9

Please sign in to comment.