Skip to content

Commit

Permalink
revert colors.ts changes and add callback to change Mutated vs Wild T…
Browse files Browse the repository at this point in the history
…ype pie chart
  • Loading branch information
qlu-cls committed Apr 5, 2024
1 parent 94f9f9c commit 62abd1e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
23 changes: 22 additions & 1 deletion src/pages/studyView/StudyViewUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ import {
stringListToIndexSet,
toPromise,
} from 'cbioportal-frontend-commons';
import { DEFAULT_NA_COLOR, getClinicalValueColor } from 'shared/lib/Colors';
import {
CLI_NO_COLOR,
CLI_YES_COLOR,
DEFAULT_NA_COLOR,
DEFAULT_UNKNOWN_COLOR,
getClinicalValueColor,
} from 'shared/lib/Colors';
import { StudyViewComparisonGroup } from '../groupComparison/GroupComparisonUtils';
import styles from './styles.module.scss';
import { getGroupParameters } from 'pages/groupComparison/comparisonGroupManager/ComparisonGroupManagerUtils';
Expand Down Expand Up @@ -1919,6 +1925,19 @@ export function transformMutatedType(type: string): string {
return capitalizedWords.join(' ');
}

export function getMutationColorByCategorization(type: string): string {
switch (type) {
case 'Mutated':
return CLI_YES_COLOR;
case 'Not Mutated':
return CLI_NO_COLOR;
case 'Not Profiled':
return DEFAULT_NA_COLOR;
default:
return DEFAULT_UNKNOWN_COLOR;
}
}

export function getDefaultChartTypeByClinicalAttribute(
clinicalAttribute: ClinicalAttribute
): ChartType | undefined {
Expand Down Expand Up @@ -4150,6 +4169,8 @@ export async function invokeGenomicDataCount(
};
result = await internalClient.fetchMutationDataCountsUsingPOST(params);
getDisplayedValue = transformMutatedType;
getDisplayedColor = (value: string) =>
getMutationColorByCategorization(transformMutatedType(value));
} else {
result = await internalClient.fetchGenomicDataCountsUsingPOST(params);
getDisplayedValue = getCNAByAlteration;
Expand Down
3 changes: 0 additions & 3 deletions src/shared/lib/Colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ export let RESERVED_CLINICAL_VALUE_COLORS: { [value: string]: string } = {
// OTHER: MUT_COLOR_OTHER,
'wild type': DEFAULT_GREY,
'no mutation': DEFAULT_GREY,
mutated: CLI_YES_COLOR,
not_mutated: CLI_NO_COLOR,
not_profiled: DEFAULT_NA_COLOR,
amplification: CNA_COLOR_AMP,
gain: CNA_COLOR_GAIN,
diploid: DEFAULT_GREY,
Expand Down

0 comments on commit 62abd1e

Please sign in to comment.