Skip to content

Commit

Permalink
Add organoid icon and color on Patient View (#4963)
Browse files Browse the repository at this point in the history
* add organoid icon and color on Patient View
* refactor svg icon imports on patient view
  • Loading branch information
inodb authored Aug 15, 2024
1 parent 0b828d8 commit 9937567
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 56 deletions.
50 changes: 0 additions & 50 deletions src/pages/patientView/SVGIcons.tsx

This file was deleted.

5 changes: 5 additions & 0 deletions src/pages/patientView/SampleManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ class SampleManager {
.DERIVED_NORMALIZED_CASE_TYPE === 'Xenograft'
) {
color = styles.sampleColorXenograft;
} else if (
this.clinicalDataLegacyCleanAndDerived[sample.id]
.DERIVED_NORMALIZED_CASE_TYPE === 'Organoid'
) {
color = styles.sampleColorOrganoid;
} else if (
this.clinicalDataLegacyCleanAndDerived[sample.id]
.DERIVED_NORMALIZED_CASE_TYPE === 'Plasma'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const colors = {
sampleColorRecurrence: 'orange',
sampleColorMetastasis: 'red',
sampleColorCfdna: 'blue',
sampleColorXenograft: 'pink',
sampleColorOrganoid: 'paleVioletRed',
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ function derive(clinicalData) {
caseTypeLower.indexOf('pdx') >= 0
) {
caseTypeNormalized = 'Xenograft';
} else if (caseTypeLower.indexOf('organoid') >= 0) {
caseTypeNormalized = 'Organoid';
} else if (caseTypeLower.indexOf('cfdna') >= 0) {
caseTypeNormalized = 'cfDNA';
} else if (caseTypeLower.indexOf('prim') >= 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ $sample-color-recurrence: orange;
$sample-color-metastasis: red;
$sample-color-cfdna: blue;
$sample-color-xenograft: pink;
$sample-color-organoid: paleVioletRed;
$sample-color-plasma: gold;
$sample-color-ctdna: lightblue;
$sample-color-urine: yellow;
Expand All @@ -16,6 +17,7 @@ $sample-color-rna: grey;
sampleColorMetastasis: $sample-color-metastasis;
sampleColorCfdna: $sample-color-cfdna;
sampleColorXenograft: $sample-color-xenograft;
sampleColorOrganoid: $sample-color-organoid;
sampleColorPlasma: $sample-color-plasma;
sampleColorCtdna: $sample-color-ctdna;
sampleColorUrine: $sample-color-urine;
Expand Down
24 changes: 19 additions & 5 deletions src/pages/patientView/sampleHeader/SampleSummaryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { observer } from 'mobx-react';
import { ClinicalDataBySampleId } from 'cbioportal-ts-api-client';
import _ from 'lodash';
import { getSpanElementsFromCleanData } from '../clinicalInformation/lib/clinicalAttributesUtil';
import { getMouseIcon } from '../SVGIcons';
import { getSampleViewUrl } from 'shared/api/urls';
import SignificantMutationalSignatures from '../patientHeader/SignificantMutationalSignatures';
import { PatientViewPageStore } from '../clinicalInformation/PatientViewPageStore';
Expand All @@ -18,6 +17,9 @@ import { OtherBiomarkersQueryType } from 'oncokb-frontend-commons';
import { OtherBiomarkerAnnotation } from '../oncokb/OtherBiomarkerAnnotation';
import { IGenePanelModal } from 'pages/patientView/PatientViewPage';

import mouseIcon from './mouse_icon.svg';
import organoidIcon from './organoid_icon.svg';

export type ISampleSummaryListProps = {
sampleManager: SampleManager;
patientViewPageStore: PatientViewPageStore;
Expand Down Expand Up @@ -64,7 +66,9 @@ export default class SampleSummaryList extends React.Component<
) : null;
}

private isPDX(sample: ClinicalDataBySampleId): boolean {
private getDerivedNormalizedCaseType(
sample: ClinicalDataBySampleId
): string | undefined {
return (
this.props.sampleManager &&
this.props.sampleManager.clinicalDataLegacyCleanAndDerived &&
Expand All @@ -73,10 +77,18 @@ export default class SampleSummaryList extends React.Component<
] &&
this.props.sampleManager.clinicalDataLegacyCleanAndDerived[
sample.id
].DERIVED_NORMALIZED_CASE_TYPE === 'Xenograft'
].DERIVED_NORMALIZED_CASE_TYPE
);
}

private isPDX(sample: ClinicalDataBySampleId): boolean {
return this.getDerivedNormalizedCaseType(sample) === 'Xenograft';
}

private isOrganoid(sample: ClinicalDataBySampleId): boolean {
return this.getDerivedNormalizedCaseType(sample) === 'Organoid';
}

public render() {
let sampleHeader: (JSX.Element | undefined)[] | null = null;
sampleHeader = _.map(
Expand All @@ -89,6 +101,7 @@ export default class SampleSummaryList extends React.Component<
}

const isPDX = this.isPDX(sample);
const isOrganoid = this.isOrganoid(sample);

return (
<div className="patientSample">
Expand All @@ -99,8 +112,9 @@ export default class SampleSummaryList extends React.Component<
'',
<span style={{ display: 'inline-flex' }}>
{'\u00A0'}
{isPDX && getMouseIcon()}
{isPDX && '\u00A0'}
{isPDX && <img src={mouseIcon} />}
{isOrganoid && <img src={organoidIcon} />}
{(isPDX || isOrganoid) && '\u00A0'}
<a
href={getSampleViewUrl(
this.props.patientViewPageStore
Expand Down
44 changes: 44 additions & 0 deletions src/pages/patientView/sampleHeader/mouse_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions src/pages/patientView/sampleHeader/organoid_icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions typings/missing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
declare module '*.scss';
declare module '*.json';
declare module '*.md';
declare module '*.svg';

// these packages are missing typings
declare module 'fmin';
Expand Down

0 comments on commit 9937567

Please sign in to comment.