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

PoC original straglr #325

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ script:
- pnpm run test
before_deploy:
- pnpm run build
- mv dist/index.html dist/vip-report-template.html
- mv dist/vip-template-6.2.0-str-poc.html dist/vip-report-template.html
deploy:
- provider: npm
api_token:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@molgenis/vip-report-template",
"version": "6.2.0",
"version": "6.2.0-str-poc",
"description": "Report Template for Variant Call Format (VCF) Report Generator",
"scripts": {
"build": "vite build",
Expand Down Expand Up @@ -36,8 +36,8 @@
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.5.2",
"@fortawesome/free-solid-svg-icons": "^6.5.2",
"@molgenis/vip-report-api": "^5.0.4",
"@molgenis/vip-report-vcf": "^2.0.2",
"@molgenis/vip-report-api": "link:C:/Users/bartc/WebstormProjects/vip-report-api/",
"@molgenis/vip-report-vcf": "link:C:/Users/bartc/WebstormProjects/vip-report-vcf/",
"@solidjs/router": "^0.13.5",
"base64-js": "^1.5.1",
"igv": "^2.15.11",
Expand Down
18 changes: 4 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/assets/sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,7 @@ table.is-borderless td,
margin-top: 8px;
overflow-y: auto;
max-height: calc(100vh - 78px) !important;
}
}

