Skip to content

Commit

Permalink
fix(variant): SKFP-850 fix NO_GENE case (#3839)
Browse files Browse the repository at this point in the history
  • Loading branch information
lflangis authored Nov 6, 2023
1 parent dc78e4f commit 708dcc8
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 44 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@apollo/client": "^3.5.10",
"@dnd-kit/core": "^4.0.3",
"@dnd-kit/sortable": "^5.1.0",
"@ferlab/ui": "^7.14.0",
"@ferlab/ui": "^7.14.2",
"@loadable/component": "^5.15.2",
"@react-keycloak/core": "^3.2.0",
"@react-keycloak/web": "^3.4.0",
Expand Down
2 changes: 1 addition & 1 deletion src/views/DataExploration/components/PageContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const PageContent = ({
participantMapping,
tabId = TAB_IDS.SUMMARY,
}: OwnProps) => {
const dispatch = useDispatch();
const dispatch = useDispatch<any>();
const history = useHistory();
const { savedSets } = useSavedSet();
const { queryList, activeQuery, selectedSavedFilter, savedFilterList } =
Expand Down
36 changes: 20 additions & 16 deletions src/views/VariantEntity/FerlabComponent/EntityGeneConsequence.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import { NO_GENE } from '@ferlab/ui/core/components/Consequences/Cell';
import { ProColumnType } from '@ferlab/ui/core/components/ProTable/types';
import { IArrangerEdge } from '@ferlab/ui/core/graphql/types';
import { hydrateResults } from '@ferlab/ui/core/graphql/utils';
import { EntityExpandableTableMultiple } from '@ferlab/ui/core/pages/EntityPage';

import { IGeneEntity } from '../../../graphql/variants/models';

import EntityGeneConsequenceSubtitle from './EntityGeneConsequenceSubtitle';
Expand Down Expand Up @@ -38,22 +40,24 @@ export const EntityGeneConsequences = ({
id={id}
loading={loading}
tables={
genes?.map((gene) => ({
columns,
data: hydrateResults(gene?.node?.consequences?.hits?.edges || []),
subTitle: (
<EntityGeneConsequenceSubtitle
gene={gene}
dictionary={{
gene: 'Gene',
omim: 'Omim',
spliceai: 'SpliceAI',
gnomad_pli: 'gnomAD pLI',
gnomad_loeuf: 'gnomAD LOEUF',
}}
/>
),
})) || []
genes
?.filter((gene) => gene.node.symbol !== NO_GENE)
.map((gene) => ({
columns,
data: hydrateResults(gene?.node?.consequences?.hits?.edges || []),
subTitle: (
<EntityGeneConsequenceSubtitle
gene={gene}
dictionary={{
gene: 'Gene',
omim: 'Omim',
spliceai: 'SpliceAI',
gnomad_pli: 'gnomAD pLI',
gnomad_loeuf: 'gnomAD LOEUF',
}}
/>
),
})) || []
}
title={title}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from '@ferlab/ui/core/pages/EntityPage/type';
import { groupRowsBySource } from '@ferlab/ui/core/pages/EntityPage/utils/pathogenicity';
import { toKebabCase } from '@ferlab/ui/core/utils/stringUtils';

import {
IGeneCosmic,
IGeneDdd,
Expand Down Expand Up @@ -92,7 +93,7 @@ export const makeUnGroupedDataRows = (genes: IArrangerEdge<IGeneEntity>[]) => {
}

return genes.map((gene) => {
const rowOrphanet = orphanetFromEdges(gene, gene.node.orphanet.hits.edges || []);
const rowOrphanet = orphanetFromEdges(gene, gene.node.orphanet?.hits?.edges || []);
const rowOmim = omimFromEdges(gene, keepOnlyOmimWithId(gene.node.omim?.hits?.edges || []));
const rowCosmic = cosmicFromEdges(gene, gene.node.cosmic?.hits?.edges || []);
const rowHpo = hpoFromEdges(gene, gene.node.hpo?.hits?.edges || []);
Expand Down
3 changes: 2 additions & 1 deletion src/views/VariantEntity/utils/consequences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import {
} from '@ferlab/ui/core/pages/EntityPage/utils/consequences';
import { removeUnderscoreAndCapitalize } from '@ferlab/ui/core/utils/stringUtils';
import { Space, Tooltip, Typography } from 'antd';
import { IConsequenceEntity, Impact } from '../../../graphql/variants/models';
import { capitalize } from 'lodash';

import { TABLE_EMPTY_PLACE_HOLDER } from 'common/constants';
import { getEntityConsequenceDictionary } from 'utils/translation';

import { IConsequenceEntity, Impact } from '../../../graphql/variants/models';
const { Text } = Typography;

import { getPredictionScore } from '../FerlabComponent/Consequences.utils';
Expand Down
35 changes: 19 additions & 16 deletions src/views/VariantEntity/utils/summary.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import intl from 'react-intl-universal';
import { NO_GENE } from '@ferlab/ui/core/components/Consequences/Cell';
import ExternalLink from '@ferlab/ui/core/components/ExternalLink';
import { IEntitySummaryColumns } from '@ferlab/ui/core/pages/EntityPage/EntitySummary';
import {
Expand Down Expand Up @@ -49,22 +50,24 @@ export const getSummaryItems = (variant?: IVariantEntity): IEntitySummaryColumns
},
{
label: intl.get('screen.variants.summary.genes'),
value: variant?.genes?.hits?.edges?.length
? variant.genes.hits.edges.map((gene) => {
if (!gene?.node?.symbol) {
return;
}
return (
<ExternalLink
key={gene.node.symbol}
className={styles.geneExternalLink}
href={`https://useast.ensembl.org/Homo_sapiens/Gene/Summary?g=${gene.node.symbol}`}
>
{gene.node.symbol}
</ExternalLink>
);
})
: TABLE_EMPTY_PLACE_HOLDER,
value:
variant?.genes?.hits?.edges?.length &&
variant.genes.hits.edges.filter((gene) => gene?.node?.symbol !== NO_GENE).length
? variant.genes.hits.edges.map((gene) => {
if (!gene?.node?.symbol) {
return;
}
return (
<ExternalLink
key={gene.node.symbol}
className={styles.geneExternalLink}
href={`https://useast.ensembl.org/Homo_sapiens/Gene/Summary?g=${gene.node.symbol}`}
>
{gene.node.symbol}
</ExternalLink>
);
})
: TABLE_EMPTY_PLACE_HOLDER,
},
{
label: intl.get('screen.variants.summary.omim'),
Expand Down
2 changes: 1 addition & 1 deletion src/views/Variants/components/PageContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const addTagToFilter = (filter: ISavedFilter) => ({
});

const PageContent = ({ variantMapping }: OwnProps) => {
const dispatch = useDispatch();
const dispatch = useDispatch<any>();
const { userInfo } = useUser();
const { savedSets } = useSavedSet();
const { queryList, activeQuery, selectedSavedFilter, savedFilterList } =
Expand Down

0 comments on commit 708dcc8

Please sign in to comment.