Skip to content

Commit

Permalink
feat:replace incomplete penetrance column with gene indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
dennishendriksen committed Jul 1, 2022
1 parent 7fbf272 commit 6f0da32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
31 changes: 22 additions & 9 deletions src/components/record/info/Gene.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import { Component, createMemo, Show } from "solid-js";
import { Anchor } from "../../Anchor";
import { FieldProps } from "../field/Field";
import { ValueString } from "@molgenis/vip-report-vcf/src/ValueParser";
import { ValueFlag, ValueString } from "@molgenis/vip-report-vcf/src/ValueParser";
import { getCsqInfo, getCsqInfoIndex } from "../../../utils/csqUtils";
import { Abbr } from "../../Abbr";

export const Gene: Component<FieldProps> = (props) => {
const symbol = (): string | null => props.info.value as ValueString;
const symbol = (): ValueString => props.info.value as ValueString;

const symbolSource = createMemo((): string | undefined => {
const symbolSource = createMemo((): ValueString | undefined => {
if (symbol() === null) return undefined;

const symbolSourceFieldIndex = getCsqInfoIndex(props.infoMeta, "SYMBOL_SOURCE");
return symbolSourceFieldIndex !== -1 ? (getCsqInfo(props.info, symbolSourceFieldIndex) as string) : undefined;
return symbolSourceFieldIndex !== -1 ? (getCsqInfo(props.info, symbolSourceFieldIndex) as ValueString) : undefined;
});

const geneId = createMemo((): string | undefined => {
const geneId = createMemo((): ValueString | undefined => {
if (symbol() === null) return undefined;

const geneFieldIndex = getCsqInfoIndex(props.infoMeta, "Gene");
return geneFieldIndex !== -1 ? (getCsqInfo(props.info, geneFieldIndex) as string) : undefined;
return geneFieldIndex !== -1 ? (getCsqInfo(props.info, geneFieldIndex) as ValueString) : undefined;
});

const href = (): string | undefined => {
Expand All @@ -31,12 +32,24 @@ export const Gene: Component<FieldProps> = (props) => {
return `https://www.genenames.org/tools/search/#!/?${queryString}`;
};

const incompletePenetrance = (): ValueFlag | undefined => {
const ipFieldIndex = getCsqInfoIndex(props.infoMeta, "IncompletePenetrance");
return ipFieldIndex !== -1 ? (getCsqInfo(props.info, ipFieldIndex) as ValueFlag) : undefined;
};

return (
<Show when={symbol()}>
{(symbol) => (
<Anchor href={href()}>
<span>{symbol}</span>
</Anchor>
<>
<Anchor href={href()}>
<span>{symbol}</span>
</Anchor>
{incompletePenetrance() && (
<sup class="ml-1">
<Abbr title="gene is known for incomplete penetrance" value="IP" />
</sup>
)}
</>
)}
</Show>
);
Expand Down
1 change: 0 additions & 1 deletion src/views/SampleVariants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export const SampleVariants: Component<{
"Consequence",
"SYMBOL",
"InheritanceModesGene",
"IncompletePenetrance",
"HPO",
"HGVSc",
"HGVSp",
Expand Down

0 comments on commit 6f0da32

Please sign in to comment.