Skip to content

Commit

Permalink
[Platform]: fix several issues in exports (#608)
Browse files Browse the repository at this point in the history
* feat: gwas credible set exports

* fix: molQTL cred sets add affectetd tissue cell

* fix: l2g score in gwas cred set in study page

* fix: shared trait studies export in study page

* fix: l2g widget in credible set page to export gene

* fix: first author in gwas colocalisation

* fix: transcript consequences export

* fix: minor tweak to a header

* fix: wrong query returning no top L2G in credible set widget

* fix: credible set exports and bugs
  • Loading branch information
d0choa authored Dec 9, 2024
1 parent cb58479 commit a558eff
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion apps/platform/src/pages/StudyPage/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Header({
);
}
sourceLink = {
id: "UKB",
id: "UKB-PPP",
url: "https://www.synapse.org/Synapse:syn51364943/wiki/622119",
};
} else {
Expand Down
3 changes: 1 addition & 2 deletions packages/sections/src/credibleSet/GWASColoc/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ const columns = [
: publicationFirstAuthor || naLabel;
},
exportValue: ({ otherStudyLocus }) => {
const { projectId, publicationFirstAuthor } = otherStudyLocus.study || {};
getStudyCategory(projectId) === "FINNGEN" ? "FinnGen" : publicationFirstAuthor;
return otherStudyLocus?.study?.publicationFirstAuthor;
},
},
{
Expand Down
1 change: 1 addition & 0 deletions packages/sections/src/credibleSet/Locus2Gene/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const columns = [
if (!target) return naLabel;
return <Link to={`../target/${target?.id}`}>{target?.approvedSymbol}</Link>;
},
exportValue: ({ target }) => target?.id,
},
{
id: "score",
Expand Down
11 changes: 10 additions & 1 deletion packages/sections/src/evidence/GWASCredibleSets/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function getColumns(targetSymbol) {
renderCell: ({ credibleSet }) => {
return <Navigate to={`/credible-set/${credibleSet?.studyLocusId}`} />;
},
exportValue: ({ credibleSet }) => credibleSet?.studyLocusId,
},
{
id: "variantId",
Expand All @@ -45,26 +46,30 @@ function getColumns(targetSymbol) {
/>
</Link>
},
filterValue: ({ variant: v }) =>
filterValue: ({ credibleSet: { variant: v } }) =>
`${v?.chromosome}_${v?.position}_${v?.referenceAllele}_${v?.alternateAllele}`,
exportValue: ({ credibleSet: { variant: v } }) => `${v?.chromosome}_${v?.position}_${v?.referenceAllele}_${v?.alternateAllele}`,
},
{
id: "trait",
label: "Reported trait",
renderCell: ({ credibleSet }) => credibleSet?.study.traitFromSource,
exportValue: ({ credibleSet }) => credibleSet?.study.traitFromSource,
},
{
id: "disease",
label: "Disease/phenotype",
renderCell: ({ disease }) => <Link to={`/disease/${disease.id}`}>{disease.name}</Link>,
filterValue: ({ disease }) => disease.name,
exportValue: ({ disease }) => `${disease.name} (${disease.id})`,
},
{
id: "study",
label: "Study",
renderCell: ({ credibleSet }) => {
return <Link to={`/study/${credibleSet?.study.id}`}>{credibleSet?.study.id}</Link>;
},
exportValue: ({ credibleSet }) => credibleSet?.study.id,
},
{
id: "nSamples",
Expand All @@ -76,6 +81,7 @@ function getColumns(targetSymbol) {
? parseInt(credibleSet?.study.nSamples, 10).toLocaleString()
: naLabel,
filterValue: ({ credibleSet }) => parseInt(credibleSet?.study.nSamples, 10).toLocaleString(),
exportValue: ({ credibleSet }) => credibleSet?.study.nSamples,
},
{
id: "pValue",
Expand Down Expand Up @@ -126,11 +132,13 @@ function getColumns(targetSymbol) {
);
},
filterValue: ({ credibleSet }) => credsetConfidenceMap[credibleSet?.confidence],
exportValue: ({ credibleSet }) => credibleSet?.confidence,
},
{
id: "finemappingMethod",
label: "Fine-mapping method",
renderCell: ({ credibleSet }) => credibleSet?.finemappingMethod || naLabel,
exportValue: ({ credibleSet }) => credibleSet?.finemappingMethod,
},
{
id: "score",
Expand Down Expand Up @@ -176,6 +184,7 @@ function getColumns(targetSymbol) {
},
filterValue: ({ literature, publicationYear, publicationFirstAuthor }) =>
`${literature} ${publicationYear} ${publicationFirstAuthor}`,
exportValue: ({ credibleSet }) => credibleSet?.study.pubmedId,
},
];
}
Expand Down
1 change: 1 addition & 0 deletions packages/sections/src/study/GWASCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const columns = [
</Tooltip>
);
},
exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.score,
},
{
id: "credibleSetSize",
Expand Down
3 changes: 3 additions & 0 deletions packages/sections/src/study/SharedTraitStudies/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function getColumns(diseaseIds: string[]) {
id: "studyId",
label: "Study",
renderCell: ({ id }) => <Link to={`./${id}`}>{id}</Link>,
exportValue: ({ id }) => id,
},
{
id: "sharedDiseases",
Expand Down Expand Up @@ -111,6 +112,8 @@ function getColumns(diseaseIds: string[]) {
},
filterValue: ({ publicationYear, publicationFirstAuthor }) =>
`${publicationYear} ${publicationFirstAuthor}`,
exportValue: ({ pubmedId }) =>
`${pubmedId}`,
},
];
}
Expand Down
4 changes: 3 additions & 1 deletion packages/sections/src/variant/GWASCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
if (!study) return naLabel;
return <Link to={`../study/${study.id}`}>{study.id}</Link>;
},
exportValue: ({ study }) => study?.id,
},
{
id: "pValue",
Expand Down Expand Up @@ -193,7 +194,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
const { target } = l2GPredictions?.rows[0];
return <Link to={`/target/${target.id}`}>{target.approvedSymbol}</Link>;
},
exportValue: ({ l2GPredictions }) => l2GPredictions?.target.approvedSymbol,
exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.target.approvedSymbol,
},
{
id: "l2gScore",
Expand All @@ -214,6 +215,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
</Tooltip>
);
},
exportValue: ({ l2GPredictions }) => l2GPredictions?.rows[0]?.score,
},
{
id: "credibleSetSize",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ query GWASCredibleSetsQuery($variantId: String!, $size: Int!, $index: Int!) {
locusSize: locus {
count
}
l2GPredictions(page: { size: 1, index: 1 }) {
l2GPredictions(page: { size: 1, index: 0 }) {
rows {
target {
id
Expand Down
1 change: 1 addition & 0 deletions packages/sections/src/variant/QTLCredibleSets/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ function getColumns({ id, referenceAllele, alternateAllele }: getColumnsType) {
</Link>
);
},
exportValue: ({ study }) => { return `[${study?.biosample?.biosampleId}]:${study?.biosample?.biosampleName}`},
},
{
id: "study.condition",
Expand Down
8 changes: 8 additions & 0 deletions packages/sections/src/variant/VariantEffectPredictor/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ const columns = [
}
return displayElement;
},
exportValue: ({ target, transcriptId, uniprotAccessions, aminoAcidChange }) => {
const geneInfo = `Gene: ${target?.id};`;
const canonicalTranscript = transcriptId ? `Canonical transcript: ${transcriptId};` : "";
const biotype = `Biotype: ${target?.biotype};`;
const protein = uniprotAccessions?.length ? `Protein(s): ${uniprotAccessions.join(", ")}` : "";
const aaChange = aminoAcidChange ? `AA: ${aminoAcidChange};` : "";
return [geneInfo, canonicalTranscript, biotype, protein, aaChange].join("");
}
},
{
id: "variantConsequences.label",
Expand Down

0 comments on commit a558eff

Please sign in to comment.