Skip to content

Commit

Permalink
Hide reVUE when there is no reVUE mutations in the query (cBioPortal#…
Browse files Browse the repository at this point in the history
…4637)

* Hide reVUE when no reVUE mutations in the query
* Update screenshot tests
  • Loading branch information
leexgh authored Jun 2, 2023
1 parent 6890ad8 commit e4fef0c
Show file tree
Hide file tree
Showing 30 changed files with 85 additions and 21 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions packages/react-mutation-mapper/src/component/column/Annotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,17 @@ export function GenericAnnotation(props: GenericAnnotationProps): JSX.Element {
contentPadding={oncoKbContentPadding}
/>
)}
{enableRevue && annotation.vue ? (
<RevueCell vue={annotation.vue} />
{/* only show reVUE when reVUE is enabled and there are reVUE mutations in the query */}
{enableRevue ? (
annotation.vue ? (
<RevueCell vue={annotation.vue} />
) : (
<span
className={`${annotationStyles['annotation-item']}`}
/>
)
) : (
<span className={`${annotationStyles['annotation-item']}`} />
<></>
)}
{enableCivic && (
<Civic
Expand Down
Binary file modified packages/react-mutation-mapper/src/images/vue_logo.png
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 src/pages/patientView/mutation/MutationTableWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ export default class MutationTableWrapper extends React.Component<
getServerConfig().mycancergenome_show
}
enableCivic={getServerConfig().show_civic}
enableRevue={getServerConfig().show_revue}
columnVisibility={this.props.columnVisibility}
showGeneFilterMenu={
this.pageStore
Expand Down
3 changes: 3 additions & 0 deletions src/pages/patientView/mutation/PatientViewMutationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ export default class PatientViewMutationTable extends MutationTable<
width={this.oncokbWidth}
mergeOncoKbIcons={this.props.mergeOncoKbIcons}
onOncoKbIconToggle={this.handleOncoKbIconModeToggle}
showRevueIcon={
this.props.enableRevue && this.shouldShowRevue
}
/>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/pages/patientView/mutation/PatientViewMutationsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ export default class PatientViewMutationsTab extends React.Component<
enableHotspot={getServerConfig().show_hotspot}
enableMyCancerGenome={getServerConfig().mycancergenome_show}
enableCivic={getServerConfig().show_civic}
enableRevue={getServerConfig().show_revue}
columnVisibility={this.props.mutationTableColumnVisibility}
columnVisibilityProps={{
onColumnToggled: this.props
Expand Down
Binary file modified src/rootImages/vue_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface IMutationMapperServerConfig {
show_hotspot?: boolean;
mycancergenome_show?: boolean;
show_civic?: boolean;
show_revue?: boolean;
ptmSources?: string[];
mygene_info_url: string | null;
uniprot_id_url: string | null;
Expand All @@ -30,5 +31,6 @@ export function convertToMutationMapperProps(
enableHotspot: config.show_hotspot,
enableMyCancerGenome: config.mycancergenome_show,
enableCivic: config.show_civic,
enableRevue: config.show_revue,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export default class MutationMapperStore extends DefaultMutationMapperStore<
mutationMapperStoreConfig.filterMutationsBySelectedTranscript,
enableCivic: mutationMapperServerConfig.show_civic,
enableOncoKb: mutationMapperServerConfig.show_oncokb,
enableRevue: mutationMapperServerConfig.show_revue,
filterAppliersOverride:
mutationMapperStoreConfig.filterAppliersOverride,
genomeBuild: mutationMapperStoreConfig.genomeBuild,
Expand Down
40 changes: 37 additions & 3 deletions src/shared/components/mutationTable/MutationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ import {
IMyCancerGenomeData,
RemoteData,
IMyVariantInfoIndex,
extractGenomicLocation,
genomicLocationString,
} from 'cbioportal-utils';
import { generateQueryVariantId } from 'oncokb-frontend-commons';
import { VariantAnnotation } from 'genome-nexus-ts-api-client';
Expand Down Expand Up @@ -353,6 +355,35 @@ export default class MutationTable<
}
}

// hide reVUE if there is no reVUE mutations in the query
@computed get shouldShowRevue() {
const genomicLocationStrings = _.chain(this.props.dataStore?.allData)
.filter(mutationList => mutationList.length > 0) // get all mutations and filter out empty mutation list
.map(mutationList => mutationList[0]) // get mutation object (it's a list but only has one mutation)
.map(mutation => extractGenomicLocation(mutation))
.compact() // filter out undefined
.map(genomicLocation => genomicLocationString(genomicLocation))
.value();
const genomicLocationStringSet = new Set(genomicLocationStrings);
if (this.props.indexedVariantAnnotations?.result) {
const filteredVariantAnnotations = _.values(
_.pickBy(
this.props.indexedVariantAnnotations!.result,
(annotation, genomicLocationString) =>
genomicLocationStringSet.has(genomicLocationString)
)
);
return _.some(
filteredVariantAnnotations.map(
annotation =>
annotation?.annotation_summary?.vues !== undefined
)
);
} else {
return false;
}
}

protected generateColumns() {
this._columns = {} as Record<
ExtendedMutationTableColumnType,
Expand Down Expand Up @@ -875,7 +906,8 @@ export default class MutationTable<
name,
this.oncokbWidth,
this.props.mergeOncoKbIcons,
this.handleOncoKbIconModeToggle
this.handleOncoKbIconModeToggle,
this.shouldShowRevue
),
render: (d: Mutation[]) => (
<span id="mutation-annotation">
Expand All @@ -898,7 +930,8 @@ export default class MutationTable<
enableMyCancerGenome: this.props
.enableMyCancerGenome as boolean,
enableHotspot: this.props.enableHotspot as boolean,
enableRevue: this.props.enableRevue as boolean,
enableRevue:
!!this.props.enableRevue && this.shouldShowRevue,
userDisplayName: this.props.userDisplayName,
indexedVariantAnnotations: this.props
.indexedVariantAnnotations,
Expand Down Expand Up @@ -966,7 +999,8 @@ export default class MutationTable<
this.props.civicGenes,
this.props.civicVariants,
this.props.indexedVariantAnnotations,
this.resolveTumorType
this.resolveTumorType,
!!this.props.enableRevue && this.shouldShowRevue
);
},
sortBy: (d: Mutation[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export default class AnnotationColumnFormatter {
indexedVariantAnnotations?: RemoteData<
{ [genomicLocation: string]: VariantAnnotation } | undefined
>,
resolveTumorType?: (mutation: Mutation) => string
resolveTumorType?: (mutation: Mutation) => string,
shouldShowRevue?: boolean
) {
const annotationData: IAnnotation = getAnnotationData(
mutations ? mutations[0] : undefined,
Expand All @@ -86,36 +87,46 @@ export default class AnnotationColumnFormatter {
resolveTumorType
);

return [
const annotationDownloadContent = [
`OncoKB: ${oncoKbAnnotationDownload(
annotationData.oncoKbIndicator
)}`,
`reVUE: ${
annotationData.vue
? `${annotationData.vue.comment},PubmedId:${annotationData.vue.pubmedIds[0]},PredictedEffect:${annotationData.vue.defaultEffect},ExperimentallyValidatedEffect:${annotationData.vue.variantClassification},RevisedProteinEffect:${annotationData.vue.revisedProteinEffect}`
: 'no'
}`,
];
// only add reVUE to download when it's enabled and there are reVUE mutations in the query
if (shouldShowRevue) {
annotationDownloadContent.push(
`reVUE: ${
annotationData.vue
? `${annotationData.vue.comment},PubmedId:${annotationData.vue.pubmedIds[0]},PredictedEffect:${annotationData.vue.defaultEffect},ExperimentallyValidatedEffect:${annotationData.vue.variantClassification},RevisedProteinEffect:${annotationData.vue.revisedProteinEffect}`
: 'no'
}`
);
}
annotationDownloadContent.push(
`CIViC: ${civicDownload(annotationData.civicEntry)}`,
`MyCancerGenome: ${myCancerGenomeDownload(
annotationData.myCancerGenomeLinks
)}`,
`CancerHotspot: ${annotationData.isHotspot ? 'yes' : 'no'}`,
`3DHotspot: ${annotationData.is3dHotspot ? 'yes' : 'no'}`,
].join(';');
`3DHotspot: ${annotationData.is3dHotspot ? 'yes' : 'no'}`
);
return annotationDownloadContent.join(';');
}

public static headerRender(
name: string,
width: number,
mergeOncoKbIcons?: boolean,
onOncoKbIconToggle?: (mergeIcons: boolean) => void
onOncoKbIconToggle?: (mergeIcons: boolean) => void,
enableRevue?: boolean
) {
return (
<AnnotationHeader
name={name}
width={width}
mergeOncoKbIcons={mergeOncoKbIcons}
onOncoKbIconToggle={onOncoKbIconToggle}
showRevueIcon={enableRevue}
/>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { getVariantAnnotation, RemoteData } from 'cbioportal-utils';
import { VariantAnnotation } from 'genome-nexus-ts-api-client';
import _ from 'lodash';
import { RevueCell } from 'react-mutation-mapper';
import { getServerConfig } from 'config/config';

/**
* Mutation Column Formatter.
Expand Down Expand Up @@ -184,7 +185,7 @@ export default class MutationTypeColumnFormatter {
return (
<span className={styles.mutationTypeCell}>
{content}
{vue && (
{getServerConfig().show_revue && vue && (
<span className={styles.revueIcon}>
<RevueCell vue={vue} />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import MutationStatusColumnFormatter from './MutationStatusColumnFormatter';
import styles from './proteinChange.module.scss';
import { VariantAnnotation } from 'genome-nexus-ts-api-client';
import { RevueCell } from 'react-mutation-mapper';
import { getServerConfig } from 'config/config';
import _ from 'lodash';

export default class ProteinChangeColumnFormatter {
Expand Down Expand Up @@ -104,7 +105,7 @@ export default class ProteinChangeColumnFormatter {
{isGermlineMutation && ( // add a germline indicator next to protein change if it is a germline mutation!
<span className={styles.germline}>Germline</span>
)}
{vue && (
{getServerConfig().show_revue && vue && (
<span className={styles.revueIcon}>
<RevueCell vue={vue} />
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ const AnnotationHeader: React.FunctionComponent<{
width: number;
mergeOncoKbIcons?: boolean;
onOncoKbIconToggle?: (mergeIcons: boolean) => void;
showRevueIcon?: boolean;
}> = props => {
return (
<span>
Expand Down Expand Up @@ -402,12 +403,13 @@ const AnnotationHeader: React.FunctionComponent<{
marginLeft: 5,
marginBottom: 0,
marginRight:
props.width - 21 > 0 ? props.width - 21 : 0,
props.width - 22 > 0 ? props.width - 22 : 0,
}}
/>
</DefaultTooltip>
)}
{getServerConfig().show_revue && (
{/* only show reVUE when reVUE is enabled and there are reVUE mutations in the query */}
{getServerConfig().show_revue && props.showRevueIcon && (
<DefaultTooltip
placement="top"
overlay={
Expand All @@ -423,7 +425,7 @@ const AnnotationHeader: React.FunctionComponent<{
style={{
height: 14,
width: 14,
marginLeft: 6,
marginLeft: 7,
marginRight: 1,
}}
/>
Expand Down

0 comments on commit e4fef0c

Please sign in to comment.