Skip to content

Commit

Permalink
[Platform]: Add directionality column to coloc widgets (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjmcn authored Nov 28, 2024
1 parent 92f61c7 commit 8f61c66
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 3 deletions.
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
}
}
}

0 comments on commit 8f61c66

Please sign in to comment.