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

feat: consequence column added to credset variants widget #552

Merged
merged 1 commit into from
Nov 22, 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
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!, $variantIds: [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
Loading