Skip to content

Commit

Permalink
Merge branch 'main' of github.com:opentargets/ot-ui-apps into cc-upgr…
Browse files Browse the repository at this point in the history
…ade-react-router
  • Loading branch information
carcruz committed Dec 10, 2024
2 parents eb2dc64 + 2058ade commit 23c717f
Show file tree
Hide file tree
Showing 39 changed files with 496 additions and 384 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ function ProfileHeader() {
)}
{study?.studyType !== "gwas" && (
<>
{study?.projectId && (
<Field loading={loading} title="Project">
{study?.projectId?.replace(/_/gi, " ")}
</Field>
)}
{target?.id && (
<Field loading={loading} title="Affected gene">
<Link to={`../target/${target.id}`}>{target.approvedSymbol}</Link>
Expand Down
2 changes: 1 addition & 1 deletion apps/platform/src/pages/StudyPage/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Header({
);
}
sourceLink = {
id: "UKB",
id: "UKB-PPP",
url: "https://www.synapse.org/Synapse:syn51364943/wiki/622119",
};
} else {
Expand Down
1 change: 1 addition & 0 deletions apps/platform/src/pages/StudyPage/StudyProfileHeader.gql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fragment StudyProfileHeaderFragment on Gwas {
publicationJournal
pubmedId
traitFromSource
projectId
backgroundTraits {
id
name
Expand Down
14 changes: 11 additions & 3 deletions apps/platform/src/pages/StudyPage/StudyProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
SummaryStatsTable,
LabelChip,
DisplaySampleSize,
PublicationsDrawer,
} from "ui";
import { Box } from "@mui/material";
import { populationMap } from "../../constants";
Expand All @@ -33,6 +34,7 @@ function ProfileHeader() {
traitFromSource,
backgroundTraits,
diseases,
projectId,
target,
nCases,
nControls,
Expand Down Expand Up @@ -80,6 +82,11 @@ function ProfileHeader() {
)}
{studyType !== "gwas" && ( // QTL
<>
{projectId && (
<Field loading={loading} title="Project">
{projectId?.replace(/_/gi, " ")}
</Field>
)}
{target?.id && (
<Field loading={loading} title="Affected gene">
<Link to={`../target/${target.id}`}>{target.approvedSymbol}</Link>
Expand Down Expand Up @@ -108,9 +115,10 @@ function ProfileHeader() {
)}
{pubmedId &&
<Field loading={loading} title="PubMed">
<Link external to={`https://europepmc.org/article/med/${pubmedId}`}>
{pubmedId}
</Link>
<PublicationsDrawer
name={pubmedId}
entries={[{ name: pubmedId }]}
/>
</Field>
}
</Box>
Expand Down
11 changes: 11 additions & 0 deletions packages/sections/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,14 @@ export const initialResponse = {
error: null,
loading: true,
};

export const QTLStudyType = [
"scsqtl",
"sceqtl",
"scpqtl",
"sctuqtl",
"sqtl",
"eqtl",
"pqtl",
"tuqtl",
];
3 changes: 1 addition & 2 deletions packages/sections/src/credibleSet/GWASColoc/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const columns = [
: publicationFirstAuthor || naLabel;
},
exportValue: ({ otherStudyLocus }) => {
const { projectId, publicationFirstAuthor } = otherStudyLocus.study || {};
getStudyCategory(projectId) === "FINNGEN" ? "FinnGen" : publicationFirstAuthor;
return otherStudyLocus?.study?.publicationFirstAuthor;
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Description() {
return (
<>
Colocalisation metrics for overlapping credible sets from GWAS studies. Source:{" "}
<Link to="../" >
<Link to="https://home.opentargets.org/merged-product-documentation" external>
Open Targets
</Link>
</>
Expand Down
1 change: 1 addition & 0 deletions packages/sections/src/credibleSet/Locus2Gene/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const columns = [
if (!target) return naLabel;
return <Link to={`../target/${target?.id}`}>{target?.approvedSymbol}</Link>;
},
exportValue: ({ target }) => target?.id,
},
{
id: "score",
Expand Down
4 changes: 3 additions & 1 deletion packages/sections/src/credibleSet/Locus2Gene/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ function Description(): ReactElement {
return (
<>
Gene assignment based on machine-learning prioritisation of credible set features. Source:{" "}
<Link to="../">Open Targets</Link>
<Link to="https://home.opentargets.org/merged-product-documentation" external>
Open Targets
</Link>
</>
);
}
Expand Down
53 changes: 23 additions & 30 deletions packages/sections/src/credibleSet/MolQTLColoc/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { definition } from ".";
import Description from "./Description";
import MOLQTL_COLOC_QUERY from "./MolQTLColocQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { getStudyCategory } from "../../utils/getStudyCategory";
import { useEffect, useState } from "react";

const columns = [
Expand All @@ -35,45 +34,41 @@ const columns = [
},
},
{
id: "otherStudyLocus.study.traitFromSource",
label: "Reported trait",
id: "otherStudyLocus.study.studyType",
label: "Type",
renderCell: ({ otherStudyLocus }) => {
const trait = otherStudyLocus?.study?.traitFromSource;
if (!trait) return naLabel;
return trait;
const studyType = otherStudyLocus?.study?.studyType;
if (!studyType) return naLabel;
return studyType;
},
},
{
id: "otherStudyLocus.study.publicationFirstAuthor",
label: "First author",
id: "otherStudyLocus.study.target.approvedSymbol",
label: "Affected gene",
renderCell: ({ otherStudyLocus }) => {
const { projectId, publicationFirstAuthor } = otherStudyLocus?.study || {};
return getStudyCategory(projectId) === "FINNGEN"
? "FinnGen"
: publicationFirstAuthor || naLabel;
},
exportValue: ({ otherStudyLocus }) => {
const { projectId, publicationFirstAuthor } = otherStudyLocus.study || {};
getStudyCategory(projectId) === "FINNGEN" ? "FinnGen" : publicationFirstAuthor;
const target = otherStudyLocus?.study?.target;
if (!target) return naLabel;
return <Link to={`/target/${target.id}`}>{target.approvedSymbol}</Link>;
},
},

{
id: "otherStudyLocus.study.studyType",
id: "otherStudyLocus.study.biosample.biosampleName",
label: "Affected tissue/cell",
renderCell: ({ otherStudyLocus }) => {
const biosample = otherStudyLocus?.study?.biosample;
if (!biosample) return naLabel;
return <Link to={`../study/${biosample.biosampleId}`}>{biosample.name}</Link>;
return (
<Link external to={`https://www.ebi.ac.uk/ols4/search?q=${biosample.biosampleId}&ontology=uberon`}>
{biosample.biosampleName}
</Link>
);
},
},
{
id: "otherStudyLocus.study.studyType",
label: "QTL type",
renderCell: ({ otherStudyLocus }) => {
const studyType = otherStudyLocus?.study?.studyType;
if (!studyType) return naLabel;
return studyType;
},
id: "otherStudyLocus.study.condition",
label: "Condition",
renderCell: ({ otherStudyLocus }) => otherStudyLocus?.study?.condition || naLabel,
},
{
id: "otherStudyLocus.variant.id",
Expand Down Expand Up @@ -222,17 +217,15 @@ type BodyProps = {
function Body({ studyLocusId, entity }: BodyProps) {
const variables = {
studyLocusId: studyLocusId,
size: table5HChunkSize,
index: 0,
};

const [request, setRequest] = useState<responseType>(initialResponse);

const getData = useBatchQuery({
query: MOLQTL_COLOC_QUERY,
variables: {
studyLocusId,
size: table5HChunkSize,
index: 0,
},
variables,
dataPath: "data.credibleSet.colocalisation",
size: table5HChunkSize,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Description() {
return (
<>
Colocalisation metrics for overlapping credible sets from molecular QTL studies. Source:{" "}
<Link to="../" >
<Link to="https://home.opentargets.org/merged-product-documentation" external>
Open Targets
</Link>
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
query MolQTLColocQuery($studyLocusId: String!, $size: Int!, $index: Int!) {
credibleSet(studyLocusId: $studyLocusId) {
colocalisation(studyTypes: [tuqtl, pqtl, eqtl, sqtl], page: { size: $size, index: $index }) {
colocalisation(
studyTypes: [scsqtl, sceqtl, scpqtl, sctuqtl, sqtl, eqtl, pqtl, tuqtl]
page: { size: $size, index: $index }
) {
count
rows {
otherStudyLocus {
Expand All @@ -11,6 +14,7 @@ query MolQTLColocQuery($studyLocusId: String!, $size: Int!, $index: Int!) {
projectId
traitFromSource
publicationFirstAuthor
condition
target {
approvedSymbol
id
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fragment MolQTLColocSummaryFragment on credibleSet {
molqtlcolocalisation: colocalisation(
studyTypes: [tuqtl, pqtl, eqtl, sqtl]
studyTypes: [scsqtl, sceqtl, scpqtl, sctuqtl, sqtl, eqtl, pqtl, tuqtl]
page: { size: 1, index: 0 }
) {
count
Expand Down
4 changes: 2 additions & 2 deletions packages/sections/src/credibleSet/Variants/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
{
Expand Down Expand Up @@ -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);
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/sections/src/credibleSet/Variants/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function Description() {
return (
<>
Set of variants with 95% probability of containing the causal variant. Source:{" "}
<Link to="../" >
<Link to="https://home.opentargets.org/merged-product-documentation" external>
Open Targets
</Link>
</>
Expand Down
11 changes: 10 additions & 1 deletion packages/sections/src/evidence/GWASCredibleSets/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function getColumns(targetSymbol) {
renderCell: ({ credibleSet }) => {
return <Navigate to={`/credible-set/${credibleSet?.studyLocusId}`} />;
},
exportValue: ({ credibleSet }) => credibleSet?.studyLocusId,
},
{
id: "variantId",
Expand All @@ -45,26 +46,30 @@ function getColumns(targetSymbol) {
/>
</Link>
},
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 }) => <Link to={`/disease/${disease.id}`}>{disease.name}</Link>,
filterValue: ({ disease }) => disease.name,
exportValue: ({ disease }) => `${disease.name} (${disease.id})`,
},
{
id: "study",
label: "Study",
renderCell: ({ credibleSet }) => {
return <Link to={`/study/${credibleSet?.study.id}`}>{credibleSet?.study.id}</Link>;
},
exportValue: ({ credibleSet }) => credibleSet?.study.id,
},
{
id: "nSamples",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -176,6 +184,7 @@ function getColumns(targetSymbol) {
},
filterValue: ({ literature, publicationYear, publicationFirstAuthor }) =>
`${literature} ${publicationYear} ${publicationFirstAuthor}`,
exportValue: ({ credibleSet }) => credibleSet?.study.pubmedId,
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ function Description({ symbol, name }) {
<>
95% GWAS credible sets prioritisating <strong>{symbol}</strong> as likely causal gene for{" "}
<strong>{name}</strong>. Source:{" "}
<Link to={config.geneticsPortalUrl} external>
Open Targets Genetics
<Link to="https://home.opentargets.org/merged-product-documentation" external>
Open Targets
</Link>
</>
);
Expand Down
4 changes: 2 additions & 2 deletions packages/sections/src/evidence/GWASCredibleSets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
3 changes: 2 additions & 1 deletion packages/sections/src/study/GWASCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
},
{
Expand Down Expand Up @@ -134,6 +134,7 @@ const columns = [
</Tooltip>
);
},
exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.score,
},
{
id: "credibleSetSize",
Expand Down
Loading

0 comments on commit 23c717f

Please sign in to comment.