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

Remove certain annotations for germline mutations #94

Merged
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
3 changes: 2 additions & 1 deletion src/components/ColumnHeaderHelper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import {ColumnHeader} from "react-mutation-mapper";
import {ColumnHeader, MutationColumn} from "react-mutation-mapper";

export enum ColumnId {
HUGO_SYMBOL = "hugoSymbol",
Expand Down Expand Up @@ -56,4 +56,5 @@ export const HEADER_COMPONENT: {[id: string] : JSX.Element} = {
/>
),
[ColumnId.SAMPLE_COUNT]: <ColumnHeader headerContent={<span className="text-wrap"># Samples</span>} />,
[MutationColumn.ANNOTATION]: <ColumnHeader headerContent={<span className="pull-left">Somatic Annotation</span>} />,
};
26 changes: 25 additions & 1 deletion src/components/ColumnRenderHelper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {SignalMutationStatus} from "cbioportal-utils";
import * as React from "react";
import {Hgvsg} from "react-mutation-mapper";
import {Hgvsg, MutationStatus} from "react-mutation-mapper";
import {Link} from "react-router-dom";

import {FrequencyCell} from "cbioportal-frontend-commons";
Expand Down Expand Up @@ -39,4 +40,27 @@ export function renderHgvsg(cellProps: any)
disableTooltip={true}
/>
);
}

export function renderMutationStatus(cellProps: any)
{
return (
<MutationStatus
value={cellProps.value}
enableTooltip={false}
displayValueMap={{
[SignalMutationStatus.SOMATIC.toLowerCase()]:
SignalMutationStatus.SOMATIC,
[SignalMutationStatus.PATHOGENIC_GERMLINE.toLowerCase()]:
SignalMutationStatus.PATHOGENIC_GERMLINE,
[SignalMutationStatus.BENIGN_GERMLINE.toLowerCase()]:
SignalMutationStatus.BENIGN_GERMLINE,
}}
styleMap={{
[SignalMutationStatus.PATHOGENIC_GERMLINE.toLowerCase()]: {
background: "#FFA963"
}
}}
/>
);
}
52 changes: 31 additions & 21 deletions src/components/MutationMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {computed} from "mobx";
import {observer} from "mobx-react";
import * as React from "react";
import {
Annotation,
CancerTypeFilter,
ColumnSortDirection,
DataFilter,
DataFilterType,
defaultSortMethod,
MUTATION_COLUMNS_DEFINITION,
MutationColumn,
MutationStatus,
ProteinChange,
TrackName
} from "react-mutation-mapper";
Expand All @@ -45,7 +45,7 @@ import {
} from "../util/MutationDataUtils";
import {loaderWithText} from "../util/StatusHelper";
import {ColumnId, HEADER_COMPONENT} from "./ColumnHeaderHelper";
import {renderCancerType, renderHgvsg, renderPenetrance, renderPercentage} from "./ColumnRenderHelper";
import {renderCancerType, renderHgvsg, renderMutationStatus, renderPenetrance, renderPercentage} from "./ColumnRenderHelper";
import {sortPenetrance} from "./GeneFrequencyTable";
import MutationTumorTypeFrequencyDecomposition from "./MutationTumorTypeFrequencyDecomposition";
import SignalMutationMapper from "./SignalMutationMapper";
Expand Down Expand Up @@ -184,24 +184,7 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
...MUTATION_COLUMNS_DEFINITION[MutationColumn.MUTATION_STATUS],
accessor: mutationStatusAccessor,
width: 200,
Cell: (column: any) =>
<MutationStatus
value={column.value}
enableTooltip={false}
displayValueMap={{
[SignalMutationStatus.SOMATIC.toLowerCase()]:
SignalMutationStatus.SOMATIC,
[SignalMutationStatus.PATHOGENIC_GERMLINE.toLowerCase()]:
SignalMutationStatus.PATHOGENIC_GERMLINE,
[SignalMutationStatus.BENIGN_GERMLINE.toLowerCase()]:
SignalMutationStatus.BENIGN_GERMLINE,
}}
styleMap={{
[SignalMutationStatus.PATHOGENIC_GERMLINE.toLowerCase()]: {
background: "#FFA963"
}
}}
/>
Cell: renderMutationStatus
},
{
id: ColumnId.PENETRANCE,
Expand Down Expand Up @@ -241,7 +224,14 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
Header: HEADER_COMPONENT[ColumnId.PERCENT_BIALLELIC],
sortMethod: defaultSortMethod
},
MUTATION_COLUMNS_DEFINITION[MutationColumn.ANNOTATION],
{
...MUTATION_COLUMNS_DEFINITION[MutationColumn.ANNOTATION],
Header: HEADER_COMPONENT[MutationColumn.ANNOTATION],
Cell: this.renderAnnotation,
// TODO disable sort for now due to an undesired sort behavior
// (see https://github.com/cBioPortal/cbioportal/issues/8247)
sortable: false
},
{
// override default HGVSg column to customize the link
...MUTATION_COLUMNS_DEFINITION[MutationColumn.HGVSG],
Expand Down Expand Up @@ -355,6 +345,7 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
this.showSomaticPercent
);
}

private get mutationCountFilter() {
return {
type: MUTATION_COUNT_FILTER_TYPE,
Expand Down Expand Up @@ -422,6 +413,25 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
<i className="fa fa-plus-circle" />;
}

@autobind
private renderAnnotation(cellProps: any) {
const mutation: IExtendedSignalMutation = cellProps.original;

// disable certain annotations for germline mutations
const props = this.signalMutationMapper ? {
...this.signalMutationMapper.defaultAnnotationColumnProps,
mutation: mutation as any,
enableOncoKb: isSomaticMutation(mutation) ?
this.signalMutationMapper.defaultAnnotationColumnProps.enableOncoKb : false,
enableHotspot: isSomaticMutation(mutation) ?
this.signalMutationMapper.defaultAnnotationColumnProps.enableHotspot : false,
enableMyCancerGenome: isSomaticMutation(mutation) ?
this.signalMutationMapper.defaultAnnotationColumnProps.enableMyCancerGenome : false,
}: undefined;

return props ? <Annotation {...props} />: undefined;
}

@autobind
private onMutationMapperInit(mutationMapper: SignalMutationMapper)
{
Expand Down
18 changes: 18 additions & 0 deletions src/components/SignalMutationMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,24 @@ export class SignalMutationMapper extends ReactMutationMapper<ISignalMutationMap
): info;
}

public get defaultAnnotationColumnProps() {
// TODO most of this code is duplicated from react-mutation-mapper
// we should make the default props accessible if possible
return {
enableOncoKb: true,
enableHotspot: true,
enableCivic: this.props.enableCivic || false,
enableMyCancerGenome: true,
hotspotData: this.store.indexedHotspotData,
oncoKbData: this.store.oncoKbData,
oncoKbCancerGenes: this.store.oncoKbCancerGenes,
usingPublicOncoKbInstance: this.store.usingPublicOncoKbInstance,
pubMedCache: this.pubMedCache,
civicGenes: this.store.civicGenes,
civicVariants: this.store.civicVariants
};
}

@computed
public get mutationRatesByMutationStatus() {
// TODO pick only likely driver ones, not all somatic mutations
Expand Down