From 6b1ece7effe6b04ce1914c5ad6d44a212f4b75e8 Mon Sep 17 00:00:00 2001 From: David Ochoa Date: Tue, 26 Nov 2024 16:11:50 +0000 Subject: [PATCH 1/2] feat: credset page metadata improvements --- apps/platform/src/constants.js | 7 ++ .../pages/CredibleSetPage/ProfileHeader.gql | 5 + .../pages/CredibleSetPage/ProfileHeader.tsx | 100 ++++++++++-------- packages/sections/src/constants.js | 11 +- .../src/evidence/GWASCredibleSets/Body.jsx | 6 +- .../src/study/GWASCredibleSets/Body.tsx | 6 +- .../src/variant/GWASCredibleSets/Body.tsx | 14 +-- .../variant/GWASCredibleSets/PheWasPlot.tsx | 4 +- .../src/variant/QTLCredibleSets/Body.tsx | 6 +- 9 files changed, 92 insertions(+), 67 deletions(-) diff --git a/apps/platform/src/constants.js b/apps/platform/src/constants.js index 744ce7488..86c65583b 100644 --- a/apps/platform/src/constants.js +++ b/apps/platform/src/constants.js @@ -309,6 +309,13 @@ export const clinvarStarMap = { "no assertion provided": 0, }; +export const credsetConfidenceMap = { + "SuSiE fine-mapped credible set with in-sample LD": 4, + "SuSiE fine-mapped credible set with out-of-sample LD": 3, + "PICS fine-mapped credible set extracted from summary statistics": 2, + "PICS fine-mapped credible set based on reported top hit": 1, +}; + export const formatMap = { json: "JSON", parquet: "Parquet", diff --git a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql index 9d3f09c7f..aebd52fca 100644 --- a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql +++ b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql @@ -24,6 +24,7 @@ fragment CredibleSetProfileHeaderFragment on credibleSet { purityMinR2 locusStart locusEnd + confidence study { projectId publicationFirstAuthor @@ -33,6 +34,10 @@ fragment CredibleSetProfileHeaderFragment on credibleSet { id name } + backgroundTraits { + id + name + } target { id approvedSymbol diff --git a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx index 86673765c..0716022e7 100644 --- a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx +++ b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx @@ -7,11 +7,15 @@ import { ScientificNotation, Tooltip, PublicationsDrawer, + ClinvarStars, } from "ui"; import { Box, Typography } from "@mui/material"; import CREDIBLE_SET_PROFILE_HEADER_FRAGMENT from "./ProfileHeader.gql"; import { getStudyCategory } from "sections/src/utils/getStudyCategory"; import { epmcUrl } from "../../utils/urls"; +import { + credsetConfidenceMap, +} from "../../constants"; type ProfileHeaderProps = { variantId: string; @@ -85,7 +89,16 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { )} {typeof credibleSet?.effectAlleleFrequencyFromSource === "number" && ( - + + Frequency of the effect allele in studied population + + } + showHelpIcon + > + Effective allele frequency + }> {credibleSet.effectAlleleFrequencyFromSource.toPrecision(3)} )} @@ -108,63 +121,50 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { {leadVariant.posteriorProbability.toPrecision(3)} )} - - {credibleSet?.variant && - `${credibleSet.variant.chromosome}:${credibleSet.variant.position}`} - - {credibleSet?.variant?.rsIds.length > 0 && ( - - {credibleSet.variant.rsIds.map((rsid, index) => ( - - {index > 0 && ", "} - - {rsid} - - - ))} - - )} - Credible Set + Fine-mapping + + + + - + { + credibleSet?.locusStart && ( + {credibleSet?.variant?.chromosome}:{credibleSet?.locusStart}-{credibleSet?.locusEnd} + ) + } + {credibleSet?.finemappingMethod} - - {credibleSet?.credibleSetIndex} - - + Minimum pairwise correlation (R2) observed between all variants in the credible set + } + showHelpIcon + > + Minimum R2 + + } + > {credibleSet?.purityMinR2?.toPrecision(3)} - - {credibleSet?.locusStart} - - - {credibleSet?.locusEnd} - Study - - {study?.publicationFirstAuthor} - - - {study?.publicationDate?.slice(0, 4)} - {studyCategory !== "QTL" && ( <> {study?.traitFromSource} {study?.diseases?.length > 0 && ( - + {study.diseases.map(({ id, name }, index) => ( {index > 0 ? ", " : null} @@ -173,6 +173,16 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { ))} )} + {study?.backgroundTraits?.length > 0 && ( + + {study.backgroundTraits.map(({ id, name }, index) => ( + + {index > 0 ? ", " : null} + {name} + + ))} + + )} )} {studyCategory === "QTL" && ( @@ -194,9 +204,12 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { )} )} - - {study?.publicationJournal} + + {study?.nSamples.toLocaleString()} + {study?.publicationFirstAuthor && ( + {study?.publicationFirstAuthor} et al. {study?.publicationJournal} ({study?.publicationDate?.slice(0, 4)}) + )} {study?.pubmedId && ( @@ -204,11 +217,8 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { )} - - {study?.nSamples} - - + ); } diff --git a/packages/sections/src/constants.js b/packages/sections/src/constants.js index 43b232856..358627ea0 100644 --- a/packages/sections/src/constants.js +++ b/packages/sections/src/constants.js @@ -70,16 +70,19 @@ export const sourceMap = { USAN: "United States Adopted Name", }; +export const credsetConfidenceMap = { + "SuSiE fine-mapped credible set with in-sample LD": 4, + "SuSiE fine-mapped credible set with out-of-sample LD": 3, + "PICS fine-mapped credible set extracted from summary statistics": 2, + "PICS fine-mapped credible set based on reported top hit": 1, +}; + export const clinvarStarMap = { "practice guideline": 4, - "SuSiE fine-mapped credible set with in-sample LD": 4, "reviewed by expert panel": 3, - "SuSiE fine-mapped credible set with out-of-sample LD": 3, "criteria provided, multiple submitters, no conflicts": 2, - "PICS fine-mapped credible set extracted from summary statistics": 2, "criteria provided, conflicting interpretations": 1, "criteria provided, single submitter": 1, - "PICS fine-mapped credible set based on reported top hit": 1, "no assertion for the individual variant": 0, "no assertion criteria provided": 0, "no assertion provided": 0, diff --git a/packages/sections/src/evidence/GWASCredibleSets/Body.jsx b/packages/sections/src/evidence/GWASCredibleSets/Body.jsx index 3da061895..46642ebff 100644 --- a/packages/sections/src/evidence/GWASCredibleSets/Body.jsx +++ b/packages/sections/src/evidence/GWASCredibleSets/Body.jsx @@ -11,7 +11,7 @@ import { Tooltip, } from "ui"; -import { naLabel, sectionsBaseSizeQuery, clinvarStarMap } from "../../constants"; +import { naLabel, sectionsBaseSizeQuery, credsetConfidenceMap } from "../../constants"; import { definition } from "."; import Description from "./Description"; import { dataTypesMap } from "../../dataTypes"; @@ -118,11 +118,11 @@ function getColumns() { if (!credibleSet?.confidence) return naLabel; return ( - + ); }, - filterValue: ({ credibleSet }) => clinvarStarMap[credibleSet?.confidence], + filterValue: ({ credibleSet }) => credsetConfidenceMap[credibleSet?.confidence], }, { id: "finemappingMethod", diff --git a/packages/sections/src/study/GWASCredibleSets/Body.tsx b/packages/sections/src/study/GWASCredibleSets/Body.tsx index 285108e3f..7d9e94ea9 100644 --- a/packages/sections/src/study/GWASCredibleSets/Body.tsx +++ b/packages/sections/src/study/GWASCredibleSets/Body.tsx @@ -10,7 +10,7 @@ import { OtTable, } from "ui"; import { Box } from "@mui/material"; -import { clinvarStarMap, naLabel } from "../../constants"; +import { credsetConfidenceMap, naLabel } from "../../constants"; import { definition } from "."; import Description from "./Description"; import GWAS_CREDIBLE_SETS_QUERY from "./GWASCredibleSetsQuery.gql"; @@ -99,11 +99,11 @@ const columns = [ if (!confidence) return naLabel; return ( - + ); }, - filterValue: ({ confidence }) => clinvarStarMap[confidence], + filterValue: ({ confidence }) => credsetConfidenceMap[confidence], }, { id: "topL2G", diff --git a/packages/sections/src/variant/GWASCredibleSets/Body.tsx b/packages/sections/src/variant/GWASCredibleSets/Body.tsx index 700c4f3c1..922f0239d 100644 --- a/packages/sections/src/variant/GWASCredibleSets/Body.tsx +++ b/packages/sections/src/variant/GWASCredibleSets/Body.tsx @@ -10,7 +10,7 @@ import { useBatchQuery, } from "ui"; import { Box, Chip } from "@mui/material"; -import { clinvarStarMap, initialResponse, naLabel, table5HChunkSize } from "../../constants"; +import { credsetConfidenceMap, initialResponse, naLabel, table5HChunkSize } from "../../constants"; import { definition } from "."; import Description from "./Description"; import GWAS_CREDIBLE_SETS_QUERY from "./GWASCredibleSetsQuery.gql"; @@ -162,6 +162,10 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) { renderCell: ({ locus }) => locus.rows[0]?.posteriorProbability.toFixed(3) ?? naLabel, exportValue: ({ locus }) => locus.rows[0]?.posteriorProbability.toFixed(3), }, + { + id: "finemappingMethod", + label: "Fine-mapping method", + }, { id: "confidence", label: "Fine-mapping confidence", @@ -172,15 +176,11 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) { if (!confidence) return naLabel; return ( - + ); }, - filterValue: ({ confidence }) => clinvarStarMap[confidence], - }, - { - id: "finemappingMethod", - label: "Fine-mapping method", + filterValue: ({ confidence }) => credsetConfidenceMap[confidence], }, { id: "topL2G", diff --git a/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx b/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx index 863cabef6..d97fcea9b 100644 --- a/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx +++ b/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx @@ -24,7 +24,7 @@ import { } from "ui"; import { scaleLinear, scaleLog, min, scaleOrdinal, schemeCategory10, schemeDark2 } from "d3"; import { ScientificNotation } from "ui"; -import { naLabel, clinvarStarMap } from "../../constants"; +import { naLabel, credsetConfidenceMap } from "../../constants"; import { Fragment } from "react/jsx-runtime"; export default function PheWasPlot({ loading, data, id }) { @@ -305,7 +305,7 @@ function tooltipContent(data) { Confidence: {data.confidence ? - + : naLabel } diff --git a/packages/sections/src/variant/QTLCredibleSets/Body.tsx b/packages/sections/src/variant/QTLCredibleSets/Body.tsx index 454d3b51e..85984167a 100644 --- a/packages/sections/src/variant/QTLCredibleSets/Body.tsx +++ b/packages/sections/src/variant/QTLCredibleSets/Body.tsx @@ -9,7 +9,7 @@ import { useBatchQuery, } from "ui"; import { Box, Chip } from "@mui/material"; -import { clinvarStarMap, initialResponse, naLabel, table5HChunkSize } from "../../constants"; +import { credsetConfidenceMap, initialResponse, naLabel, table5HChunkSize } from "../../constants"; import { definition } from "."; import Description from "./Description"; import QTL_CREDIBLE_SETS_QUERY from "./QTLCredibleSetsQuery.gql"; @@ -181,11 +181,11 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) { if (!confidence) return naLabel; return ( - + ); }, - filterValue: ({ confidence }) => clinvarStarMap[confidence], + filterValue: ({ confidence }) => credsetConfidenceMap[confidence], }, { id: "finemappingMethod", From 48dc8b304fc7fb620e0502c2a8a9c77f9156f6dd Mon Sep 17 00:00:00 2001 From: David Ochoa Date: Tue, 26 Nov 2024 20:26:00 +0000 Subject: [PATCH 2/2] feat: study type now is shown and biosample shows label not id --- apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql | 2 ++ apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql index aebd52fca..902f9f0ab 100644 --- a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql +++ b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql @@ -44,9 +44,11 @@ fragment CredibleSetProfileHeaderFragment on credibleSet { } biosample { biosampleId + biosampleName } publicationJournal pubmedId nSamples + studyType } } diff --git a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx index 0716022e7..a4c3e61e2 100644 --- a/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx +++ b/apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx @@ -156,7 +156,7 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { - Study + {study?.studyType.replace(/(qtl|gwas)/gi, (match) => match.toUpperCase())} Study {studyCategory !== "QTL" && ( <> @@ -196,9 +196,9 @@ function ProfileHeader({ variantId }: ProfileHeaderProps) { - {study.biosample.biosampleId} + {study.biosample.biosampleName} )}