@@ -2,19 +2,41 @@ import OncoKBTable, {
22 SearchColumn ,
33} from 'app/components/oncokbTable/OncoKBTable' ;
44import {
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' ;
812import React from 'react' ;
9- import {
10- getAlleleStatesFromEvidence ,
11- getAlterationName ,
12- } from 'app/shared/utils/Utils' ;
13+ import { getAlterationName } from 'app/shared/utils/Utils' ;
1314import { LongText } from 'app/oncokb-frontend-commons/src/components/LongText' ;
1415import { Evidence } from 'app/shared/api/generated/OncoKbAPI' ;
1516import AlleleStateTag from 'app/components/tag/AlleleStateTag' ;
1617import { 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 * \( ( c a r r i e r | m o n o a l l e l i c | b i a l l e l i c ) \) \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+
1840export 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 ) ;
0 commit comments