Skip to content

Commit

Permalink
[Platform]: consequence column added to credset variants widget (#552)
Browse files Browse the repository at this point in the history
  • Loading branch information
d0choa authored Nov 22, 2024
1 parent c859339 commit bf7e68a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
24 changes: 24 additions & 0 deletions packages/sections/src/credibleSet/Variants/Body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ import { definition } from ".";
import Description from "./Description";
import VARIANTS_QUERY from "./VariantsQuery.gql";
import { mantissaExponentComparator, variantComparator } from "../../utils/comparators";
import { identifiersOrgLink } from "../../utils/global";

type getColumnsType = {
leadVariantId: string;
leadReferenceAllele: string;
leadAlternateAllele: string;
};

function formatVariantConsequenceLabel(label) {
return label.replace(/_/g, " ");
}

function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }: getColumnsType) {
return [
{
Expand Down Expand Up @@ -132,6 +137,25 @@ function getColumns({ leadVariantId, leadReferenceAllele, leadAlternateAllele }:
return logBF.toPrecision(3);
},
},
{
id: "variant.mostSevereConsequence.label",
label: "Predicted consequence",
tooltip: "Most severe consequence of the variant. Source: Ensembl VEP",

renderCell: ({ variant }) => {
const mostSevereConsequence = variant?.mostSevereConsequence
if (!mostSevereConsequence) return naLabel;
const displayElement = (
<Link external to={identifiersOrgLink("SO", mostSevereConsequence.id.slice(3))}>
{formatVariantConsequenceLabel(mostSevereConsequence.label)}
</Link>
);
return displayElement;
},
exportValue: ({ variant }) => {
return variant?.mostSevereConsequence.label
},
},
];
}

Expand Down
4 changes: 4 additions & 0 deletions packages/sections/src/credibleSet/Variants/VariantsQuery.gql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ query VariantsQuery($studyLocusId: String!) {
position
referenceAllele
alternateAllele
mostSevereConsequence {
id
label
}
}
pValueMantissa
pValueExponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { naLabel } from "../../constants";
import { identifiersOrgLink } from "../../utils/global";
import VARIANT_EFFECT_PREDICTOR_QUERY from "./VariantEffectPredictorQuery.gql";


function formatVariantConsequenceLabel(label) {
return label.replace(/_/g, " ");
}
Expand Down Expand Up @@ -81,7 +82,7 @@ const columns = [
{
id: "variantConsequences.label",
label: "Predicted consequence",
renderCell: ({ variantConsequences, aminoAcidChange, codons, uniprotAccessions }) => {
renderCell: ({ variantConsequences, aminoAcidChange, codons }) => {
if (!variantConsequences?.length) return naLabel;
let displayElement = variantConsequences.map(({ id, label }, i, arr) => (
<Fragment key={id}>
Expand Down

0 comments on commit bf7e68a

Please sign in to comment.