Skip to content

Commit 9c23c05

Browse files
committed
Remove mechanism of inheritance conversion to allele state
1 parent 819d64d commit 9c23c05

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
@@ -969,38 +969,3 @@ export const getFdaSubmissionNumber = (
969969
? `${primaryNumber}/${supplementNumber}`
970970
: primaryNumber;
971971
};
972-
973-
const isAlleleState = (str: string): str is AlleleState => {
974-
return (
975-
str === ALLELE_STATE_MONOALLELIC ||
976-
str === ALLELE_STATE_BIALLELEIC ||
977-
str === ALLELE_STATE_CARRIER
978-
);
979-
};
980-
981-
export const getAlleleStateFromMechanismOfInheritance = (
982-
inheritanceMechanism: InheritanceMechanism
983-
): AlleleState | undefined => {
984-
if (inheritanceMechanism === MECHANISM_OF_INHERITANCE_AUTOSOMAL_DOMINANT) {
985-
return ALLELE_STATE_MONOALLELIC;
986-
}
987-
988-
if (inheritanceMechanism === MECHANISM_OF_INHERITANCE_AUTOSOMAL_RECESSIVE) {
989-
return ALLELE_STATE_BIALLELEIC;
990-
}
991-
992-
if (inheritanceMechanism === 'Carrier') {
993-
return ALLELE_STATE_CARRIER;
994-
}
995-
996-
return undefined;
997-
};
998-
999-
export const getAlleleStatesFromEvidence = (evidence: Evidence) => {
1000-
if (!evidence.knownEffect) {
1001-
return undefined;
1002-
}
1003-
const moi = evidence.knownEffect.trim() as InheritanceMechanism;
1004-
const alleleState = getAlleleStateFromMechanismOfInheritance(moi);
1005-
return alleleState;
1006-
};

0 commit comments

Comments
 (0)