Skip to content

Commit

Permalink
rename Annotation to Somatic Annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
onursumer committed Jan 6, 2021
1 parent 381b19e commit cf90c1c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
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"
}
}}
/>
);
}
32 changes: 9 additions & 23 deletions src/components/MutationMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
defaultSortMethod,
MUTATION_COLUMNS_DEFINITION,
MutationColumn,
MutationStatus,
ProteinChange,
TrackName
} from "react-mutation-mapper";
Expand All @@ -46,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 @@ -185,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 @@ -244,7 +226,11 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
},
{
...MUTATION_COLUMNS_DEFINITION[MutationColumn.ANNOTATION],
Cell: this.renderAnnotation
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
Expand Down Expand Up @@ -428,8 +414,8 @@ class MutationMapper extends React.Component<IMutationMapperProps> {
}

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

// disable certain annotations for germline mutations
const props = this.signalMutationMapper ? {
Expand Down

0 comments on commit cf90c1c

Please sign in to comment.