Skip to content

Commit

Permalink
[Platform]: fix credible set size in credible set widgets (#600)
Browse files Browse the repository at this point in the history
* fix: credible set size in credible set widgets

* fix: stop using count and use length for posteriors
  • Loading branch information
d0choa authored Dec 9, 2024
1 parent 5aeaa02 commit 93e8657
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
14 changes: 7 additions & 7 deletions packages/sections/src/variant/GWASCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
},
sortable: true,
renderCell: ({ locus }) =>
locus.count > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
locus.rows.length > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
exportValue: ({ locus }) =>
locus.count > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
locus.rows.length > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
},
{
id: "finemappingMethod",
Expand Down Expand Up @@ -218,16 +218,16 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
{
id: "credibleSetSize",
label: "Credible set size",
comparator: (a, b) => a.locus?.count - b.locus?.count,
comparator: (a, b) => a.locusSize?.count - b.locusSize?.count,
sortable: true,
numeric: true,
filterValue: false,
renderCell: ({ locus }) => {
return typeof locus?.count === "number"
? locus.count.toLocaleString()
renderCell: ({ locusSize }) => {
return typeof locusSize?.count === "number"
? locusSize.count.toLocaleString()
: naLabel;
},
exportValue: ({ locus }) => locus?.count,
exportValue: ({ locusSize }) => locusSize?.count,
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ query GWASCredibleSetsQuery($variantId: String!, $size: Int!, $index: Int!) {
}
}
locus(variantIds: [$variantId]) {
count
rows {
posteriorProbability
}
}
locusSize: locus {
count
}
l2GPredictions(page: { size: 1, index: 1 }) {
rows {
target {
Expand Down
14 changes: 7 additions & 7 deletions packages/sections/src/variant/QTLCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
</>
),
renderCell: ({ locus }) =>
locus.count > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
locus.rows.length > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
exportValue: ({ locus }) =>
locus.count > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
locus.rows.length > 0 ? locus?.rows[0]?.posteriorProbability.toFixed(3) : naLabel,
},
{
id: "confidence",
Expand All @@ -197,15 +197,15 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
id: "credibleSetSize",
label: "Credible set size",
numeric: true,
comparator: (a, b) => a.locus?.count - b.locus?.count,
comparator: (a, b) => a.locusSize?.count - b.locusSize?.count,
sortable: true,
filterValue: false,
renderCell: ({ locus }) => {
return typeof locus?.count === "number"
? locus.count.toLocaleString()
renderCell: ({ locusSize }) => {
return typeof locusSize?.count === "number"
? locusSize.count.toLocaleString()
: naLabel;
},
exportValue: ({ locus }) => locus?.count,
exportValue: ({ locusSize }) => locusSize?.count,
},
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ query QTLCredibleSetsQuery($variantId: String!, $size: Int!, $index: Int!) {
}
}
locus(variantIds: [$variantId]) {
count
rows {
posteriorProbability
}
}
locusSize: locus {
count
}
}
}
}
Expand Down

0 comments on commit 93e8657

Please sign in to comment.