Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Platform]: Add directionality column to coloc widgets #572

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion packages/sections/src/credibleSet/GWASColoc/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { useQuery } from "@apollo/client";
import { Link, SectionItem, DisplayVariantId, ScientificNotation, OtTable } from "ui";
import {
Link,
SectionItem,
DisplayVariantId,
ScientificNotation,
OtTable,
Tooltip,
} from "ui";
import { naLabel } from "../../constants";
import { definition } from ".";
import Description from "./Description";
Expand Down Expand Up @@ -114,6 +121,36 @@ const columns = [
id: "colocalisationMethod",
label: "Colocalisation Method",
},
{
id: "betaRatioSignAverage",
label: "Directionality",
tooltip: "Effect directionality based on the ratio of betas between the two credible sets",
renderCell: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return naLabel;
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 <Tooltip title={`Beta ratio sign average: ${displayValue}`}>
{category}
</Tooltip>
},
filterValue: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return null;
if (betaRatioSignAverage <= -0.99) return "Opposite";
else if (betaRatioSignAverage >= 0.99) return "Same";
return "Inconclusive";
},
sortable: false,
exportValue: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return null;
if (betaRatioSignAverage <= -0.99) return "Opposite";
else if (betaRatioSignAverage >= 0.99) return "Same";
return "Inconclusive";
},
},
{
id: "h3",
label: "H3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ query GWASColocQuery($studyLocusId: String!) {
h3
h4
clpp
betaRatioSignAverage
}
}
}
41 changes: 39 additions & 2 deletions packages/sections/src/credibleSet/GWASMolQTL/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { useQuery } from "@apollo/client";
import { Link, SectionItem, DisplayVariantId, ScientificNotation, OtTable } from "ui";
import {
Link,
SectionItem,
DisplayVariantId,
ScientificNotation,
OtTable,
Tooltip,
} from "ui";
import { naLabel } from "../../constants";
import { definition } from ".";
import Description from "./Description";
Expand All @@ -16,7 +23,7 @@ const columns = [
label: "Navigate",
renderCell: ({ otherStudyLocus }) => {
if (!otherStudyLocus?.variant) return naLabel;
return(<Box sx={{ display: "flex" }}>
return (<Box sx={{ display: "flex" }}>
<Link to={`./${otherStudyLocus.studyLocusId}`}>
<FontAwesomeIcon icon={faArrowRightToBracket} />
</Link>
Expand Down Expand Up @@ -132,6 +139,36 @@ const columns = [
id: "colocalisationMethod",
label: "Colocalisation Method",
},
{
id: "betaRatioSignAverage",
label: "Directionality",
tooltip: "Effect directionality based on the ratio of betas between the two credible sets",
renderCell: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return naLabel;
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 <Tooltip title={`Beta ratio sign average: ${displayValue}`}>
{category}
</Tooltip>
},
filterValue: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return null;
if (betaRatioSignAverage <= -0.99) return "Opposite";
else if (betaRatioSignAverage >= 0.99) return "Same";
return "Inconclusive";
},
sortable: false,
exportValue: ({ betaRatioSignAverage }) => {
if (betaRatioSignAverage == null) return null;
if (betaRatioSignAverage <= -0.99) return "Opposite";
else if (betaRatioSignAverage >= 0.99) return "Same";
return "Inconclusive";
},
},
{
id: "h3",
label: "H3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ query GWASMolQTLColocQuery($studyLocusId: String!) {
h3
h4
clpp
betaRatioSignAverage
}
}
}