Skip to content

Commit

Permalink
Do not show needs curation for categorical alterations (#417)
Browse files Browse the repository at this point in the history
* do not show needs curation for categorical alterations

* address comments
  • Loading branch information
bprize15 authored Aug 16, 2024
1 parent 59c8409 commit ccdb0cd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/main/webapp/app/shared/badge/NotCuratableBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React, { useMemo } from 'react';
import DefaultBadge from './DefaultBadge';
import { IRootStore } from 'app/stores';
import { componentInject } from '../util/typed-inject';
import { getMutationName } from '../util/firebase/firebase-utils';
import { getMutationName, isMutationEffectCuratable } from '../util/firebase/firebase-utils';
import { RADIO_OPTION_NONE } from 'app/config/constants/constants';
import { observer } from 'mobx-react';
import { CategoricalAlterationType } from '../model/enumerations/categorical-alteration-type.model';
import { parseAlterationName } from '../util/utils';

const NOT_CURATABLE_TOOLTIP_TEXT = {
stringMutations: 'Each mutation should have its own mutation effect curated',
Expand All @@ -22,6 +24,10 @@ const NotCuratableBadge: React.FunctionComponent<INotCuratableBadgeProps> = ({ m
const mutationStrings: [string[], string[]] = [[], []];
for (const name of mutationName.split(',')) {
const trimmedName = name.trim();
if (!isMutationEffectCuratable(trimmedName)) {
continue;
}

const foundMutation = mutations?.find(mut => getMutationName(mut.name, mut.alterations) === trimmedName);

if (!foundMutation?.mutation_effect.effect || foundMutation.mutation_effect.effect === RADIO_OPTION_NONE) {
Expand All @@ -41,9 +47,13 @@ const NotCuratableBadge: React.FunctionComponent<INotCuratableBadgeProps> = ({ m
tooltipOverlay={
<div>
<span>{text}</span>
<br />
<br />
{mutationsWithoutEffect.length > 1 && (
{(mutationsWithEffect || mutationsWithoutEffect) && (
<>
<br />
<br />
</>
)}
{mutationsWithoutEffect && (
<>
<span>
<b>Need curation: </b>
Expand All @@ -52,7 +62,7 @@ const NotCuratableBadge: React.FunctionComponent<INotCuratableBadgeProps> = ({ m
<br />
</>
)}
{mutationsWithEffect.length > 1 && (
{mutationsWithEffect && (
<span>
<b>Curated: </b>
{mutationsWithEffect}
Expand Down

0 comments on commit ccdb0cd

Please sign in to comment.