1
1
import React from 'react' ;
2
- import { AlterationPageLink } from 'app/shared/utils/UrlUtils' ;
2
+ import {
3
+ AlterationPageLink ,
4
+ getAlternativeAllelesPageLinks ,
5
+ } from 'app/shared/utils/UrlUtils' ;
3
6
import WithSeparator from 'react-with-separator' ;
4
7
import SummaryWithRefs from 'app/oncokb-frontend-commons/src/components/SummaryWithRefs' ;
8
+ import { ALTERNATIVE_ALLELES_REGEX } from 'app/config/constants/regex' ;
5
9
6
10
const MutationEffectDescription : React . FunctionComponent < {
7
11
hugoSymbol : string ;
@@ -18,30 +22,19 @@ const MutationEffectDescription: React.FunctionComponent<{
18
22
const varSegs = segments [ 1 ] . split ( ' ' ) ;
19
23
let alterationStr = varSegs . pop ( ) ;
20
24
if ( alterationStr ) {
21
- const altRegex = new RegExp ( '([A-Z]+[0-9]+)([A-Z]+(/[A-Z]+)*)' , 'i' ) ;
25
+ const altRegex = ALTERNATIVE_ALLELES_REGEX ;
22
26
alterationStr = alterationStr . replace ( '.' , '' ) ;
23
27
if ( altRegex . test ( alterationStr ) ) {
24
28
const matches = altRegex . exec ( alterationStr ) ;
25
29
if ( matches ) {
26
- const positionalVar = matches [ 1 ] ;
27
- const alternativeAlleles = matches [ 2 ] ;
28
- const alleleLines = alternativeAlleles
29
- . split ( '/' )
30
- . map ( ( allele , index ) => {
31
- return (
32
- < AlterationPageLink
33
- hugoSymbol = { props . hugoSymbol }
34
- alteration = { `${ positionalVar } ${ allele } ` }
35
- >
36
- { index === 0 ? `${ positionalVar } ${ allele } ` : allele }
37
- </ AlterationPageLink >
38
- ) ;
39
- } ) ;
40
30
return (
41
31
< span >
42
32
{ segments [ 0 ] } { additionalMutationEffectSeparator }
43
33
{ varSegs . join ( ' ' ) } { ' ' }
44
- < WithSeparator separator = { '/' } > { alleleLines } </ WithSeparator > .
34
+ { getAlternativeAllelesPageLinks (
35
+ props . hugoSymbol ,
36
+ alterationStr
37
+ ) }
45
38
</ span >
46
39
) ;
47
40
}
0 commit comments