-
-
+
+
{label}:
|
-
+
{children}
|
From 735b513bbf032007e083f3e5205738588373cfb1 Mon Sep 17 00:00:00 2001
From: Carlos Cruz
Date: Mon, 9 Dec 2024 16:43:22 +0100
Subject: [PATCH 103/120] [Platform]: enhance InSilicoPredictors component
(#605)
---
.../src/variant/InSilicoPredictors/Body.tsx | 36 +++++++++++--------
.../InSilicoPredictorsPlot.tsx | 10 ++++--
2 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/packages/sections/src/variant/InSilicoPredictors/Body.tsx b/packages/sections/src/variant/InSilicoPredictors/Body.tsx
index d3817250c..a6cbc0544 100644
--- a/packages/sections/src/variant/InSilicoPredictors/Body.tsx
+++ b/packages/sections/src/variant/InSilicoPredictors/Body.tsx
@@ -1,3 +1,4 @@
+import { ReactElement } from "react";
import { useQuery } from "@apollo/client";
import { Typography } from "@mui/material";
import { SectionItem, Tooltip, OtTable } from "ui";
@@ -51,7 +52,15 @@ type BodyProps = {
entity: string;
};
-export function Body({ id, entity }: BodyProps) {
+function getSortedRows(request) {
+ return request.data?.variant?.inSilicoPredictors
+ ? [...request.data.variant.inSilicoPredictors]
+ .filter(e => e.method !== null)
+ .sort((row1, row2) => row1.method.localeCompare(row2.method))
+ : [];
+}
+
+export function Body({ id, entity }: BodyProps): ReactElement {
const variables = {
variantId: id,
};
@@ -72,20 +81,19 @@ export function Body({ id, entity }: BodyProps) {
alternateAllele={request.data?.variant.alternateAllele}
/>
)}
- renderChart={() => (
-
- )}
+ renderChart={() => {
+ const rows = getSortedRows(request);
+ return (
+
+ );
+ }}
renderBody={() => {
- let rows = [];
- if (request.data)
- rows = [...request.data.variant.inSilicoPredictors].sort((row1, row2) => {
- return row1.method.localeCompare(row2.method);
- });
+ const rows = getSortedRows(request);
return (
Date: Mon, 9 Dec 2024 17:16:41 +0000
Subject: [PATCH 104/120] [Platform]: rename gwas credible set datasource
(#609)
---
.../AssociationsToolkit/static_datasets/dataSourcesAssoc.js | 2 +-
packages/sections/src/evidence/GWASCredibleSets/index.js | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/apps/platform/src/components/AssociationsToolkit/static_datasets/dataSourcesAssoc.js b/apps/platform/src/components/AssociationsToolkit/static_datasets/dataSourcesAssoc.js
index eed7faea1..4a70239c6 100644
--- a/apps/platform/src/components/AssociationsToolkit/static_datasets/dataSourcesAssoc.js
+++ b/apps/platform/src/components/AssociationsToolkit/static_datasets/dataSourcesAssoc.js
@@ -2,7 +2,7 @@ const dataSources = [
{
id: "gwas_credible_sets",
sectionId: "gwasCredibleSets",
- label: "GWAS credible sets",
+ label: "GWAS associations",
aggregation: "Genetic association",
aggregationId: "genetic_association",
weight: 1,
diff --git a/packages/sections/src/evidence/GWASCredibleSets/index.js b/packages/sections/src/evidence/GWASCredibleSets/index.js
index 64a8fa54c..cc23b81e1 100644
--- a/packages/sections/src/evidence/GWASCredibleSets/index.js
+++ b/packages/sections/src/evidence/GWASCredibleSets/index.js
@@ -3,8 +3,8 @@ import { isPrivateEvidenceSection } from "../../utils/partnerPreviewUtils";
const id = "gwas_credible_sets";
export const definition = {
id,
- name: "GWAS credible sets",
- shortName: "GC",
+ name: "GWAS associations",
+ shortName: "GW",
hasData: data => data.gwasCredibleSets.count > 0,
isPrivate: isPrivateEvidenceSection(id),
};
From a558eff3fa40e635602840852c733335f5ec0804 Mon Sep 17 00:00:00 2001
From: David Ochoa
Date: Mon, 9 Dec 2024 17:18:30 +0000
Subject: [PATCH 105/120] [Platform]: fix several issues in exports (#608)
* feat: gwas credible set exports
* fix: molQTL cred sets add affectetd tissue cell
* fix: l2g score in gwas cred set in study page
* fix: shared trait studies export in study page
* fix: l2g widget in credible set page to export gene
* fix: first author in gwas colocalisation
* fix: transcript consequences export
* fix: minor tweak to a header
* fix: wrong query returning no top L2G in credible set widget
* fix: credible set exports and bugs
---
apps/platform/src/pages/StudyPage/Header.tsx | 2 +-
packages/sections/src/credibleSet/GWASColoc/Body.tsx | 3 +--
packages/sections/src/credibleSet/Locus2Gene/Body.tsx | 1 +
.../sections/src/evidence/GWASCredibleSets/Body.jsx | 11 ++++++++++-
packages/sections/src/study/GWASCredibleSets/Body.tsx | 1 +
.../sections/src/study/SharedTraitStudies/Body.tsx | 3 +++
.../sections/src/variant/GWASCredibleSets/Body.tsx | 4 +++-
.../GWASCredibleSets/GWASCredibleSetsQuery.gql | 2 +-
.../sections/src/variant/QTLCredibleSets/Body.tsx | 1 +
.../src/variant/VariantEffectPredictor/Body.tsx | 8 ++++++++
10 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/apps/platform/src/pages/StudyPage/Header.tsx b/apps/platform/src/pages/StudyPage/Header.tsx
index 35150ea40..2d71ea058 100644
--- a/apps/platform/src/pages/StudyPage/Header.tsx
+++ b/apps/platform/src/pages/StudyPage/Header.tsx
@@ -67,7 +67,7 @@ function Header({
);
}
sourceLink = {
- id: "UKB",
+ id: "UKB-PPP",
url: "https://www.synapse.org/Synapse:syn51364943/wiki/622119",
};
} else {
diff --git a/packages/sections/src/credibleSet/GWASColoc/Body.tsx b/packages/sections/src/credibleSet/GWASColoc/Body.tsx
index fd5bcacd0..99355d2df 100644
--- a/packages/sections/src/credibleSet/GWASColoc/Body.tsx
+++ b/packages/sections/src/credibleSet/GWASColoc/Body.tsx
@@ -53,8 +53,7 @@ const columns = [
: publicationFirstAuthor || naLabel;
},
exportValue: ({ otherStudyLocus }) => {
- const { projectId, publicationFirstAuthor } = otherStudyLocus.study || {};
- getStudyCategory(projectId) === "FINNGEN" ? "FinnGen" : publicationFirstAuthor;
+ return otherStudyLocus?.study?.publicationFirstAuthor;
},
},
{
diff --git a/packages/sections/src/credibleSet/Locus2Gene/Body.tsx b/packages/sections/src/credibleSet/Locus2Gene/Body.tsx
index c2b5f949a..2ea037347 100644
--- a/packages/sections/src/credibleSet/Locus2Gene/Body.tsx
+++ b/packages/sections/src/credibleSet/Locus2Gene/Body.tsx
@@ -21,6 +21,7 @@ const columns = [
if (!target) return naLabel;
return {target?.approvedSymbol};
},
+ exportValue: ({ target }) => target?.id,
},
{
id: "score",
diff --git a/packages/sections/src/evidence/GWASCredibleSets/Body.jsx b/packages/sections/src/evidence/GWASCredibleSets/Body.jsx
index 3110ee9fa..b16796b67 100644
--- a/packages/sections/src/evidence/GWASCredibleSets/Body.jsx
+++ b/packages/sections/src/evidence/GWASCredibleSets/Body.jsx
@@ -27,6 +27,7 @@ function getColumns(targetSymbol) {
renderCell: ({ credibleSet }) => {
return ;
},
+ exportValue: ({ credibleSet }) => credibleSet?.studyLocusId,
},
{
id: "variantId",
@@ -45,19 +46,22 @@ function getColumns(targetSymbol) {
/>
},
- filterValue: ({ variant: v }) =>
+ filterValue: ({ credibleSet: { variant: v } }) =>
`${v?.chromosome}_${v?.position}_${v?.referenceAllele}_${v?.alternateAllele}`,
+ exportValue: ({ credibleSet: { variant: v } }) => `${v?.chromosome}_${v?.position}_${v?.referenceAllele}_${v?.alternateAllele}`,
},
{
id: "trait",
label: "Reported trait",
renderCell: ({ credibleSet }) => credibleSet?.study.traitFromSource,
+ exportValue: ({ credibleSet }) => credibleSet?.study.traitFromSource,
},
{
id: "disease",
label: "Disease/phenotype",
renderCell: ({ disease }) => {disease.name},
filterValue: ({ disease }) => disease.name,
+ exportValue: ({ disease }) => `${disease.name} (${disease.id})`,
},
{
id: "study",
@@ -65,6 +69,7 @@ function getColumns(targetSymbol) {
renderCell: ({ credibleSet }) => {
return {credibleSet?.study.id};
},
+ exportValue: ({ credibleSet }) => credibleSet?.study.id,
},
{
id: "nSamples",
@@ -76,6 +81,7 @@ function getColumns(targetSymbol) {
? parseInt(credibleSet?.study.nSamples, 10).toLocaleString()
: naLabel,
filterValue: ({ credibleSet }) => parseInt(credibleSet?.study.nSamples, 10).toLocaleString(),
+ exportValue: ({ credibleSet }) => credibleSet?.study.nSamples,
},
{
id: "pValue",
@@ -126,11 +132,13 @@ function getColumns(targetSymbol) {
);
},
filterValue: ({ credibleSet }) => credsetConfidenceMap[credibleSet?.confidence],
+ exportValue: ({ credibleSet }) => credibleSet?.confidence,
},
{
id: "finemappingMethod",
label: "Fine-mapping method",
renderCell: ({ credibleSet }) => credibleSet?.finemappingMethod || naLabel,
+ exportValue: ({ credibleSet }) => credibleSet?.finemappingMethod,
},
{
id: "score",
@@ -176,6 +184,7 @@ function getColumns(targetSymbol) {
},
filterValue: ({ literature, publicationYear, publicationFirstAuthor }) =>
`${literature} ${publicationYear} ${publicationFirstAuthor}`,
+ exportValue: ({ credibleSet }) => credibleSet?.study.pubmedId,
},
];
}
diff --git a/packages/sections/src/study/GWASCredibleSets/Body.tsx b/packages/sections/src/study/GWASCredibleSets/Body.tsx
index 54b246555..88c48ccdb 100644
--- a/packages/sections/src/study/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/study/GWASCredibleSets/Body.tsx
@@ -134,6 +134,7 @@ const columns = [
);
},
+ exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.score,
},
{
id: "credibleSetSize",
diff --git a/packages/sections/src/study/SharedTraitStudies/Body.tsx b/packages/sections/src/study/SharedTraitStudies/Body.tsx
index d0cd10394..c122aa94d 100644
--- a/packages/sections/src/study/SharedTraitStudies/Body.tsx
+++ b/packages/sections/src/study/SharedTraitStudies/Body.tsx
@@ -23,6 +23,7 @@ function getColumns(diseaseIds: string[]) {
id: "studyId",
label: "Study",
renderCell: ({ id }) => {id},
+ exportValue: ({ id }) => id,
},
{
id: "sharedDiseases",
@@ -111,6 +112,8 @@ function getColumns(diseaseIds: string[]) {
},
filterValue: ({ publicationYear, publicationFirstAuthor }) =>
`${publicationYear} ${publicationFirstAuthor}`,
+ exportValue: ({ pubmedId }) =>
+ `${pubmedId}`,
},
];
}
diff --git a/packages/sections/src/variant/GWASCredibleSets/Body.tsx b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
index 459a1f4a3..21b6a363b 100644
--- a/packages/sections/src/variant/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
@@ -100,6 +100,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
if (!study) return naLabel;
return {study.id};
},
+ exportValue: ({ study }) => study?.id,
},
{
id: "pValue",
@@ -193,7 +194,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
const { target } = l2GPredictions?.rows[0];
return {target.approvedSymbol};
},
- exportValue: ({ l2GPredictions }) => l2GPredictions?.target.approvedSymbol,
+ exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.target.approvedSymbol,
},
{
id: "l2gScore",
@@ -214,6 +215,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
);
},
+ exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.score,
},
{
id: "credibleSetSize",
diff --git a/packages/sections/src/variant/GWASCredibleSets/GWASCredibleSetsQuery.gql b/packages/sections/src/variant/GWASCredibleSets/GWASCredibleSetsQuery.gql
index 3d22acf62..ca730f6bd 100644
--- a/packages/sections/src/variant/GWASCredibleSets/GWASCredibleSetsQuery.gql
+++ b/packages/sections/src/variant/GWASCredibleSets/GWASCredibleSetsQuery.gql
@@ -39,7 +39,7 @@ query GWASCredibleSetsQuery($variantId: String!, $size: Int!, $index: Int!) {
locusSize: locus {
count
}
- l2GPredictions(page: { size: 1, index: 1 }) {
+ l2GPredictions(page: { size: 1, index: 0 }) {
rows {
target {
id
diff --git a/packages/sections/src/variant/QTLCredibleSets/Body.tsx b/packages/sections/src/variant/QTLCredibleSets/Body.tsx
index 159449174..c1a0006e2 100644
--- a/packages/sections/src/variant/QTLCredibleSets/Body.tsx
+++ b/packages/sections/src/variant/QTLCredibleSets/Body.tsx
@@ -103,6 +103,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
);
},
+ exportValue: ({ study }) => { return `[${study?.biosample?.biosampleId}]:${study?.biosample?.biosampleName}`},
},
{
id: "study.condition",
diff --git a/packages/sections/src/variant/VariantEffectPredictor/Body.tsx b/packages/sections/src/variant/VariantEffectPredictor/Body.tsx
index 8930ee328..1b0bb594d 100644
--- a/packages/sections/src/variant/VariantEffectPredictor/Body.tsx
+++ b/packages/sections/src/variant/VariantEffectPredictor/Body.tsx
@@ -78,6 +78,14 @@ const columns = [
}
return displayElement;
},
+ exportValue: ({ target, transcriptId, uniprotAccessions, aminoAcidChange }) => {
+ const geneInfo = `Gene: ${target?.id};`;
+ const canonicalTranscript = transcriptId ? `Canonical transcript: ${transcriptId};` : "";
+ const biotype = `Biotype: ${target?.biotype};`;
+ const protein = uniprotAccessions?.length ? `Protein(s): ${uniprotAccessions.join(", ")}` : "";
+ const aaChange = aminoAcidChange ? `AA: ${aminoAcidChange};` : "";
+ return [geneInfo, canonicalTranscript, biotype, protein, aaChange].join("");
+ }
},
{
id: "variantConsequences.label",
From e4ff87499bf02f0a9e2ab6fa71471f04d16ae533 Mon Sep 17 00:00:00 2001
From: David Ochoa
Date: Mon, 9 Dec 2024 17:19:45 +0000
Subject: [PATCH 106/120] [Platform]: publication drawer in study page (#610)
---
apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx b/apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx
index c001c9cf3..5f7e64198 100644
--- a/apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx
+++ b/apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx
@@ -8,6 +8,7 @@ import {
SummaryStatsTable,
LabelChip,
DisplaySampleSize,
+ PublicationsDrawer,
} from "ui";
import { Box } from "@mui/material";
import { populationMap } from "../../constants";
@@ -114,9 +115,10 @@ function ProfileHeader() {
)}
{pubmedId &&
-
- {pubmedId}
-
+
}
From 999c8b4971a3659ba558e6423671c3fe1e5c6946 Mon Sep 17 00:00:00 2001
From: Graham McNeill
Date: Mon, 9 Dec 2024 22:01:22 +0000
Subject: [PATCH 107/120] [Platform]: Numeric precision (#611)
* use toPrecision instead toFixed
* format insilico predictors scores
---
packages/sections/src/credibleSet/Variants/Body.tsx | 4 ++--
packages/sections/src/study/GWASCredibleSets/Body.tsx | 2 +-
.../sections/src/variant/GWASCredibleSets/Body.tsx | 2 +-
.../sections/src/variant/InSilicoPredictors/Body.tsx | 10 ++++++----
packages/sections/src/variant/QTLCredibleSets/Body.tsx | 4 ++--
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/packages/sections/src/credibleSet/Variants/Body.tsx b/packages/sections/src/credibleSet/Variants/Body.tsx
index 78c4439a3..dff9808dd 100644
--- a/packages/sections/src/credibleSet/Variants/Body.tsx
+++ b/packages/sections/src/credibleSet/Variants/Body.tsx
@@ -91,7 +91,7 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
tooltip: "Beta with respect to the ALT allele",
renderCell: ({ beta }) => {
if (typeof beta !== "number") return naLabel;
- return beta.toFixed(3);
+ return beta.toPrecision(3);
},
},
{
@@ -138,7 +138,7 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
sortable: true,
renderCell: ({ posteriorProbability }) => {
if (typeof posteriorProbability !== "number") return naLabel;
- return posteriorProbability.toFixed(3);
+ return posteriorProbability.toPrecision(3);
},
},
{
diff --git a/packages/sections/src/study/GWASCredibleSets/Body.tsx b/packages/sections/src/study/GWASCredibleSets/Body.tsx
index 88c48ccdb..b94fce994 100644
--- a/packages/sections/src/study/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/study/GWASCredibleSets/Body.tsx
@@ -79,7 +79,7 @@ const columns = [
tooltip: "Beta with respect to the ALT allele",
renderCell: ({ beta }) => {
if (typeof beta !== "number") return naLabel;
- return beta.toFixed(3);
+ return beta.toPrecision(3);
},
},
{
diff --git a/packages/sections/src/variant/GWASCredibleSets/Body.tsx b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
index 21b6a363b..5cd9da27b 100644
--- a/packages/sections/src/variant/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
@@ -134,7 +134,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
sortable: true,
renderCell: ({ beta }) => {
if (typeof beta !== "number") return naLabel;
- return beta.toFixed(3);
+ return beta.toPrecision(3);
},
},
{
diff --git a/packages/sections/src/variant/InSilicoPredictors/Body.tsx b/packages/sections/src/variant/InSilicoPredictors/Body.tsx
index a6cbc0544..c00d0e4d2 100644
--- a/packages/sections/src/variant/InSilicoPredictors/Body.tsx
+++ b/packages/sections/src/variant/InSilicoPredictors/Body.tsx
@@ -38,12 +38,14 @@ const columns = [
{
id: "score",
label: "Score",
- renderCell: ({ score }) => score ?? naLabel,
+ numeric: true,
+ renderCell: ({ score }) => score?.toPrecision(3) ?? naLabel,
},
{
id: "normalisedScore",
label: "Normalised score",
- renderCell: ({ normalisedScore }) => normalisedScore ?? naLabel,
+ numeric: true,
+ renderCell: ({ normalisedScore }) => normalisedScore?.toFixed(3) ?? naLabel,
},
];
@@ -55,8 +57,8 @@ type BodyProps = {
function getSortedRows(request) {
return request.data?.variant?.inSilicoPredictors
? [...request.data.variant.inSilicoPredictors]
- .filter(e => e.method !== null)
- .sort((row1, row2) => row1.method.localeCompare(row2.method))
+ .filter(e => e.method !== null)
+ .sort((row1, row2) => row1.method.localeCompare(row2.method))
: [];
}
diff --git a/packages/sections/src/variant/QTLCredibleSets/Body.tsx b/packages/sections/src/variant/QTLCredibleSets/Body.tsx
index c1a0006e2..510f4f104 100644
--- a/packages/sections/src/variant/QTLCredibleSets/Body.tsx
+++ b/packages/sections/src/variant/QTLCredibleSets/Body.tsx
@@ -103,7 +103,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
);
},
- exportValue: ({ study }) => { return `[${study?.biosample?.biosampleId}]:${study?.biosample?.biosampleName}`},
+ exportValue: ({ study }) => { return `[${study?.biosample?.biosampleId}]:${study?.biosample?.biosampleName}` },
},
{
id: "study.condition",
@@ -142,7 +142,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
sortable: true,
renderCell: ({ beta }) => {
if (typeof beta !== "number") return naLabel;
- return beta.toFixed(3);
+ return beta.toPrecision(3);
},
},
{
From 0be009dad3a7cb51b6abf148b7804914a2ce8e39 Mon Sep 17 00:00:00 2001
From: Graham McNeill
Date: Mon, 9 Dec 2024 22:01:55 +0000
Subject: [PATCH 108/120] [Platform]: Fix credible set size in PheWas plot
tooltip (#612)
---
packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx b/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx
index f75760c4c..573f2a85c 100644
--- a/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx
+++ b/packages/sections/src/variant/GWASCredibleSets/PheWasPlot.tsx
@@ -354,7 +354,7 @@ function tooltipContent(data) {
- {data.locus?.count ?? naLabel}
+ {data.locusSize?.count ?? naLabel}
);
From 2058adeae04b562777f9381d1bf497f975800be7 Mon Sep 17 00:00:00 2001
From: Graham McNeill
Date: Mon, 9 Dec 2024 22:03:18 +0000
Subject: [PATCH 109/120] [Platform]: Update open targets links in widget
descriptions (#606)
---
packages/sections/src/credibleSet/GWASColoc/Description.tsx | 2 +-
packages/sections/src/credibleSet/Locus2Gene/Description.tsx | 4 +++-
.../sections/src/credibleSet/MolQTLColoc/Description.tsx | 2 +-
packages/sections/src/credibleSet/Variants/Description.tsx | 2 +-
.../sections/src/evidence/GWASCredibleSets/Description.jsx | 4 ++--
packages/sections/src/study/GWASCredibleSets/Description.tsx | 2 +-
packages/sections/src/study/QTLCredibleSets/Description.tsx | 4 ++++
.../sections/src/variant/GWASCredibleSets/Description.tsx | 2 +-
.../sections/src/variant/QTLCredibleSets/Description.tsx | 5 ++++-
9 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/packages/sections/src/credibleSet/GWASColoc/Description.tsx b/packages/sections/src/credibleSet/GWASColoc/Description.tsx
index 53a88e985..9cca248ba 100644
--- a/packages/sections/src/credibleSet/GWASColoc/Description.tsx
+++ b/packages/sections/src/credibleSet/GWASColoc/Description.tsx
@@ -4,7 +4,7 @@ function Description() {
return (
<>
Colocalisation metrics for overlapping credible sets from GWAS studies. Source:{" "}
-
+
Open Targets
>
diff --git a/packages/sections/src/credibleSet/Locus2Gene/Description.tsx b/packages/sections/src/credibleSet/Locus2Gene/Description.tsx
index 4bdaab04c..94389c54a 100644
--- a/packages/sections/src/credibleSet/Locus2Gene/Description.tsx
+++ b/packages/sections/src/credibleSet/Locus2Gene/Description.tsx
@@ -5,7 +5,9 @@ function Description(): ReactElement {
return (
<>
Gene assignment based on machine-learning prioritisation of credible set features. Source:{" "}
- Open Targets
+
+ Open Targets
+
>
);
}
diff --git a/packages/sections/src/credibleSet/MolQTLColoc/Description.tsx b/packages/sections/src/credibleSet/MolQTLColoc/Description.tsx
index 731d474ce..47ec68866 100644
--- a/packages/sections/src/credibleSet/MolQTLColoc/Description.tsx
+++ b/packages/sections/src/credibleSet/MolQTLColoc/Description.tsx
@@ -4,7 +4,7 @@ function Description() {
return (
<>
Colocalisation metrics for overlapping credible sets from molecular QTL studies. Source:{" "}
-
+
Open Targets
>
diff --git a/packages/sections/src/credibleSet/Variants/Description.tsx b/packages/sections/src/credibleSet/Variants/Description.tsx
index e6ad68d06..dcb6b0516 100644
--- a/packages/sections/src/credibleSet/Variants/Description.tsx
+++ b/packages/sections/src/credibleSet/Variants/Description.tsx
@@ -4,7 +4,7 @@ function Description() {
return (
<>
Set of variants with 95% probability of containing the causal variant. Source:{" "}
-
+
Open Targets
>
diff --git a/packages/sections/src/evidence/GWASCredibleSets/Description.jsx b/packages/sections/src/evidence/GWASCredibleSets/Description.jsx
index 5f22339a4..e8e7faaa7 100644
--- a/packages/sections/src/evidence/GWASCredibleSets/Description.jsx
+++ b/packages/sections/src/evidence/GWASCredibleSets/Description.jsx
@@ -6,8 +6,8 @@ function Description({ symbol, name }) {
<>
95% GWAS credible sets prioritisating {symbol} as likely causal gene for{" "}
{name}. Source:{" "}
-
- Open Targets Genetics
+
+ Open Targets
>
);
diff --git a/packages/sections/src/study/GWASCredibleSets/Description.tsx b/packages/sections/src/study/GWASCredibleSets/Description.tsx
index 2d6b88112..eb078487a 100644
--- a/packages/sections/src/study/GWASCredibleSets/Description.tsx
+++ b/packages/sections/src/study/GWASCredibleSets/Description.tsx
@@ -9,7 +9,7 @@ function Description({ studyId }: DescriptionProps) {
<>
95% GWAS credible sets associated with study {" "}
{studyId}. Source{" "}
-
+
Open Targets
>
diff --git a/packages/sections/src/study/QTLCredibleSets/Description.tsx b/packages/sections/src/study/QTLCredibleSets/Description.tsx
index dd1e11266..bc2653ef4 100644
--- a/packages/sections/src/study/QTLCredibleSets/Description.tsx
+++ b/packages/sections/src/study/QTLCredibleSets/Description.tsx
@@ -12,6 +12,10 @@ function Description({ studyId }: DescriptionProps) {
eQTL Catalog
+ ,{" "}
+
+ UKB-PPP
+
>
);
}
diff --git a/packages/sections/src/variant/GWASCredibleSets/Description.tsx b/packages/sections/src/variant/GWASCredibleSets/Description.tsx
index 985d58e7c..3ae487f95 100644
--- a/packages/sections/src/variant/GWASCredibleSets/Description.tsx
+++ b/packages/sections/src/variant/GWASCredibleSets/Description.tsx
@@ -18,7 +18,7 @@ function Description({ variantId, referenceAllele, alternateAllele }: Descriptio
/>
. Source{" "}
-
+
Open Targets
>
diff --git a/packages/sections/src/variant/QTLCredibleSets/Description.tsx b/packages/sections/src/variant/QTLCredibleSets/Description.tsx
index 014b09642..ce0a8e245 100644
--- a/packages/sections/src/variant/QTLCredibleSets/Description.tsx
+++ b/packages/sections/src/variant/QTLCredibleSets/Description.tsx
@@ -22,7 +22,10 @@ function Description({
alternateAllele={alternateAllele}
/>
- . Source Open Targets
+ . Source{" "}
+
+ Open Targets
+
>
);
}
From 924c3caf4ac349089882592dbc11df9e4435ab7e Mon Sep 17 00:00:00 2001
From: Carlos Cruz
Date: Tue, 10 Dec 2024 10:48:53 +0100
Subject: [PATCH 110/120] [Platform]: Phewas chart add export data and query
playground (#607)
---
.../src/variant/GWASCredibleSets/Body.tsx | 44 ++--
.../variant/GWASCredibleSets/PheWasPlot.tsx | 205 ++++++++++--------
2 files changed, 146 insertions(+), 103 deletions(-)
diff --git a/packages/sections/src/variant/GWASCredibleSets/Body.tsx b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
index 5cd9da27b..b8840da86 100644
--- a/packages/sections/src/variant/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/variant/GWASCredibleSets/Body.tsx
@@ -16,7 +16,11 @@ import { definition } from ".";
import Description from "./Description";
import GWAS_CREDIBLE_SETS_QUERY from "./GWASCredibleSetsQuery.gql";
import { Fragment } from "react/jsx-runtime";
-import { mantissaExponentComparator, variantComparator, nullishComparator } from "../../utils/comparators";
+import {
+ mantissaExponentComparator,
+ variantComparator,
+ nullishComparator,
+} from "../../utils/comparators";
import PheWasPlot from "./PheWasPlot";
import { useEffect, useState } from "react";
import { responseType } from "ui/src/types/response";
@@ -155,8 +159,9 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
>
),
comparator: (a, b) => {
- return a?.locus?.rows?.[0]?.posteriorProbability -
- b?.locus?.rows?.[0]?.posteriorProbability;
+ return (
+ a?.locus?.rows?.[0]?.posteriorProbability - b?.locus?.rows?.[0]?.posteriorProbability
+ );
},
sortable: true,
renderCell: ({ locus }) =>
@@ -202,7 +207,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
comparator: nullishComparator(
(a, b) => a - b,
row => row?.l2GPredictions?.rows[0]?.score,
- false,
+ false
),
sortable: true,
tooltip:
@@ -225,9 +230,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
numeric: true,
filterValue: false,
renderCell: ({ locusSize }) => {
- return typeof locusSize?.count === "number"
- ? locusSize.count.toLocaleString()
- : naLabel;
+ return typeof locusSize?.count === "number" ? locusSize.count.toLocaleString() : naLabel;
},
exportValue: ({ locusSize }) => locusSize?.count,
},
@@ -242,17 +245,15 @@ type BodyProps = {
function Body({ id, entity }: BodyProps) {
const variables = {
variantId: id,
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getAllGwasData = useBatchQuery({
query: GWAS_CREDIBLE_SETS_QUERY,
- variables: {
- variantId: id,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.variant.gwasCredibleSets",
size: table5HChunkSize,
});
@@ -278,8 +279,16 @@ function Body({ id, entity }: BodyProps) {
/>
)}
renderChart={() => {
+ const columns = getColumns({
+ id,
+ referenceAllele: request.data?.variant.referenceAllele,
+ alternateAllele: request.data?.variant.alternateAllele,
+ });
return (
{
+ const columns = getColumns({
+ id,
+ referenceAllele: request.data?.variant.referenceAllele,
+ alternateAllele: request.data?.variant.alternateAllele,
+ });
return (
<>
+
+
+ );
+}
+
+export default function PheWasPlot({
+ loading,
+ data,
+ id,
+ referenceAllele,
+ alternateAllele,
+ query,
+ variables,
+ columns,
+}) {
const theme = useTheme();
const background = theme.palette.background.paper;
const fontFamily = theme.typography.fontFamily;
const pointArea = 64;
- const palette = [
- '#27B4AE',
- '#4047C4',
- '#F48730',
- '#DB4281',
- '#7E84F4',
- '#78DF76',
- '#1C7AED',
- '#7129CD',
- '#E7C73B',
- '#C95F1E',
- '#188E61',
- '#BEE952',
- ];
-
if (loading) return ;
if (data == null) return null;
// eslint-disable-next-line
data = data.filter(d => {
- return d.pValueMantissa != null &&
- d.pValueExponent != null &&
- d.variant != null;
+ return d.pValueMantissa != null && d.pValueExponent != null && d.variant != null;
});
if (data.length === 0) return null;
// eslint-disable-next-line
@@ -71,7 +99,7 @@ export default function PheWasPlot({ loading, data, id, referenceAllele, alterna
const yMin = min(data, d => d._y);
const yMax = 0;
- const rowLookup = new Map(); // derived values for each row
+ const rowLookup = new Map(); // derived values for each row
const diseaseGroups = new Map();
for (const row of data) {
const { id, name } = getTherapeuticArea(row);
@@ -81,18 +109,16 @@ export default function PheWasPlot({ loading, data, id, referenceAllele, alterna
: diseaseGroups.set(id, { name, data: [row] });
}
- let sortedDiseaseIds = // disease ids sorted by disease name
- [...diseaseGroups]
- .sort((a, b) => a[1].name.localeCompare(b[1].name))
- .map(a => a[0]);
- if (diseaseGroups.has('__uncategorised__')) {
- sortedDiseaseIds = sortedDiseaseIds.filter(id => id !== '__uncategorised__');
- sortedDiseaseIds.push('__uncategorised__');
+ let sortedDiseaseIds = // disease ids sorted by disease name
+ [...diseaseGroups].sort((a, b) => a[1].name.localeCompare(b[1].name)).map(a => a[0]);
+ if (diseaseGroups.has("__uncategorised__")) {
+ sortedDiseaseIds = sortedDiseaseIds.filter(id => id !== "__uncategorised__");
+ sortedDiseaseIds.push("__uncategorised__");
}
const xIntervals = new Map();
let xCumu = 0;
- const xGap = data.length / 300; // gap between groups
- const xPad = data.length / 500; // padding at ede of groups
+ const xGap = data.length / 300; // gap between groups
+ const xPad = data.length / 500; // padding at ede of groups
const sortedData = [];
for (const id of sortedDiseaseIds) {
const { data: newRows } = diseaseGroups.get(id);
@@ -110,10 +136,10 @@ export default function PheWasPlot({ loading, data, id, referenceAllele, alterna
}
const xScale = scaleLinear().domain([0, xCumu]);
- const yScale = scaleLinear().domain([yMin, yMax]).nice(); // ensure min scale value <= yMin
- yScale.domain([yScale.domain()[0], yMax]); // ensure max scale value is yMax - in case nice changed it
+ const yScale = scaleLinear().domain([yMin, yMax]).nice(); // ensure min scale value <= yMin
+ yScale.domain([yScale.domain()[0], yMax]); // ensure max scale value is yMax - in case nice changed it
- const colorDomain = ['background'];
+ const colorDomain = ["background"];
const colorRange = [background];
for (const [i, id] of sortedDiseaseIds.entries()) {
colorDomain.push(id);
@@ -125,25 +151,24 @@ export default function PheWasPlot({ loading, data, id, referenceAllele, alterna
x: d => rowLookup.get(d).x,
y: d => d._y,
fill: d => {
- return d.variant.id === id ? rowLookup.get(d).therapeuticAreaId : 'background';
+ return d.variant.id === id ? rowLookup.get(d).therapeuticAreaId : "background";
},
stroke: d => rowLookup.get(d).therapeuticAreaId,
strokeWidth: 1.3,
area: pointArea,
- hover: 'stay',
- shape: d => d.beta ? 'triangle' : 'circle',
- rotation: d => d.beta < 0 ? 180 : 0,
- }
+ hover: "stay",
+ shape: d => (d.beta ? "triangle" : "circle"),
+ rotation: d => (d.beta < 0 ? 180 : 0),
+ };
return (
<>
-
{/* legend */}
+
▲ Beta > 0
▼ Beta < 0
- ● Beta {naLabel}
- Filled symbol:{" "}
+ ● Beta {naLabel} Filled symbol:{" "}
-
- {" "}is lead variant
+ {" "}
+ is lead variant
{/* plot */}
-
-
{[...xIntervals].map(([id, { start, end }]) => (
d[0]}
strokeWidth={1}
/>
-
- -log
- 10
+
+
+ -log
+
+ 10
+
(pValue)
@@ -239,17 +272,13 @@ export default function PheWasPlot({ loading, data, id, referenceAllele, alterna
{/* axes at end so fade rectangle doesn't cover them */}
{/* */}
-
-
-
+
>
);
-
}
function tooltipContent(data) {
-
const labelWidth = 160;
return (
@@ -284,8 +313,8 @@ function tooltipContent(data) {
valueWidth={`${tooltipWidth - labelWidth}px`}
truncateValue
>
- {data.study?.diseases?.length > 0
- ? <>
+ {data.study?.diseases?.length > 0 ? (
+ <>
{data.study.diseases.map((d, i) => (
{i > 0 && ", "}
@@ -293,16 +322,12 @@ function tooltipContent(data) {
))}
>
- : naLabel
- }
+ ) : (
+ naLabel
+ )}
- {data.study
- ?
- {data.study.id}
-
- : naLabel
- }
+ {data.study ? {data.study.id} : naLabel}
@@ -316,16 +341,17 @@ function tooltipContent(data) {
- Method:{" "}{data.finemappingMethod ?? naLabel}
+ Method: {data.finemappingMethod ?? naLabel}
Confidence:{" "}
- {data.confidence
- ?
+ {data.confidence ? (
+
- : naLabel
- }
+ ) : (
+ naLabel
+ )}
@@ -333,23 +359,28 @@ function tooltipContent(data) {
Top:{" "}
- {data.l2GPredictions?.rows?.[0]?.target
- ?
+ {data.l2GPredictions?.rows?.[0]?.target ? (
+
{data.l2GPredictions.rows[0].target.approvedSymbol}
- : naLabel
- }
+ ) : (
+ naLabel
+ )}
Score:{" "}
- {data.l2GPredictions?.rows?.[0]?.score
- ?
+ {data.l2GPredictions?.rows?.[0]?.score ? (
+
-
+
- : naLabel
- }
+ ) : (
+ naLabel
+ )}
@@ -391,9 +422,11 @@ const therapeuticPriorities = {
function getTherapeuticArea(row) {
let bestId = null;
let bestRank = Infinity;
- const areaIds = row.study.diseases.map(d => {
- return d.therapeuticAreas.map(area => area.id);
- }).flat();
+ const areaIds = row.study.diseases
+ .map(d => {
+ return d.therapeuticAreas.map(area => area.id);
+ })
+ .flat();
for (const id of areaIds) {
const rank = therapeuticPriorities[id]?.rank;
if (rank < bestRank) {
@@ -403,5 +436,5 @@ function getTherapeuticArea(row) {
}
return bestId
? { id: bestId, name: therapeuticPriorities[bestId].name }
- : { id: '__uncategorised__', name: 'Uncategorised' };
-}
\ No newline at end of file
+ : { id: "__uncategorised__", name: "Uncategorised" };
+}
From ce61cfac2251605930ef36e8692c7ab0aa6614d8 Mon Sep 17 00:00:00 2001
From: Carlos Cruz
Date: Tue, 10 Dec 2024 10:49:15 +0100
Subject: [PATCH 111/120] [Platform]: Fix sections gql playground (#613)
---
.../src/credibleSet/GWASColoc/Body.tsx | 23 +++++-----
.../src/credibleSet/Variants/Body.tsx | 18 ++++----
.../src/study/GWASCredibleSets/Body.tsx | 24 +++++------
.../src/study/SharedTraitStudies/Body.tsx | 43 ++++++++-----------
4 files changed, 49 insertions(+), 59 deletions(-)
diff --git a/packages/sections/src/credibleSet/GWASColoc/Body.tsx b/packages/sections/src/credibleSet/GWASColoc/Body.tsx
index 99355d2df..71cbb9a35 100644
--- a/packages/sections/src/credibleSet/GWASColoc/Body.tsx
+++ b/packages/sections/src/credibleSet/GWASColoc/Body.tsx
@@ -14,7 +14,7 @@ import Description from "./Description";
import GWAS_COLOC_QUERY from "./GWASColocQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { getStudyCategory } from "../../utils/getStudyCategory";
-import { useEffect, useState } from "react";
+import { ReactElement, useEffect, useState } from "react";
const columns = [
{
@@ -131,12 +131,11 @@ const columns = [
let category = "Inconclusive";
if (betaRatioSignAverage <= -0.99) category = "Opposite";
else if (betaRatioSignAverage >= 0.99) category = "Same";
- const displayValue = Math.abs(betaRatioSignAverage) === 1
- ? betaRatioSignAverage
- : betaRatioSignAverage.toFixed(2)
- return
- {category}
-
+ const displayValue =
+ Math.abs(betaRatioSignAverage) === 1
+ ? betaRatioSignAverage
+ : betaRatioSignAverage.toFixed(2);
+ return {category};
},
filterValue: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return null;
@@ -201,20 +200,18 @@ type BodyProps = {
entity: string;
};
-function Body({ studyLocusId, entity }: BodyProps) {
+function Body({ studyLocusId, entity }: BodyProps): ReactElement {
const variables = {
studyLocusId: studyLocusId,
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getData = useBatchQuery({
query: GWAS_COLOC_QUERY,
- variables: {
- studyLocusId,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.credibleSet.colocalisation",
size: table5HChunkSize,
});
diff --git a/packages/sections/src/credibleSet/Variants/Body.tsx b/packages/sections/src/credibleSet/Variants/Body.tsx
index dff9808dd..cf06c5115 100644
--- a/packages/sections/src/credibleSet/Variants/Body.tsx
+++ b/packages/sections/src/credibleSet/Variants/Body.tsx
@@ -133,7 +133,8 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
label: "Posterior Probability",
filterValue: false,
numeric: true,
- tooltip: "Posterior inclusion probability that this variant is causal within the fine-mapped credible set",
+ tooltip:
+ "Posterior inclusion probability that this variant is causal within the fine-mapped credible set",
comparator: (rowA, rowB) => rowA?.posteriorProbability - rowB?.posteriorProbability,
sortable: true,
renderCell: ({ posteriorProbability }) => {
@@ -145,7 +146,8 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
id: "logBF",
label: "log(BF)",
numeric: true,
- tooltip: "Natural logarithm of the Bayes Factor indicating relative likelihood of the variant being causal",
+ tooltip:
+ "Natural logarithm of the Bayes Factor indicating relative likelihood of the variant being causal",
filterValue: false,
sortable: true,
renderCell: ({ logBF }) => {
@@ -159,7 +161,7 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
tooltip: "Most severe consequence of the variant. Source: Ensembl VEP",
renderCell: ({ variant }) => {
- const mostSevereConsequence = variant?.mostSevereConsequence
+ const mostSevereConsequence = variant?.mostSevereConsequence;
if (!mostSevereConsequence) return naLabel;
const displayElement = (
@@ -169,7 +171,7 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
return displayElement;
},
exportValue: ({ variant }) => {
- return variant?.mostSevereConsequence.label
+ return variant?.mostSevereConsequence.label;
},
},
];
@@ -192,17 +194,15 @@ function Body({
}: BodyProps) {
const variables = {
studyLocusId: studyLocusId,
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getData = useBatchQuery({
query: VARIANTS_QUERY,
- variables: {
- studyLocusId,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.credibleSet.locus",
size: table5HChunkSize,
});
diff --git a/packages/sections/src/study/GWASCredibleSets/Body.tsx b/packages/sections/src/study/GWASCredibleSets/Body.tsx
index b94fce994..a2432d57c 100644
--- a/packages/sections/src/study/GWASCredibleSets/Body.tsx
+++ b/packages/sections/src/study/GWASCredibleSets/Body.tsx
@@ -14,9 +14,13 @@ import { naLabel, credsetConfidenceMap, initialResponse, table5HChunkSize } from
import { definition } from ".";
import Description from "./Description";
import GWAS_CREDIBLE_SETS_QUERY from "./GWASCredibleSetsQuery.gql";
-import { mantissaExponentComparator, nullishComparator, variantComparator } from "../../utils/comparators";
+import {
+ mantissaExponentComparator,
+ nullishComparator,
+ variantComparator,
+} from "../../utils/comparators";
import ManhattanPlot from "./ManhattanPlot";
-import { useEffect, useState } from "react";
+import { ReactElement, useEffect, useState } from "react";
import { responseType } from "ui/src/types/response";
const columns = [
@@ -120,7 +124,7 @@ const columns = [
comparator: nullishComparator(
(a, b) => a - b,
row => row?.l2GPredictions?.rows[0]?.score,
- false,
+ false
),
sortable: true,
tooltip:
@@ -144,9 +148,7 @@ const columns = [
numeric: true,
filterValue: false,
renderCell: ({ locus }) => {
- return typeof locus?.count === "number"
- ? locus.count.toLocaleString()
- : naLabel;
+ return typeof locus?.count === "number" ? locus.count.toLocaleString() : naLabel;
},
exportValue: ({ locus }) => locus?.count,
},
@@ -157,20 +159,18 @@ type BodyProps = {
entity: string;
};
-function Body({ id, entity }: BodyProps) {
+function Body({ id, entity }: BodyProps): ReactElement {
const variables = {
studyId: id,
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getData = useBatchQuery({
query: GWAS_CREDIBLE_SETS_QUERY,
- variables: {
- studyId: id,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.study.credibleSets",
size: table5HChunkSize,
});
diff --git a/packages/sections/src/study/SharedTraitStudies/Body.tsx b/packages/sections/src/study/SharedTraitStudies/Body.tsx
index c122aa94d..019215e45 100644
--- a/packages/sections/src/study/SharedTraitStudies/Body.tsx
+++ b/packages/sections/src/study/SharedTraitStudies/Body.tsx
@@ -1,13 +1,6 @@
-import { Fragment } from "react";
+import { Fragment, ReactElement } from "react";
import { Box, Typography } from "@mui/material";
-import {
- Link,
- SectionItem,
- Tooltip,
- PublicationsDrawer,
- OtTable,
- useBatchQuery,
-} from "ui";
+import { Link, SectionItem, Tooltip, PublicationsDrawer, OtTable, useBatchQuery } from "ui";
import { definition } from ".";
import Description from "./Description";
import { naLabel, initialResponse, table5HChunkSize } from "../../constants";
@@ -56,7 +49,7 @@ function getColumns(diseaseIds: string[]) {
label: "Sample size",
numeric: true,
renderCell: ({ nSamples }) => {
- return typeof nSamples === "number" ? nSamples.toLocaleString() : naLabel
+ return typeof nSamples === "number" ? nSamples.toLocaleString() : naLabel;
},
comparator: (a, b) => a?.nSamples - b?.nSamples,
sortable: true,
@@ -97,23 +90,26 @@ function getColumns(diseaseIds: string[]) {
getStudyCategory(projectId) === "FINNGEN"
? "FinnGen"
: cohorts?.length
- ? cohorts.join(", ")
- : null,
+ ? cohorts.join(", ")
+ : null,
},
{
id: "publication",
label: "Publication",
renderCell: ({ publicationFirstAuthor, publicationDate, pubmedId }) => {
if (!publicationFirstAuthor) return naLabel;
- return
+ return (
+
+ );
},
filterValue: ({ publicationYear, publicationFirstAuthor }) =>
`${publicationYear} ${publicationFirstAuthor}`,
- exportValue: ({ pubmedId }) =>
- `${pubmedId}`,
+ exportValue: ({ pubmedId }) => `${pubmedId}`,
},
];
}
@@ -121,23 +117,20 @@ function getColumns(diseaseIds: string[]) {
type BodyProps = {
studyId: string;
diseaseIds: string[];
- entity: string;
};
-export function Body({ studyId, diseaseIds, entity }: BodyProps) {
+export function Body({ studyId, diseaseIds }: BodyProps): ReactElement {
const variables = {
diseaseIds: diseaseIds,
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getData = useBatchQuery({
query: SHARED_TRAIT_STUDIES_QUERY,
- variables: {
- diseaseIds,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.studies",
size: table5HChunkSize,
});
From e411c1b6f648ca5506ceb22fe018a6b0b0c4d0d9 Mon Sep 17 00:00:00 2001
From: Graham McNeill
Date: Tue, 10 Dec 2024 10:21:02 +0000
Subject: [PATCH 112/120] [Platform]: fix gql playground for studies widget on
disease page (#614)
---
packages/sections/src/disease/GWASStudies/Body.tsx | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/packages/sections/src/disease/GWASStudies/Body.tsx b/packages/sections/src/disease/GWASStudies/Body.tsx
index 613e2a55e..e8cc92a8f 100644
--- a/packages/sections/src/disease/GWASStudies/Body.tsx
+++ b/packages/sections/src/disease/GWASStudies/Body.tsx
@@ -13,7 +13,7 @@ import { getStudyCategory } from "../../utils/getStudyCategory";
import GWAS_STUDIES_BODY_QUERY from "./GWASStudiesQuery.gql";
import { definition } from ".";
import { epmcUrl } from "ui/src/utils/urls";
-import { useEffect, useState } from "react";
+import { ReactElement, useEffect, useState } from "react";
import { responseType } from "ui/src/types/response";
const columns = [
@@ -116,20 +116,18 @@ type BodyProps = {
label: string;
};
-function Body({ id: efoId, label: diseaseName }: BodyProps) {
+function Body({ id: efoId, label: diseaseName }: BodyProps): ReactElement {
const variables = {
diseaseIds: [efoId],
+ size: table5HChunkSize,
+ index: 0,
};
const [request, setRequest] = useState(initialResponse);
const getData = useBatchQuery({
query: GWAS_STUDIES_BODY_QUERY,
- variables: {
- diseaseIds: variables.diseaseIds,
- size: table5HChunkSize,
- index: 0,
- },
+ variables,
dataPath: "data.studies",
size: table5HChunkSize,
});
From ea62e698330cc0bf886e09648a763c37e6f8ff96 Mon Sep 17 00:00:00 2001
From: Graham McNeill
Date: Tue, 10 Dec 2024 11:05:00 +0000
Subject: [PATCH 113/120] [Platform]: format values in sumstats popover (#615)
---
packages/ui/src/components/SummaryStatsTable.tsx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/packages/ui/src/components/SummaryStatsTable.tsx b/packages/ui/src/components/SummaryStatsTable.tsx
index a548d3ea3..687a4554c 100644
--- a/packages/ui/src/components/SummaryStatsTable.tsx
+++ b/packages/ui/src/components/SummaryStatsTable.tsx
@@ -24,6 +24,10 @@ const dicSummary = [
},
];
+function formatValue(v: number) {
+ return Number.isInteger(v) ? v.toLocaleString() : v.toPrecision(3);
+}
+
export default function SummaryStatsTable({ sumstatQCValues }: any) {
return (
<>
@@ -44,7 +48,7 @@ export default function SummaryStatsTable({ sumstatQCValues }: any) {
|
- {summStatValue}
+ {formatValue(summStatValue)}
);
From d786a19725e95ff1bfdcb8b8352b9ddedb5f85d8 Mon Sep 17 00:00:00 2001
From: Graham McNeill