Skip to content

Commit 53a6846

Browse files
calvinlu3bprize15
authored andcommitted
Remove mechanism of inheritance conversion to allele state (oncokb#1281)
1 parent 9f5b207 commit 53a6846

File tree

2 files changed

+31
-42
lines changed

2 files changed

+31
-42
lines changed

src/main/webapp/app/pages/genePage/GenomicIndicatorTable.tsx

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,41 @@ import OncoKBTable, {
22
SearchColumn,
33
} from 'app/components/oncokbTable/OncoKBTable';
44
import {
5+
ALLELE_STATE_BIALLELEIC,
6+
ALLELE_STATE_CARRIER,
7+
ALLELE_STATE_MONOALLELIC,
8+
AlleleState,
59
LG_TABLE_FIXED_HEIGHT,
610
THRESHOLD_TABLE_FIXED_HEIGHT,
711
} from 'app/config/constants';
812
import React from 'react';
9-
import {
10-
getAlleleStatesFromEvidence,
11-
getAlterationName,
12-
} from 'app/shared/utils/Utils';
13+
import { getAlterationName } from 'app/shared/utils/Utils';
1314
import { LongText } from 'app/oncokb-frontend-commons/src/components/LongText';
1415
import { Evidence } from 'app/shared/api/generated/OncoKbAPI';
1516
import AlleleStateTag from 'app/components/tag/AlleleStateTag';
1617
import { genomicIndicatorNameSortMethod } from 'app/shared/utils/ReactTableUtils';
1718

19+
const parseAlleleStateFromIndicatorName = (
20+
name: string
21+
): { displayName: string; alleleState?: AlleleState } => {
22+
const alleleStateMap: { [key: string]: AlleleState } = {
23+
carrier: ALLELE_STATE_CARRIER,
24+
monoallelic: ALLELE_STATE_MONOALLELIC,
25+
biallelic: ALLELE_STATE_BIALLELEIC,
26+
};
27+
28+
const match = (name ?? '').match(
29+
/\s*\((carrier|monoallelic|biallelic)\)\s*$/i
30+
);
31+
if (match) {
32+
const alleleState = alleleStateMap[match[1].toLowerCase()];
33+
const displayName = name.replace(match[0], '').trim();
34+
return { displayName, alleleState };
35+
}
36+
37+
return { displayName: name };
38+
};
39+
1840
export const GenomicIndicatorTable: React.FunctionComponent<{
1941
data: Evidence[];
2042
isPending: boolean;
@@ -27,12 +49,14 @@ export const GenomicIndicatorTable: React.FunctionComponent<{
2749
{
2850
Header: <span>Genomic Indicator</span>,
2951
maxWidth: 200,
30-
accessor: 'name',
52+
id: 'name',
3153
Cell(row: { original: Evidence }) {
32-
const alleleState = getAlleleStatesFromEvidence(row.original);
54+
const { displayName, alleleState } = parseAlleleStateFromIndicatorName(
55+
row.original.name
56+
);
3357
return (
3458
<>
35-
<div>{row.original.name}</div>
59+
<div>{displayName}</div>
3660
{alleleState && <AlleleStateTag alleleState={alleleState} />}
3761
</>
3862
);

src/main/webapp/app/shared/utils/Utils.tsx

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -970,38 +970,3 @@ export const getFdaSubmissionNumber = (
970970
? `${primaryNumber}/${supplementNumber}`
971971
: primaryNumber;
972972
};
973-
974-
const isAlleleState = (str: string): str is AlleleState => {
975-
return (
976-
str === ALLELE_STATE_MONOALLELIC ||
977-
str === ALLELE_STATE_BIALLELEIC ||
978-
str === ALLELE_STATE_CARRIER
979-
);
980-
};
981-
982-
export const getAlleleStateFromMechanismOfInheritance = (
983-
inheritanceMechanism: InheritanceMechanism
984-
): AlleleState | undefined => {
985-
if (inheritanceMechanism === MECHANISM_OF_INHERITANCE_AUTOSOMAL_DOMINANT) {
986-
return ALLELE_STATE_MONOALLELIC;
987-
}
988-
989-
if (inheritanceMechanism === MECHANISM_OF_INHERITANCE_AUTOSOMAL_RECESSIVE) {
990-
return ALLELE_STATE_BIALLELEIC;
991-
}
992-
993-
if (inheritanceMechanism === 'Carrier') {
994-
return ALLELE_STATE_CARRIER;
995-
}
996-
997-
return undefined;
998-
};
999-
1000-
export const getAlleleStatesFromEvidence = (evidence: Evidence) => {
1001-
if (!evidence.knownEffect) {
1002-
return undefined;
1003-
}
1004-
const moi = evidence.knownEffect.trim() as InheritanceMechanism;
1005-
const alleleState = getAlleleStateFromMechanismOfInheritance(moi);
1006-
return alleleState;
1007-
};

0 commit comments

Comments
 (0)