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]: fix handle credible-set without lead variant #621

Merged
merged 5 commits into from
Dec 11, 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
3 changes: 3 additions & 0 deletions apps/platform/src/pages/CredibleSetPage/ProfileHeader.gql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ fragment CredibleSetProfileHeaderFragment on credibleSet {
standardError
}
}
locusSize: locus(page: { size: 1, index: 0 }) {
gjmcn marked this conversation as resolved.
Show resolved Hide resolved
count
}
variant {
chromosome
position
Expand Down
58 changes: 31 additions & 27 deletions apps/platform/src/pages/CredibleSetPage/ProfileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ function ProfileHeader() {
if (error) return null;

const credibleSet = data?.credibleSet;
const leadVariant = credibleSet?.locus?.rows?.[0] || {};
const beta = leadVariant.beta ?? credibleSet?.beta;
const standardError = leadVariant.standardError ?? credibleSet?.standardError;
const study = credibleSet?.study;
const target = study?.target;
const leadVariant = credibleSet?.locus.rows[0];
const beta = leadVariant?.beta ?? credibleSet?.beta;
const standardError = leadVariant?.standardError ?? credibleSet?.standardError;

const { pValueMantissa, pValueExponent } =
typeof leadVariant?.pValueMantissa === "number" &&
typeof leadVariant?.pValueExponent === "number"
typeof leadVariant?.pValueExponent === "number"
? leadVariant
: credibleSet ?? {};

Expand Down Expand Up @@ -169,24 +170,26 @@ function ProfileHeader() {
>
{credibleSet?.purityMinR2?.toPrecision(3)}
</Field>
{credibleSet?.qualityControls?.length > 0 &&
{credibleSet?.qualityControls?.length > 0 && (
<Box>
<DetailPopover title="QC warnings">
<ul style={{
display: "flex",
flexDirection: "column",
gap: "0.25rem",
padding: 0,
margin: "0 0 0 1rem"
}}>
<ul
style={{
display: "flex",
flexDirection: "column",
gap: "0.25rem",
padding: 0,
margin: "0 0 0 1rem",
}}
>
{credibleSet.qualityControls.map(warning => (
<li key={warning}>{warning}</li>
))}
</ul>
</DetailPopover>
</Box>
}
</Box >
)}
</Box>

<Box>
<Typography variant="subtitle1" mt={0}>
Expand Down Expand Up @@ -260,25 +263,26 @@ function ProfileHeader() {
{study?.analysisFlags?.join(", ")}
</Field>
<Field loading={loading} title="Summary statistics">
{!study?.hasSumstats
? "Not Available"
: study?.sumstatQCValues
? <DetailPopover title="Available">
<SummaryStatsTable sumstatQCValues={study.sumstatQCValues} />
</DetailPopover>
: "Available"
}
{!study?.hasSumstats ? (
"Not Available"
) : study?.sumstatQCValues ? (
<DetailPopover title="Available">
<SummaryStatsTable sumstatQCValues={study.sumstatQCValues} />
</DetailPopover>
) : (
"Available"
)}
</Field>
{study?.nSamples &&
{study?.nSamples && (
<Field loading={loading} title="Sample size">
<DisplaySampleSize
nSamples={study.nSamples}
cohorts={study?.cohorts}
initialSampleSize={study?.initialSampleSize}
/>
</Field>
}
{study?.ldPopulationStructure?.length > 0 &&
)}
{study?.ldPopulationStructure?.length > 0 && (
<Box display="flex" sx={{ gap: 1 }}>
{study.ldPopulationStructure.map(({ ldPopulation, relativeSampleSize }) => (
<LabelChip
Expand All @@ -289,9 +293,9 @@ function ProfileHeader() {
/>
))}
</Box>
}
)}
</Box>
</BaseProfileHeader >
</BaseProfileHeader>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ fragment VariantsSummaryFragment on credibleSet {
locus(variantIds: $variantIds) {
count
}
locusSize: locus(page: { size: 1, index: 0 }) {
count
}
}
2 changes: 1 addition & 1 deletion packages/sections/src/credibleSet/Variants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ export const definition = {
id,
name: "Credible Set Variants",
shortName: "VA",
hasData: data => data?.locus.count > 0,
hasData: data => data?.locus.count > 0 || data?.locusSize.count > 0,
};
Loading