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]: Update genetics branch #430

Merged
merged 24 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
64dc79b
[Platform] Add Profile and ProfileHeader to variant page (#376)
gjmcn May 28, 2024
eed3ac4
[Platform]: variant page widgets init (#380)
gjmcn May 28, 2024
2ccf3a6
draft pharmacokinetics widget (#383)
gjmcn Jun 10, 2024
4e6c412
move reported protein link to description (#381)
gjmcn Jun 10, 2024
0108f75
Merge branch 'main' into ot-variant-page
gjmcn Jun 12, 2024
517da05
[Platform] Add GWAS credible sets widget to variant page (#390)
gjmcn Jun 19, 2024
5e76d1b
[Platform] Add QTL credible sets widget to variant page (#396)
gjmcn Jun 19, 2024
818042a
Merge branch 'main' of github.com:opentargets/ot-ui-apps into ot-vari…
carcruz Jun 19, 2024
bf8af85
Merge branch 'main' into ot-variant-page
gjmcn Jun 27, 2024
31c4aeb
[Platform] Add Uniprot id to Uniprot description link (#401)
gjmcn Jul 3, 2024
0a27b93
[Platform] Add allele frequency plot to variant page metadata section…
gjmcn Jul 3, 2024
3175582
[Platform] Clean up variant page sections and summaries (#404)
gjmcn Jul 3, 2024
65382c6
[Platform] Update variant page QTL credible sets widget (#406)
gjmcn Jul 3, 2024
f8ff9b7
[Platform] Use API for variant page header (#412)
gjmcn Jul 10, 2024
06b0bbf
Merge branch 'main' into ot-variant-page
gjmcn Jul 17, 2024
381cc8c
[Platform] Correct dbXref link in variant page header (#414)
gjmcn Jul 18, 2024
2d6f95a
Merge branch 'main' into ot-variant-page
gjmcn Jul 22, 2024
3190984
Merge branch 'main' into ot-variant-page
gjmcn Jul 22, 2024
eaeefb1
[Platform] Fix clinvar dbXref (#417)
gjmcn Jul 22, 2024
967a05c
[Platform] Use API for metadata in variant page (#420)
gjmcn Jul 22, 2024
33c08fe
[Platform] Use API data for in silico predictors widget on variant pa…
gjmcn Jul 24, 2024
3c0a399
[Platform] Minor improvements to variant page insilico predictors wid…
gjmcn Jul 29, 2024
a868b35
[Platform] Add VEP widget to variant page (#428)
gjmcn Jul 29, 2024
2aba87c
Merge branch 'genetics' of github.com:opentargets/ot-ui-apps into ot-…
carcruz Jul 29, 2024
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/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const client = new ApolloClient({
AlleleFrequency: {
keyFields: ["populationName"],
},
InSilicoPredictor: {
keyFields: ["method"],
},
},
}),
headers: { "OT-Platform": true },
Expand Down
57 changes: 27 additions & 30 deletions apps/platform/src/pages/VariantPage/Profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
summaryUtils,
} from "ui";

// import InSilicoPredictorsSummary from "sections/src/variant/InSilicoPredictors/Summary";
import InSilicoPredictorsSummary from "sections/src/variant/InSilicoPredictors/Summary";
import VariantEffectPredictorSummary from "sections/src/variant/VariantEffectPredictor/Summary";
// import EVASummary from "sections/src/variant/EVA/Summary";
// import UniProtVariantsSummary from "sections/src/variant/UniProtVariants/Summary";
// import QTLCredibleSetsSummary from "sections/src/variant/QTLCredibleSets/Summary";
Expand All @@ -18,78 +19,77 @@ import {
import client from "../../client";
import ProfileHeader from "./ProfileHeader";

// const InSilicoPredictorsSection = lazy(() => import("sections/src/variant/InSilicoPredictors/Body"));
const InSilicoPredictorsSection = lazy(
() => import("sections/src/variant/InSilicoPredictors/Body")
);
const VariantEffectPredictorSection = lazy(
() => import("sections/src/variant/VariantEffectPredictor/Body")
);
// const EVASection = lazy(() => import("sections/src/variant/EVA/Body"));
// const UniProtVariantsSection = lazy(() => import("sections/src/variant/UniProtVariants/Body"));
// const QTLCredibleSetsSection = lazy(() => import("sections/src/variant/QTLCredibleSets/Body"));
// const GWASCredibleSetsSection = lazy(() => import("sections/src/variant/GWASCredibleSets/Body"));
// const PharmacogenomicsSection = lazy(() => import("sections/src/variant/Pharmacogenomics/Body"));

const summaries = [
// InSilicoPredictorsSummary,
InSilicoPredictorsSummary,
VariantEffectPredictorSummary,
// EVASummary,
// UniProtVariantsSummary,
// QTLCredibleSetsSummary,
// GWASCredibleSetsSummary,
// PharmacogenomicsSummary,
];

// const VARIANT = "variant";
// const VARIANT_PROFILE_SUMMARY_FRAGMENT = summaryUtils.createSummaryFragment(summaries, "Variant");
// const VARIANT_PROFILE_QUERY = gql`
// query VariantProfileQuery($variantId: String!) {
// variant(variantId: $variantId) {
// variantId
// ...VariantProfileHeaderFragment
// ...VariantProfileSummaryFragment
// }
// }
// ${ProfileHeader.fragments.profileHeader}
// ${VARIANT_PROFILE_SUMMARY_FRAGMENT}
// `;

const VARIANT = "variant";
const VARIANT_PROFILE_SUMMARY_FRAGMENT = summaryUtils.createSummaryFragment(
summaries,
"VariantIndex"
);
const VARIANT_PROFILE_QUERY = gql`
query VariantProfileQuery($variantId: String!) {
variant(variantId: $variantId) {
variantId
...VariantProfileHeaderFragment
...VariantIndexProfileSummaryFragment
}
}
${ProfileHeader.fragments.profileHeader}
${VARIANT_PROFILE_SUMMARY_FRAGMENT}
`;

type ProfileProps = {
varId: string;
};

function Profile({ varId }: ProfileProps) {

return (

<PlatformApiProvider
entity={VARIANT}
query={VARIANT_PROFILE_QUERY}
variables={{ variantId: varId }}
client={client}
>

<ProfileHeader />

{/* <SummaryContainer>
<SummaryContainer>
<InSilicoPredictorsSummary />
<EVASummary />
<VariantEffectPredictorSummary />
{/* <EVASummary />
<UniProtVariantsSummary />
<QTLCredibleSetsSummary />
<GWASCredibleSetsSummary />
<PharmacogenomicsSummary />
<PharmacogenomicsSummary /> */}
</SummaryContainer>

<SectionContainer>
<Suspense fallback={<SectionLoader />}>
<InSilicoPredictorsSection id={varId} label='NO-LABEL!' entity={VARIANT} />
<InSilicoPredictorsSection id={varId} entity={VARIANT} />
</Suspense>
<Suspense fallback={<SectionLoader />}>
<VariantEffectPredictorSection id={varId} entity={VARIANT} />
</Suspense>
{/* <Suspense fallback={<SectionLoader />}>
<EVASection id={varId} label='NO-LABEL!' entity={VARIANT} />
</Suspense>
<Suspense fallback={<SectionLoader />}>
Expand All @@ -103,13 +103,10 @@ function Profile({ varId }: ProfileProps) {
</Suspense>
<Suspense fallback={<SectionLoader />}>
<PharmacogenomicsSection id={varId} label='NO-LABEL!' entity={VARIANT} />
</Suspense>
</SectionContainer> */}

</Suspense> */}
</SectionContainer>
</PlatformApiProvider>

);

}

export default Profile;
export default Profile;
156 changes: 51 additions & 105 deletions packages/sections/src/variant/InSilicoPredictors/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,92 +1,76 @@
// import { useQuery } from "@apollo/client";
import { useQuery } from "@apollo/client";
import { Typography } from "@mui/material";
import { Link, SectionItem, Tooltip, PublicationsDrawer, DataTable } from "ui";
import { SectionItem, Tooltip, DataTable } from "ui";
import { definition } from "../InSilicoPredictors";
import Description from "../InSilicoPredictors/Description";
import { epmcUrl } from "../../utils/urls";
import { identifiersOrgLink } from "../../utils/global";
import { defaultRowsPerPageOptions, naLabel, sectionsBaseSizeQuery,
} from "../../constants";
// import UNIPROT_VARIANTS_QUERY from "./UniprotVariantsQuery.gql";
import { defaultRowsPerPageOptions, naLabel } from "../../constants";
import IN_SILICO_PREDICTORS_QUERY from "./InSilicoPredictorsQuery.gql";

function getColumns(label: string) {
return [
{
id: "method",
label: "Method",
},
{
id: "assessment",
label: "Prediction",
renderCell: ({ assessment, flag }) => (
flag
? (
<Tooltip
title={
<>
<Typography variant="subtitle2" display="block" align="center">
Flag: {flag}
</Typography>
</>
}
showHelpIcon
>
{assessment ?? naLabel}
</Tooltip>
) : (
assessment ?? naLabel
)
)
},
{
id: "score",
label: "Score",
},
];
}
const columns = [
{
id: "method",
label: "Method",
},
{
id: "assessment",
label: "Prediction",
renderCell: ({ assessment, assessmentFlag }) =>
assessmentFlag ? (
<Tooltip
title={
<>
<Typography variant="subtitle2" display="block" align="center">
Flag: {assessmentFlag}
</Typography>
</>
}
showHelpIcon
>
{assessment ?? naLabel}
</Tooltip>
) : (
assessment ?? naLabel
),
},
{
id: "score",
label: "Score",
renderCell: ({ score }) => score ?? naLabel,
},
];

type BodyProps = {
id: string,
label: string,
entity: string,
id: string;
entity: string;
};

export function Body({ id, entity }: BodyProps) {
const variables = {
variantId: id,
};

export function Body({ id, label, entity }) {

// const variables = {
// ensemblId: ensgId,
// efoId,
// size: sectionsBaseSizeQuery,
// };

const columns = getColumns(label);

// const request = useQuery(UNIPROT_VARIANTS_QUERY, {
// variables,
// });
const request = mockQuery();
const request = useQuery(IN_SILICO_PREDICTORS_QUERY, {
variables,
});

return (
<SectionItem
definition={definition}
request={request}
entity={entity}
renderDescription={() => <Description variantId={id} />}
renderBody={() => {
// const rows = request.data.variant.inSilicoPredictors;
const rows =
[...request.data.variant.inSilicoPredictors].sort((row1, row2) => {
return row1.method.localeCompare(row2.method);
});
renderBody={({ variant }) => {
const rows = [...variant.inSilicoPredictors].sort((row1, row2) => {
return row1.method.localeCompare(row2.method);
});
return (
<DataTable
columns={columns}
rows={rows}
dataDownloader
rowsPerPageOptions={defaultRowsPerPageOptions}
// query={UNIPROT_VARIANTS_QUERY.loc.source.body}
// variables={variables}
query={IN_SILICO_PREDICTORS_QUERY.loc.source.body}
variables={variables}
/>
);
}}
Expand All @@ -95,41 +79,3 @@ export function Body({ id, label, entity }) {
}

export default Body;

function mockQuery() {
return {
loading: false,
error: undefined,
data: JSON.parse(`
{
"variant": {
"inSilicoPredictors": [
{
"method": "alphaMissense",
"score": 0.077,
"assessment": "likely_benign"
},
{
"method": "phred scaled CADD",
"score": 7.293
},
{
"method": "sift max",
"score": 0.2,
"assessment": "MODERATE"
},
{
"method": "polyphen max",
"score": 0.069,
"assessment": "tolerated"
},
{
"method": "loftee",
"assessment": "high-confidence LoF variant",
"flag": "PHYLOCSF_WEAK"
}
]
}
}`),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ type DescriptionProps = {
function Description({ variantId }: DescriptionProps) {
return (
<>
Predicted functional effect of <strong>{variantId}</strong>. {" "}Source:{" "}
Predicted functional effect of <strong>{variantId}</strong>. Source:{" "}
<Link to="https://www.ensembl.org/info/docs/tools/vep/index.html" external>
VEP
</Link>
,{" "}
<Link to="https://gnomad.broadinstitute.org/" external>
gnomAD
</Link>
</>
);
}

export default Description;
export default Description;
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
query InSilicoPredictorsQuery($variantId: String!) {
variant(variantId: $variantId) {
variantId
inSilicoPredictors {
method
assessment
score
assessmentFlag
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fragment InSilicoPredictorsSummaryFragment on VariantIndex {
inSilicoPredictors {
method
}
}
Loading
Loading