table.alternating tr:nth-child(even) {background-color: #DCDCDC;}
table.not_alternating tr {background-color: transparent;}
4 changes: 3 additions & 1 deletion src/components/InfoCollapsablePane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import { Info } from "./record/Info";
import { FieldValue } from "./record/field/Field";
import { isCsqInfo } from "../utils/csqUtils";
import { useLocation, A } from "@solidjs/router";
import { FieldHeader } from "./FieldHeader";

export const InfoCollapsablePane: Component<{
fields: FieldMetadata[];
record: Item<Record>;
htsFileMeta: HtsFileMetadata;
isPossibleCompound?: boolean;
}> = (props) => {
const [collapsed, setCollapsed]: Signal<boolean> = createSignal(false);
const [collapsed, setCollapsed]: Signal<boolean> = createSignal(true);

function toggleCollapse() {
setCollapsed(!collapsed());
Expand Down Expand Up @@ -53,6 +54,7 @@ export const InfoCollapsablePane: Component<{
<For each={props.fields}>
{(field, i) => (
<td>
<FieldHeader field={field} />
<For each={values()[i()]}>
{(value, j) => (
<>
Expand Down
141 changes: 114 additions & 27 deletions src/components/VariantsSampleTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { Pos } from "./record/Pos";
import { HtsFileMetadata, Item, Sample } from "@molgenis/vip-report-api/src/Api";
import { GenotypeField } from "./record/format/GenotypeField";
import { InfoCollapsablePane } from "./InfoCollapsablePane";
import { Component, createMemo, createSignal, For, onMount, Show } from "solid-js";
import { Component, createMemo, createSignal, For, Match, onMount, Show, Switch } from "solid-js";
import { A } from "@solidjs/router";
import { FieldMetadata } from "@molgenis/vip-report-vcf/src/MetadataParser";
import { FieldHeader } from "./FieldHeader";
import { Abbr } from "./Abbr";
import { abbreviateHeader } from "../utils/field";
import {
Expand All @@ -19,6 +18,8 @@ import {
getSampleMother,
getSampleSexLabel,
} from "../utils/sample";
import { Info } from "./record/Info";
import { Format } from "./record/Format";

export const VariantsSampleTable: Component<{
item: Item<Sample>;
Expand Down Expand Up @@ -50,7 +51,7 @@ export const VariantsSampleTable: Component<{
<div style={{ display: "grid" }}>
{/* workaround for https://github.com/jgthms/bulma/issues/2572#issuecomment-523099776 */}
<div class="table-container">
<table class="table is-narrow">
<table class="table is-narrow alternating">
<thead>
<tr>
<th>Position</th>
Expand Down Expand Up @@ -83,9 +84,7 @@ export const VariantsSampleTable: Component<{
</th>
)}
</For>
{/* column containing collapse/expand icon */}
<th />
<For each={props.nestedFields}>{(field) => <FieldHeader field={field} />}</For>
<th colSpan={props.nestedFields.length + 1}>Information</th>
</tr>
</thead>
<tbody>
Expand All @@ -105,14 +104,39 @@ export const VariantsSampleTable: Component<{
<Show when={proband()} keyed>
{(proband) => (
<td>
<GenotypeField
genotype={record.data.s[proband.index]["GT"] as Genotype}
refAllele={record.data.r}
altAlleles={record.data.a}
isAbbreviate={true}
allelicBalance={record.data.s[proband.index]["VIAB"] as number | undefined | null}
readDepth={record.data.s[proband.index]["DP"] as number | undefined}
/>
<Switch fallback={<td>Huh?</td>}>
<Match when={record.data.n["SVTYPE"] !== "STR"}>
<GenotypeField
genotype={record.data.s[proband.index]["GT"] as Genotype}
refAllele={record.data.r}
altAlleles={record.data.a}
isAbbreviate={true}
allelicBalance={record.data.s[proband.index]["VIAB"] as number | undefined | null}
readDepth={record.data.s[proband.index]["DP"] as number | undefined}
/>
</Match>
<Match when={record.data.n["SVTYPE"] === "STR"}>
<Format
format={record.data.s[proband.index]["AC"]}
formatMetadata={props.recordsMetadata.format["AC"]}
record={record}
isAbbreviate={false}
allelicBalance={record.data.s[proband.index]["VIAB"] as number | undefined | null}
readDepth={record.data.s[proband.index]["DP"] as number | undefined}
/>
<br />
(
<Format
format={record.data.s[proband.index]["ACR"]}
formatMetadata={props.recordsMetadata.format["ACR"]}
record={record}
isAbbreviate={false}
allelicBalance={record.data.s[proband.index]["VIAB"] as number | undefined | null}
readDepth={record.data.s[proband.index]["DP"] as number | undefined}
/>
)
</Match>
</Switch>
</td>
)}
</Show>
Expand Down Expand Up @@ -160,19 +184,82 @@ export const VariantsSampleTable: Component<{
</>
)}
</For>
<Show when={proband()} keyed>
{(proband) => (
<InfoCollapsablePane
fields={props.nestedFields}
record={record}
htsFileMeta={props.htsFileMeta}
isPossibleCompound={
record.data.s[proband.index]["VIC"] !== null &&
record.data.s[proband.index]["VIC"] !== undefined
}
/>
)}
</Show>
<Switch fallback={<td>Huh?</td>}>
<Match when={record.data.n["SVTYPE"] !== "STR"}>
<Show when={proband()} keyed>
{(proband) => (
<td>
<InfoCollapsablePane
fields={props.nestedFields}
record={record}
htsFileMeta={props.htsFileMeta}
isPossibleCompound={
record.data.s[proband.index]["VIC"] !== null &&
record.data.s[proband.index]["VIC"] !== undefined
}
/>
</td>
)}
</Show>
</Match>
<Match when={record.data.n["SVTYPE"] === "STR"}>
<td>
<div class="columns">
<div class="column is-one-third">
<b>Gene ID: </b>
<Info
info={{ value: record.data.n["Gene_id"], record: record }}
infoMeta={props.recordsMetadata.info["Gene_id"]}
context={{}}
/>
<br />
<b>Normal maximum: </b>
<Info
info={{ value: record.data.n["NormalMax"], record: record }}
infoMeta={props.recordsMetadata.info["NormalMax"]}
context={{}}
/>
</div>
<div class="column is-one-third">
<b>Locus ID: </b>
<Info
info={{ value: record.data.n["Repeat_id"], record: record }}
infoMeta={props.recordsMetadata.info["Repeat_id"]}
context={{}}
/>
<br />
<b>Pathogenic minimum: </b>
<Info
info={{ value: record.data.n["PathogenicMin"], record: record }}
infoMeta={props.recordsMetadata.info["PathogenicMin"]}
context={{}}
/>
</div>
<div class="column is-one-third">
<b>Disease: </b>
<Info
info={{ value: record.data.n["Disease"], record: record }}
infoMeta={props.recordsMetadata.info["Disease"]}
context={{}}
/>
<br />
<b>Called repeat / catalog repeat: </b>
<Info
info={{ value: record.data.n["RU"], record: record }}
infoMeta={props.recordsMetadata.info["RU"]}
context={{}}
/>{" "}
/{" "}
<Info
info={{ value: record.data.n["repeat_unit"], record: record }}
infoMeta={props.recordsMetadata.info["repeat_unit"]}
context={{}}
/>
</div>
</div>
</td>
</Match>
</Switch>
</tr>
)}
</For>
Expand Down
2 changes: 1 addition & 1 deletion src/components/record/field/FieldSingleValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const FieldSingleValue: Component<{
const type = () => props.infoMetadata.type;
return (
<Switch fallback={<Error error={`invalid info type ${type()}`} />}>
<Match when={type() === "CATEGORICAL" || type() === "STRING"}>
<Match when={type() === "CATEGORICAL" || type() === "STRING" || type() === "RANGE"}>
<FieldValueString value={props.info as string} />
</Match>
<Match when={type() === "CHARACTER"}>
Expand Down
Loading