diff --git a/src/main/webapp/app/config/constants.tsx b/src/main/webapp/app/config/constants.tsx index d4049bd49..de7470b38 100644 --- a/src/main/webapp/app/config/constants.tsx +++ b/src/main/webapp/app/config/constants.tsx @@ -616,6 +616,14 @@ export const GAIN_OF_FUNCTION_MUTATIONS = 'Gain-of-function Mutations'; export const LOSS_OF_FUNCTION_MUTATIONS = 'Loss-of-function Mutations'; export const SWITCH_OF_FUNCTION_MUTATIONS = 'Switch-of-function Mutations'; +export const CATEGORICAL_ALTERATIONS = [ + ONCOGENIC_MUTATIONS, + FUSIONS, + TRUNCATING_MUTATIONS, + GAIN_OF_FUNCTION_MUTATIONS, + LOSS_OF_FUNCTION_MUTATIONS, + SWITCH_OF_FUNCTION_MUTATIONS, +]; export enum SEARCH_QUERY_KEY { REFERENCE_GENOME = 'refGenome', } diff --git a/src/main/webapp/app/shared/utils/UrlUtils.tsx b/src/main/webapp/app/shared/utils/UrlUtils.tsx index 6d5ce56b3..1e481e6ef 100644 --- a/src/main/webapp/app/shared/utils/UrlUtils.tsx +++ b/src/main/webapp/app/shared/utils/UrlUtils.tsx @@ -11,6 +11,7 @@ import { import { encodeSlash, getAlterationName, + getCategoricalAlteration, getYouTubeLink, IAlteration, } from 'app/shared/utils/Utils'; @@ -73,17 +74,19 @@ export const getAlterationPageLink = (props: { searchQueries?: AlterationPageSearchQueries; hashQueries?: AlterationPageHashQueries; }): string => { - let pageLink = `${PAGE_ROUTE.GENE_HEADER}/${props.hugoSymbol}/${ + const linkoutAltName = getCategoricalAlteration( typeof props.alteration === 'string' ? props.alteration : props.alteration.name - }`; + ); + + let pageLink = `${PAGE_ROUTE.GENE_HEADER}/${props.hugoSymbol}/${linkoutAltName}`; if (props.cancerType) { pageLink = `${pageLink}/${encodeSlash(props.cancerType)}`; } const sq = props.searchQueries || {}; - // Prop alterationRefGenomes is just a convinient way to process reference genomes when it's a list. + // Prop alterationRefGenomes is just a convenient way to process reference genomes when it's a list. if (!sq.refGenome && props.alterationRefGenomes) { if (!props.alterationRefGenomes.includes(DEFAULT_REFERENCE_GENOME)) { sq.refGenome = props.alterationRefGenomes[0]; diff --git a/src/main/webapp/app/shared/utils/Utils.tsx b/src/main/webapp/app/shared/utils/Utils.tsx index be1518d1a..0be743242 100644 --- a/src/main/webapp/app/shared/utils/Utils.tsx +++ b/src/main/webapp/app/shared/utils/Utils.tsx @@ -10,6 +10,7 @@ import { APP_LOCAL_DATE_FORMAT, APP_LOCAL_DATETIME_FORMAT_Z, APP_TIMESTAMP_FORMAT, + CATEGORICAL_ALTERATIONS, DELETION, FUSIONS, GAIN_OF_FUNCTION_MUTATIONS, @@ -756,22 +757,24 @@ export interface IAlteration { } export const isCategoricalAlteration = (alteration: string) => { - const categoricalAlterations = [ - ONCOGENIC_MUTATIONS, - FUSIONS, - TRUNCATING_MUTATIONS, - GAIN_OF_FUNCTION_MUTATIONS, - LOSS_OF_FUNCTION_MUTATIONS, - SWITCH_OF_FUNCTION_MUTATIONS, - ]; return ( alteration && - categoricalAlterations.filter(alt => + CATEGORICAL_ALTERATIONS.filter(alt => alteration.toLowerCase().startsWith(alt.toLowerCase()) ).length > 0 ); }; +export const getCategoricalAlteration = (alteration: string) => { + if (isCategoricalAlteration(alteration)) { + const matched = CATEGORICAL_ALTERATIONS.filter(categoricalAlt => { + return alteration.toLowerCase().startsWith(categoricalAlt.toLowerCase()); + }); + return matched.pop(); + } + return alteration; +}; + /** * * @param alteration Alteration, either in string or in IAlteration @@ -856,7 +859,7 @@ export const getCategoricalAlterationDescription = ( default: break; } - if (alteration.startsWith(ONCOGENIC_MUTATIONS)) { + if (ONCOGENIC_MUTATIONS.toLowerCase() === alteration.toLowerCase()) { let prefix = 'Defined as point mutations, rearrangements/fusions or copy number alterations within'; if (oncogene && !tsg) { @@ -869,8 +872,8 @@ export const getCategoricalAlterationDescription = ( {prefix} {geneLink} considered "oncogenic", "likely oncogenic" or "resistance" as defined by{' '} - - {ONCOKB_TM} Curation Standard Operating Protocol v2.2, Chapter 2, + + {ONCOKB_TM} Curation Standard Operating Protocol, Chapter 1, Sub-Protocol 2.5 .