Skip to content

Commit

Permalink
[Platform]: QTL studytype in queries (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
carcruz authored Dec 9, 2024
1 parent 7e2cebf commit b19b288
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 23 deletions.
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",
];
8 changes: 3 additions & 5 deletions packages/sections/src/credibleSet/MolQTLColoc/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,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
@@ -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 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
23 changes: 9 additions & 14 deletions packages/sections/src/variant/QTLCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { credsetConfidenceMap, initialResponse, naLabel, table5HChunkSize } from
import { definition } from ".";
import Description from "./Description";
import QTL_CREDIBLE_SETS_QUERY from "./QTLCredibleSetsQuery.gql";
import { mantissaExponentComparator, nullishComparator, variantComparator } from "../../utils/comparators";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { ReactNode, useEffect, useState } from "react";
import { responseType } from "ui/src/types/response";

Expand All @@ -29,9 +29,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
{
id: "studyLocusId",
label: "Navigate",
renderCell: ({ studyLocusId }) => (
<Navigate to={`/credible-set/${studyLocusId}`} />
),
renderCell: ({ studyLocusId }) => <Navigate to={`/credible-set/${studyLocusId}`} />,
},
{
id: "leadVariant",
Expand Down Expand Up @@ -153,8 +151,9 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
filterValue: false,
sortable: true,
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
);
},
tooltip: (
<>
Expand Down Expand Up @@ -201,9 +200,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
sortable: 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,
},
Expand All @@ -218,17 +215,15 @@ type BodyProps = {
function Body({ id, entity }: BodyProps): ReactNode {
const variables = {
variantId: id,
size: table5HChunkSize,
index: 0,
};

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

const getAllQtlData = useBatchQuery({
query: QTL_CREDIBLE_SETS_QUERY,
variables: {
variantId: id,
size: table5HChunkSize,
index: 0,
},
variables,
dataPath: "data.variant.qtlCredibleSets",
size: table5HChunkSize,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ query QTLCredibleSetsQuery($variantId: String!, $size: Int!, $index: Int!) {
referenceAllele
alternateAllele
qtlCredibleSets: credibleSets(
studyTypes: [sqtl, pqtl, eqtl, tuqtl]
studyTypes: [scsqtl, sceqtl, scpqtl, sctuqtl, sqtl, eqtl, pqtl, tuqtl]
page: { size: $size, index: $index }
) {
count
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fragment QTLCredibleSetsSummaryFragment on Variant {
qtlCredibleSets: credibleSets(
studyTypes: [sqtl, pqtl, eqtl, tuqtl]
studyTypes: [scsqtl, sceqtl, scpqtl, sctuqtl, sqtl, eqtl, pqtl, tuqtl]
page: { size: 1, index: 0 }
) {
count
Expand Down

0 comments on commit b19b288

Please sign in to comment.