@molgenis/vip-report-template 6.1.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (285) hide show
  1. package/.nvmrc +1 -1
  2. package/.travis.yml +9 -11
  3. package/README.md +411 -1
  4. package/eslint.config.mjs +11 -0
  5. package/package.json +40 -35
  6. package/scripts/deploy_npm_registry.sh +5 -0
  7. package/src/App.tsx +35 -29
  8. package/src/assets/sass/main.scss +12 -4
  9. package/src/components/Allele.tsx +95 -0
  10. package/src/components/Anchor.tsx +1 -1
  11. package/src/components/Breadcrumb.tsx +8 -5
  12. package/src/components/DatasetDropdown.tsx +10 -23
  13. package/src/components/ErrorNotification.tsx +9 -0
  14. package/src/components/GenomeBrowser.tsx +40 -23
  15. package/src/components/HpoTerm.tsx +1 -1
  16. package/src/components/{record/Pager.tsx → Pager.tsx} +21 -14
  17. package/src/components/RecordsPerPage.tsx +9 -7
  18. package/src/components/RecordsTable.tsx +130 -0
  19. package/src/components/SampleTable.tsx +70 -98
  20. package/src/components/SearchBox.tsx +8 -2
  21. package/src/components/Sort.tsx +28 -25
  22. package/src/components/Table.tsx +16 -0
  23. package/src/components/Tooltip.tsx +20 -0
  24. package/src/components/VariantBreadcrumb.tsx +54 -0
  25. package/src/components/VariantConsequenceContainer.tsx +100 -0
  26. package/src/components/VariantConsequenceTable.tsx +58 -0
  27. package/src/components/VariantContainer.tsx +71 -0
  28. package/src/components/VariantFilters.tsx +27 -0
  29. package/src/components/VariantGenotypeTable.tsx +44 -0
  30. package/src/components/VariantInfoTable.tsx +24 -33
  31. package/src/components/VariantResults.tsx +103 -0
  32. package/src/components/VariantTable.tsx +62 -66
  33. package/src/components/VariantTypeSelect.tsx +34 -0
  34. package/src/components/VariantsContainer.tsx +150 -0
  35. package/src/components/VariantsContainerHeader.tsx +70 -0
  36. package/src/components/field/Field.tsx +80 -0
  37. package/src/components/field/FieldAlt.tsx +19 -0
  38. package/src/components/field/FieldChrom.tsx +6 -0
  39. package/src/components/{record/Id.tsx → field/FieldFilter.tsx} +2 -1
  40. package/src/components/field/FieldFormat.tsx +10 -0
  41. package/src/components/{record/Filter.tsx → field/FieldId.tsx} +1 -1
  42. package/src/components/field/FieldPos.tsx +6 -0
  43. package/src/components/field/FieldQual.tsx +6 -0
  44. package/src/components/field/FieldRef.tsx +8 -0
  45. package/src/components/field/composed/FieldClinVar.tsx +72 -0
  46. package/src/components/field/composed/FieldComposed.tsx +68 -0
  47. package/src/components/field/composed/FieldGene.tsx +39 -0
  48. package/src/components/field/composed/FieldGenotype.tsx +35 -0
  49. package/src/components/{record/format/GenotypeField.tsx → field/composed/FieldGenotypeSnvSv.tsx} +20 -16
  50. package/src/components/field/composed/FieldGenotypeStr.tsx +31 -0
  51. package/src/components/field/composed/FieldGnomAd.tsx +58 -0
  52. package/src/components/field/composed/FieldHpo.tsx +50 -0
  53. package/src/components/field/composed/FieldInheritanceModes.tsx +32 -0
  54. package/src/components/field/composed/FieldLocus.tsx +18 -0
  55. package/src/components/field/composed/FieldVipC.tsx +25 -0
  56. package/src/components/field/composed/FieldVipCS.tsx +15 -0
  57. package/src/components/field/composed/FieldVkgl.tsx +37 -0
  58. package/src/components/field/genotype/FieldGenotype.tsx +19 -0
  59. package/src/components/field/genotype/FieldGenotypeType.tsx +9 -0
  60. package/src/components/field/info/FieldConsequence.tsx +15 -0
  61. package/src/components/{record/info/Hgvs.tsx → field/info/FieldHgvs.tsx} +4 -6
  62. package/src/components/field/info/FieldInfo.tsx +27 -0
  63. package/src/components/{record/info/PubMed.tsx → field/info/FieldPubMed.tsx} +4 -7
  64. package/src/components/field/typed/FieldCategorical.tsx +17 -0
  65. package/src/components/{record/field/FieldValueCharacter.tsx → field/typed/FieldCharacter.tsx} +3 -2
  66. package/src/components/{record/field/FieldValueFlag.tsx → field/typed/FieldFlag.tsx} +3 -2
  67. package/src/components/{record/field/FieldValueFloat.tsx → field/typed/FieldFloat.tsx} +3 -2
  68. package/src/components/{record/field/FieldValueInteger.tsx → field/typed/FieldInteger.tsx} +3 -2
  69. package/src/components/{record/field/FieldValueString.tsx → field/typed/FieldString.tsx} +3 -2
  70. package/src/components/field/typed/FieldTyped.tsx +20 -0
  71. package/src/components/field/typed/FieldTypedItem.tsx +49 -0
  72. package/src/components/field/typed/FieldTypedMultiple.tsx +21 -0
  73. package/src/components/filter/Filter.tsx +56 -48
  74. package/src/components/filter/FilterWrapper.scss +23 -0
  75. package/src/components/filter/FilterWrapper.tsx +63 -0
  76. package/src/components/filter/composed/FilterAllelicImbalance.tsx +26 -0
  77. package/src/components/filter/composed/FilterComposed.tsx +92 -0
  78. package/src/components/filter/composed/FilterDeNovo.tsx +35 -0
  79. package/src/components/filter/composed/FilterHpo.tsx +16 -0
  80. package/src/components/filter/composed/FilterInheritance.tsx +42 -0
  81. package/src/components/filter/composed/FilterLocus.tsx +75 -0
  82. package/src/components/filter/composed/FilterVipC.tsx +16 -0
  83. package/src/components/filter/composed/FilterVipCS.tsx +16 -0
  84. package/src/components/filter/fixed/FilterAlt.tsx +20 -0
  85. package/src/components/filter/fixed/FilterChrom.tsx +22 -0
  86. package/src/components/filter/fixed/FilterFilter.tsx +20 -0
  87. package/src/components/filter/fixed/FilterFixed.tsx +96 -0
  88. package/src/components/filter/fixed/FilterId.tsx +20 -0
  89. package/src/components/filter/fixed/FilterPos.tsx +22 -0
  90. package/src/components/filter/fixed/FilterQual.tsx +21 -0
  91. package/src/components/filter/fixed/FilterRef.tsx +22 -0
  92. package/src/components/filter/typed/FilterCategorical.tsx +119 -0
  93. package/src/components/filter/typed/FilterFlag.tsx +23 -0
  94. package/src/components/filter/typed/FilterInterval.tsx +72 -0
  95. package/src/components/filter/typed/FilterString.tsx +43 -0
  96. package/src/components/filter/typed/FilterTyped.tsx +56 -0
  97. package/src/components/form/ButtonApply.tsx +11 -0
  98. package/src/components/form/ButtonDownload.tsx +11 -0
  99. package/src/components/form/ButtonReset.tsx +9 -0
  100. package/src/components/{Checkbox.tsx → form/Checkbox.tsx} +4 -9
  101. package/src/components/form/Input.tsx +19 -0
  102. package/src/components/form/Select.scss +7 -0
  103. package/src/components/form/Select.tsx +34 -0
  104. package/src/components/tree/DecisionTreeBoolMultiQuery.tsx +1 -1
  105. package/src/components/tree/DecisionTreeBoolQuery.tsx +1 -1
  106. package/src/components/tree/DecisionTreeNode.tsx +41 -39
  107. package/src/components/tree/DecisionTreeNodeBool.tsx +1 -1
  108. package/src/components/tree/DecisionTreeNodeBoolMulti.tsx +1 -1
  109. package/src/components/tree/DecisionTreeNodeCategorical.tsx +1 -1
  110. package/src/components/tree/DecisionTreeNodeExists.tsx +1 -1
  111. package/src/components/tree/DecisionTreeNodeLeaf.tsx +1 -1
  112. package/src/components/tree/DecisionTreeOutcomeNode.tsx +1 -1
  113. package/src/components/tree/DecisionTreePath.tsx +1 -1
  114. package/src/igv.d.ts +2 -1
  115. package/src/index.tsx +48 -19
  116. package/src/mocks/GRCh37/decisionTree.json +23 -22
  117. package/src/mocks/GRCh37/field_metadata.json +435 -95
  118. package/src/mocks/GRCh37/sampleTree.json +143 -0
  119. package/src/mocks/GRCh37/static.ts +63 -133
  120. package/src/mocks/GRCh37/vcf/family.vcf.blob +37 -31
  121. package/src/mocks/GRCh38/decisionTree.json +52 -33
  122. package/src/mocks/GRCh38/decisionTreeStr.json +572 -0
  123. package/src/mocks/GRCh38/fasta/chr1_149380406-149403321.fasta.gz.blob +0 -0
  124. package/src/mocks/GRCh38/field_metadata.json +435 -95
  125. package/src/mocks/GRCh38/sampleTree.json +175 -0
  126. package/src/mocks/GRCh38/static.ts +101 -42
  127. package/src/mocks/GRCh38/str.cram.blob +0 -0
  128. package/src/mocks/GRCh38/str.cram.crai.blob +0 -0
  129. package/src/mocks/GRCh38/vcf/family.vcf.blob +25 -24
  130. package/src/mocks/GRCh38/vcf/no_vep.vcf.blob +29 -28
  131. package/src/mocks/GRCh38/vcf/samples_0.vcf.blob +28 -27
  132. package/src/mocks/GRCh38/vcf/samples_1.vcf.blob +29 -28
  133. package/src/mocks/GRCh38/vcf/samples_100.vcf.blob +28 -27
  134. package/src/mocks/GRCh38/vcf/str.vcf.blob +321 -0
  135. package/src/mocks/MockApiClient.ts +341 -328
  136. package/src/mocks/config_cram.json +701 -0
  137. package/src/mocks/config_vcf.json +699 -0
  138. package/src/store/app.ts +30 -0
  139. package/src/store/index.tsx +3 -168
  140. package/src/store/variants.ts +182 -0
  141. package/src/types/config.d.ts +190 -0
  142. package/src/types/configCellComposed.d.ts +86 -0
  143. package/src/types/configCells.d.ts +129 -0
  144. package/src/types/configFilter.d.ts +80 -0
  145. package/src/types/configFilterComposed.d.ts +60 -0
  146. package/src/types/configSort.d.ts +13 -0
  147. package/src/types/filter.d.ts +17 -0
  148. package/src/types/store.d.ts +34 -0
  149. package/src/utils/api.ts +281 -0
  150. package/src/utils/config/config.ts +182 -0
  151. package/src/utils/config/configCells.ts +74 -0
  152. package/src/utils/config/configCellsComposed.ts +508 -0
  153. package/src/utils/config/configCellsField.ts +61 -0
  154. package/src/utils/config/configCellsFixed.ts +126 -0
  155. package/src/utils/config/configFilters.ts +46 -0
  156. package/src/utils/config/configFiltersComposed.ts +208 -0
  157. package/src/utils/config/configFiltersField.ts +49 -0
  158. package/src/utils/config/configFiltersFixed.ts +106 -0
  159. package/src/utils/config/configSorts.ts +44 -0
  160. package/src/utils/config/configValidator.ts +380 -0
  161. package/src/utils/config/configVip.ts +25 -0
  162. package/src/utils/csq.ts +115 -0
  163. package/src/utils/decisionTree.ts +45 -0
  164. package/src/utils/download.ts +30 -0
  165. package/src/utils/error.ts +69 -0
  166. package/src/utils/query/query.ts +55 -0
  167. package/src/utils/query/queryFilter.ts +132 -0
  168. package/src/utils/query/queryFilterComposed.ts +247 -0
  169. package/src/utils/query/queryFilterField.ts +75 -0
  170. package/src/utils/query/queryFilterFixed.ts +44 -0
  171. package/src/utils/query/querySample.ts +18 -0
  172. package/src/utils/query/queryVariantType.ts +76 -0
  173. package/src/utils/query/selector.ts +41 -0
  174. package/src/utils/{sortUtils.ts → query/sort.ts} +32 -11
  175. package/src/utils/sample.ts +19 -35
  176. package/src/utils/utils.ts +66 -2
  177. package/src/utils/variantType.ts +43 -0
  178. package/src/utils/vcf.ts +352 -0
  179. package/src/views/Help.tsx +109 -114
  180. package/src/views/Home.tsx +3 -2
  181. package/src/views/Sample.tsx +12 -7
  182. package/src/views/SampleVariant.tsx +23 -112
  183. package/src/views/SampleVariantConsequence.tsx +54 -114
  184. package/src/views/SampleVariants.tsx +33 -445
  185. package/src/views/SampleVariantsRedirect.tsx +20 -0
  186. package/src/views/Samples.tsx +7 -10
  187. package/src/views/Variant.tsx +31 -61
  188. package/src/views/VariantConsequence.tsx +42 -72
  189. package/src/views/Variants.tsx +29 -138
  190. package/src/views/VariantsRedirect.tsx +25 -0
  191. package/src/views/data/data.tsx +32 -6
  192. package/tests/store/variants.test.ts +122 -0
  193. package/tests/utils/config/config.test.ts +167 -0
  194. package/tests/utils/config/configCells.test.ts +86 -0
  195. package/tests/utils/config/configCellsComposed.test.ts +1163 -0
  196. package/tests/utils/config/configCellsField.test.ts +164 -0
  197. package/tests/utils/config/configCellsFixed.test.ts +99 -0
  198. package/tests/utils/config/configFilters.test.ts +80 -0
  199. package/tests/utils/config/configFiltersComposed.test.ts +504 -0
  200. package/tests/utils/config/configFiltersField.test.ts +140 -0
  201. package/tests/utils/config/configFiltersFixed.test.ts +81 -0
  202. package/tests/utils/config/configSorts.test.ts +55 -0
  203. package/tests/utils/config/configValidator.test.ts +56 -0
  204. package/tests/utils/config/configVip.test.ts +53 -0
  205. package/tests/utils/decisionTree.test.ts +71 -0
  206. package/tests/utils/download.test.ts +20 -0
  207. package/tests/utils/query/query.test.ts +84 -0
  208. package/tests/utils/query/queryFilter.test.ts +243 -0
  209. package/tests/utils/query/queryFilterComposed.test.ts +301 -0
  210. package/tests/utils/query/queryFilterField.test.ts +75 -0
  211. package/tests/utils/query/queryFilterFixed.test.ts +86 -0
  212. package/tests/utils/query/querySample.test.ts +45 -0
  213. package/tests/utils/query/queryVariantType.test.ts +56 -0
  214. package/{src/__tests__/sortUtils.test.ts → tests/utils/query/sort.test.ts} +3 -4
  215. package/tests/utils/sample.test.ts +259 -0
  216. package/tests/utils/utils.test.ts +120 -0
  217. package/tests/utils/variantType.test.ts +48 -0
  218. package/tests/utils/vcf.test.ts +649 -0
  219. package/tsconfig.json +6 -2
  220. package/vite.config.mts +20 -3
  221. package/.eslintignore +0 -4
  222. package/.eslintrc.js +0 -23
  223. package/src/Api.ts +0 -12
  224. package/src/__tests__/decisionTreeUtils.test.ts +0 -75
  225. package/src/__tests__/field.test.ts +0 -107
  226. package/src/__tests__/query.test.ts +0 -188
  227. package/src/__tests__/sample.test.ts +0 -184
  228. package/src/__tests__/utils.test.ts +0 -24
  229. package/src/__tests__/viewUtils.test.ts +0 -125
  230. package/src/components/ConsequenceTable.tsx +0 -45
  231. package/src/components/Error.tsx +0 -9
  232. package/src/components/FieldHeader.tsx +0 -26
  233. package/src/components/InfoCollapsablePane.tsx +0 -90
  234. package/src/components/VariantInfoNestedTable.tsx +0 -127
  235. package/src/components/VariantSampleTable.tsx +0 -58
  236. package/src/components/VariantsSampleTable.tsx +0 -183
  237. package/src/components/VariantsTable.tsx +0 -124
  238. package/src/components/filter/FilterAllelicBalance.tsx +0 -81
  239. package/src/components/filter/FilterCategorical.tsx +0 -81
  240. package/src/components/filter/FilterClinVar.tsx +0 -21
  241. package/src/components/filter/FilterGene.tsx +0 -34
  242. package/src/components/filter/FilterHpo.tsx +0 -161
  243. package/src/components/filter/FilterInheritance.tsx +0 -162
  244. package/src/components/filter/FilterIntegerGq.tsx +0 -47
  245. package/src/components/filter/FilterVI.tsx +0 -68
  246. package/src/components/filter/FilterVariantType.tsx +0 -146
  247. package/src/components/filter/Filters.tsx +0 -29
  248. package/src/components/filter/InfoFilter.tsx +0 -39
  249. package/src/components/filter/InfoFilters.tsx +0 -35
  250. package/src/components/filter/SampleFilters.tsx +0 -93
  251. package/src/components/filter/SamplesFilters.tsx +0 -33
  252. package/src/components/record/Allele.tsx +0 -38
  253. package/src/components/record/AlleleBreakend.tsx +0 -5
  254. package/src/components/record/AlleleMissing.tsx +0 -5
  255. package/src/components/record/AlleleNucs.tsx +0 -49
  256. package/src/components/record/AlleleSymbolic.tsx +0 -5
  257. package/src/components/record/Alt.tsx +0 -17
  258. package/src/components/record/Chrom.tsx +0 -5
  259. package/src/components/record/Format.tsx +0 -40
  260. package/src/components/record/Info.tsx +0 -55
  261. package/src/components/record/Pos.tsx +0 -5
  262. package/src/components/record/Qual.tsx +0 -5
  263. package/src/components/record/RecordDownload.tsx +0 -66
  264. package/src/components/record/Ref.tsx +0 -6
  265. package/src/components/record/field/Field.tsx +0 -36
  266. package/src/components/record/field/FieldMultipleValue.tsx +0 -22
  267. package/src/components/record/field/FieldSingleValue.tsx +0 -35
  268. package/src/components/record/info/ClinVar.tsx +0 -81
  269. package/src/components/record/info/Consequence.tsx +0 -18
  270. package/src/components/record/info/Gene.tsx +0 -56
  271. package/src/components/record/info/GnomAD.tsx +0 -54
  272. package/src/components/record/info/Hpo.tsx +0 -52
  273. package/src/components/record/info/InheritanceModes.tsx +0 -22
  274. package/src/components/record/info/VipC.tsx +0 -23
  275. package/src/components/record/info/Vkgl.tsx +0 -42
  276. package/src/mocks/GRCh37/vcf/no_vep.vcf.blob +0 -61
  277. package/src/mocks/GRCh37/vcf/samples_0.vcf.blob +0 -93
  278. package/src/mocks/GRCh37/vcf/samples_1.vcf.blob +0 -93
  279. package/src/mocks/GRCh37/vcf/samples_100.vcf.blob +0 -93
  280. package/src/utils/ApiUtils.ts +0 -259
  281. package/src/utils/csqUtils.ts +0 -27
  282. package/src/utils/decisionTreeUtils.ts +0 -14
  283. package/src/utils/field.ts +0 -49
  284. package/src/utils/query.ts +0 -154
  285. package/src/utils/viewUtils.ts +0 -32
@@ -0,0 +1,71 @@
1
+ import { Component, Show } from "solid-js";
2
+ import { MetadataContainer, SampleContainer } from "../utils/api.ts";
3
+ import { Item, Sample } from "@molgenis/vip-report-api";
4
+ import { VcfRecord } from "@molgenis/vip-report-vcf";
5
+ import { GenomeBrowser } from "./GenomeBrowser.tsx";
6
+ import { VariantTable } from "./VariantTable.tsx";
7
+ import { VariantInfoTable } from "./VariantInfoTable.tsx";
8
+ import { RecordsTable } from "./RecordsTable.tsx";
9
+ import { ConfigJson } from "../types/config";
10
+ import { VariantType } from "../utils/variantType.ts";
11
+ import { getPedigreeSamples } from "../utils/sample.ts";
12
+ import { VariantGenotypeTable } from "./VariantGenotypeTable.tsx";
13
+ import { initConfig } from "../utils/config/config.ts";
14
+
15
+ export const VariantContainer: Component<{
16
+ config: ConfigJson;
17
+ metadata: MetadataContainer;
18
+ variantType: VariantType;
19
+ record: Item<VcfRecord>;
20
+ sample: SampleContainer | null;
21
+ }> = (props) => {
22
+ const config = () => initConfig(props.config, props.variantType, props.metadata, props.sample);
23
+ const samples = (): Item<Sample>[] => (props.sample ? getPedigreeSamples(props.sample) : []);
24
+
25
+ return (
26
+ <>
27
+ <div class="columns">
28
+ <div class="column">
29
+ <GenomeBrowser metadata={props.metadata} samples={samples()} record={props.record} />
30
+ </div>
31
+ </div>
32
+ <div class="columns">
33
+ <div class="column is-3">
34
+ <h1 class="title is-5">Record</h1>
35
+ <VariantTable variant={props.record.data} />
36
+ </div>
37
+ <Show
38
+ when={
39
+ Object.values(props.metadata.records.info).filter(
40
+ (info) => !info.nested && props.record.data.n[info.id] !== undefined,
41
+ ).length > 0
42
+ }
43
+ >
44
+ <div class="column is-3">
45
+ <h1 class="title is-5">Info</h1>
46
+ <VariantInfoTable infoMetadataContainer={props.metadata.records.info} infoContainer={props.record.data.n} />
47
+ </div>
48
+ </Show>
49
+ <Show when={config().variant.samplesCells}>
50
+ {(samplesCells) => (
51
+ <div class="column">
52
+ <h1 class="title is-5">Samples</h1>
53
+ <VariantGenotypeTable
54
+ config={samplesCells()}
55
+ samples={samples()}
56
+ metadata={props.metadata}
57
+ variantType={props.variantType}
58
+ record={props.record}
59
+ />
60
+ </div>
61
+ )}
62
+ </Show>
63
+ </div>
64
+ <div class="columns">
65
+ <div class="column is-full">
66
+ <RecordsTable fieldConfigs={config().variant.cells} records={[props.record]} verticalHeaders={true} />
67
+ </div>
68
+ </div>
69
+ </>
70
+ );
71
+ };
@@ -0,0 +1,27 @@
1
+ import { Component, For } from "solid-js";
2
+ import { FilterValueField } from "../types/configFilter";
3
+ import { ConfigFilters } from "../types/config";
4
+ import { FilterChangeCallback, FilterClearCallback, FilterValueMap } from "../types/filter";
5
+ import { Filter } from "./filter/Filter";
6
+
7
+ export const VariantFilters: Component<{
8
+ filterConfigs: ConfigFilters;
9
+ filterValues: FilterValueMap;
10
+ onFilterChange: FilterChangeCallback;
11
+ onFilterClear: FilterClearCallback;
12
+ }> = (props) => {
13
+ return (
14
+ <>
15
+ <For each={props.filterConfigs}>
16
+ {(filter) => (
17
+ <Filter
18
+ config={filter}
19
+ value={props.filterValues[filter.id] as FilterValueField | undefined}
20
+ onValueChange={(event) => props.onFilterChange({ id: filter.id, ...event })}
21
+ onValueClear={() => props.onFilterClear({ id: filter.id })}
22
+ />
23
+ )}
24
+ </For>
25
+ </>
26
+ );
27
+ };
@@ -0,0 +1,44 @@
1
+ import { Component, For, Show } from "solid-js";
2
+ import { VcfRecord } from "@molgenis/vip-report-vcf";
3
+ import { getSampleLabel } from "../utils/sample.ts";
4
+ import { Item, Sample } from "@molgenis/vip-report-api";
5
+ import { Table } from "./Table.tsx";
6
+ import { MetadataContainer } from "../utils/api.ts";
7
+ import { VariantType } from "../utils/variantType.ts";
8
+ import { ConfigSamplesCells } from "../types/config";
9
+ import { RecordsTableCells, RecordsTableHeaderCells } from "./RecordsTable.tsx";
10
+
11
+ export const VariantGenotypeTable: Component<{
12
+ config: ConfigSamplesCells;
13
+ samples: Item<Sample>[];
14
+ metadata: MetadataContainer;
15
+ variantType: VariantType;
16
+ record: Item<VcfRecord>;
17
+ }> = (props) => {
18
+ return (
19
+ <Show when={props.samples.length >= 0}>
20
+ <Table>
21
+ <thead>
22
+ <tr>
23
+ <th />
24
+ <RecordsTableHeaderCells fieldConfigs={props.config[props.samples[0]!.id]!} />
25
+ </tr>
26
+ </thead>
27
+ <tbody>
28
+ <For each={props.samples}>
29
+ {(sample) => (
30
+ <Show when={props.config[sample.id]}>
31
+ {(config) => (
32
+ <tr>
33
+ <th>{getSampleLabel(sample)}</th>
34
+ <RecordsTableCells fieldConfigs={config()} record={props.record} />
35
+ </tr>
36
+ )}
37
+ </Show>
38
+ )}
39
+ </For>
40
+ </tbody>
41
+ </Table>
42
+ </Show>
43
+ );
44
+ };
@@ -1,40 +1,31 @@
1
1
  import { Component, For } from "solid-js";
2
- import { FieldMetadataContainer } from "@molgenis/vip-report-vcf/src/VcfParser";
3
- import { Info } from "./record/Info";
4
- import { Record } from "@molgenis/vip-report-vcf/src/Vcf";
5
- import { Item } from "@molgenis/vip-report-api/src/Api";
2
+ import { FieldMetadataContainer, InfoContainer } from "@molgenis/vip-report-vcf";
3
+ import { FieldInfo } from "./field/info/FieldInfo.tsx";
4
+ import { Table } from "./Table.tsx";
6
5
 
7
6
  export const VariantInfoTable: Component<{
8
- infoFields: FieldMetadataContainer;
9
- record: Item<Record>;
7
+ infoMetadataContainer: FieldMetadataContainer;
8
+ infoContainer: InfoContainer;
10
9
  }> = (props) => {
10
+ const fieldMetadatas = () =>
11
+ Object.values(props.infoMetadataContainer).filter(
12
+ (info) => !info.nested && props.infoContainer[info.id] !== undefined,
13
+ );
14
+
11
15
  return (
12
- <div style={{ display: "grid" }}>
13
- {/* workaround for https://github.com/jgthms/bulma/issues/2572#issuecomment-523099776 */}
14
- <div class="table-container">
15
- <table class="table is-borderless is-narrow">
16
- <tbody>
17
- <For
18
- each={Object.values(props.infoFields).filter(
19
- (info) => !info.nested && props.record.data.n[info.id] !== undefined,
20
- )}
21
- >
22
- {(infoField) => (
23
- <tr>
24
- <td>{infoField.id}</td>
25
- <td>
26
- <Info
27
- info={{ value: props.record.data.n[infoField.id], record: props.record }}
28
- infoMeta={infoField}
29
- context={{}}
30
- />
31
- </td>
32
- </tr>
33
- )}
34
- </For>
35
- </tbody>
36
- </table>
37
- </div>
38
- </div>
16
+ <Table>
17
+ <tbody>
18
+ <For each={fieldMetadatas()}>
19
+ {(fieldMetadata) => (
20
+ <tr>
21
+ <td>{fieldMetadata.id}</td>
22
+ <td>
23
+ <FieldInfo metadata={fieldMetadata} value={props.infoContainer[fieldMetadata.id]} />
24
+ </td>
25
+ </tr>
26
+ )}
27
+ </For>
28
+ </tbody>
29
+ </Table>
39
30
  );
40
31
  };
@@ -0,0 +1,103 @@
1
+ import { Component, Show } from "solid-js";
2
+ import { PagedItems } from "@molgenis/vip-report-api";
3
+ import { Loader } from "./Loader";
4
+ import { Sort, SortChangeCallback, SortClearCallback } from "./Sort";
5
+ import { PageChangeCallback, Pager } from "./Pager";
6
+ import { RecordsTable } from "./RecordsTable";
7
+ import { RecordsPerPage, RecordsPerPageChangeCallback } from "./RecordsPerPage";
8
+ import { VcfRecord } from "@molgenis/vip-report-vcf";
9
+ import { ButtonDownload } from "./form/ButtonDownload";
10
+ import { ConfigCells, ConfigRecordsPerPage } from "../types/config";
11
+ import { ConfigCellGroup, ConfigCellInfo } from "../types/configCells";
12
+ import { DIRECTION_ASCENDING, DIRECTION_DESCENDING } from "../utils/query/sort.ts";
13
+
14
+ import { MetadataContainer } from "../utils/api.ts";
15
+ import { ConfigSort } from "../types/configSort";
16
+
17
+ export type RecordsDownloadCallback = () => void;
18
+
19
+ export const VariantResults: Component<{
20
+ metadata: MetadataContainer;
21
+ fieldConfigs: ConfigCells;
22
+ records: PagedItems<VcfRecord>;
23
+ sortOptions: ConfigSort[] | undefined;
24
+ recordsPerPage: ConfigRecordsPerPage;
25
+ onRecordsPerPageChange: RecordsPerPageChangeCallback;
26
+ onRecordsDownload: RecordsDownloadCallback;
27
+ onPageChange: PageChangeCallback;
28
+ onSortChange: SortChangeCallback;
29
+ onSortClear: SortClearCallback;
30
+ }> = (props) => {
31
+ const sortOptions = (): ConfigSort[] => {
32
+ if (props.sortOptions !== undefined && props.sortOptions.length !== 0) {
33
+ return props.sortOptions;
34
+ } else {
35
+ return props.fieldConfigs
36
+ .flatMap((fieldConfig) =>
37
+ fieldConfig.type === "group" ? (fieldConfig as ConfigCellGroup).fieldConfigs : [fieldConfig],
38
+ )
39
+ .filter((fieldConfig) => fieldConfig.type === "info")
40
+ .map((fieldConfig) => fieldConfig as ConfigCellInfo)
41
+ .flatMap((fieldConfig) => [
42
+ {
43
+ orders: [{ field: fieldConfig.field, direction: DIRECTION_ASCENDING }],
44
+ selected: undefined,
45
+ },
46
+ {
47
+ orders: [{ field: fieldConfig.field, direction: DIRECTION_DESCENDING }],
48
+ selected: undefined,
49
+ },
50
+ ]);
51
+ }
52
+ };
53
+
54
+ return (
55
+ <>
56
+ <div class="columns is-gapless">
57
+ <div class="column is-offset-1-fullhd is-3-fullhd is-4">
58
+ <Show when={props.records} fallback={<Loader />} keyed>
59
+ {(records) => (
60
+ <span class="is-pulled-left inline-control-text ml-2">{records.page.totalElements} records</span>
61
+ )}
62
+ </Show>
63
+ </div>
64
+ <div class="column is-4">
65
+ <Show when={props.records} fallback={<Loader />} keyed>
66
+ {(records) => <Pager page={records.page} onPageChange={props.onPageChange} />}
67
+ </Show>
68
+ </div>
69
+ <div class="column">
70
+ <div class="field is-grouped is-grouped-right">
71
+ {sortOptions().length > 0 && (
72
+ <Sort options={sortOptions()} onChange={props.onSortChange} onClear={props.onSortClear} />
73
+ )}
74
+ <div class="control">
75
+ <ButtonDownload
76
+ title="Download vcf file with records matching filters and search queries"
77
+ onClick={props.onRecordsDownload}
78
+ />
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ <div class="columns is-gapless">
84
+ <div class="column is-full">
85
+ <Show when={props.records} fallback={<Loader />} keyed>
86
+ {(records) => (
87
+ <>
88
+ <RecordsTable fieldConfigs={props.fieldConfigs} records={records.items} />
89
+ <div class="columns is-gapless">
90
+ <div class="column">
91
+ <div class="field is-grouped is-grouped-right">
92
+ <RecordsPerPage config={props.recordsPerPage} onChange={props.onRecordsPerPageChange} />
93
+ </div>
94
+ </div>
95
+ </div>
96
+ </>
97
+ )}
98
+ </Show>
99
+ </div>
100
+ </div>
101
+ </>
102
+ );
103
+ };
@@ -1,71 +1,67 @@
1
1
  import { Component } from "solid-js";
2
- import { Chrom } from "./record/Chrom";
3
- import { Pos } from "./record/Pos";
4
- import { Id } from "./record/Id";
5
- import { Ref } from "./record/Ref";
6
- import { Alt } from "./record/Alt";
7
- import { Qual } from "./record/Qual";
8
- import { Filter } from "./record/Filter";
9
- import { Record } from "@molgenis/vip-report-vcf/src/Vcf";
2
+ import { VcfRecord } from "@molgenis/vip-report-vcf";
3
+ import { FieldChrom } from "./field/FieldChrom";
4
+ import { FieldPos } from "./field/FieldPos";
5
+ import { FieldId } from "./field/FieldId";
6
+ import { FieldRef } from "./field/FieldRef";
7
+ import { FieldAlt } from "./field/FieldAlt";
8
+ import { FieldQual } from "./field/FieldQual";
9
+ import { FieldFilter } from "./field/FieldFilter";
10
+ import { Table } from "./Table.tsx";
10
11
 
11
- export const VariantTable: Component<{ variant: Record }> = (props) => {
12
+ export const VariantTable: Component<{ variant: VcfRecord }> = (props) => {
12
13
  return (
13
- <div style={{ display: "grid" }}>
14
- {/* workaround for https://github.com/jgthms/bulma/issues/2572#issuecomment-523099776 */}
15
- <div class="table-container">
16
- <table class="table is-borderless is-narrow">
17
- <tbody>
18
- <tr>
19
- <td>Contig</td>
20
- <td>
21
- <Chrom value={props.variant.c} />
22
- </td>
23
- </tr>
24
- <tr>
25
- <td>Position</td>
26
- <td>
27
- <Pos value={props.variant.p} />
28
- </td>
29
- </tr>
30
- {props.variant.i.length > 0 && (
31
- <tr>
32
- <td>Identifiers</td>
33
- <td>
34
- <Id value={props.variant.i} />
35
- </td>
36
- </tr>
37
- )}
38
- <tr>
39
- <td>Reference allele</td>
40
- <td>
41
- <Ref value={props.variant.r} isAbbreviate={false} />
42
- </td>
43
- </tr>
44
- <tr>
45
- <td>Alternate allele(s)</td>
46
- <td>
47
- <Alt value={props.variant.a} isAbbreviate={false} />
48
- </td>
49
- </tr>
50
- {props.variant.q !== null && (
51
- <tr>
52
- <td>Quality</td>
53
- <td>
54
- <Qual value={props.variant.q} />
55
- </td>
56
- </tr>
57
- )}
58
- {props.variant.f.length > 0 && (
59
- <tr>
60
- <td>Filter(s)</td>
61
- <td>
62
- <Filter value={props.variant.f} />
63
- </td>
64
- </tr>
65
- )}
66
- </tbody>
67
- </table>
68
- </div>
69
- </div>
14
+ <Table>
15
+ <tbody>
16
+ <tr>
17
+ <td>Contig</td>
18
+ <td>
19
+ <FieldChrom value={props.variant.c} />
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td>Position</td>
24
+ <td>
25
+ <FieldPos value={props.variant.p} />
26
+ </td>
27
+ </tr>
28
+ {props.variant.i.length > 0 && (
29
+ <tr>
30
+ <td>Identifiers</td>
31
+ <td>
32
+ <FieldId value={props.variant.i} />
33
+ </td>
34
+ </tr>
35
+ )}
36
+ <tr>
37
+ <td>Reference allele</td>
38
+ <td>
39
+ <FieldRef value={props.variant.r} isAbbreviate={false} />
40
+ </td>
41
+ </tr>
42
+ <tr>
43
+ <td>Alternate allele(s)</td>
44
+ <td>
45
+ <FieldAlt value={props.variant.a} isAbbreviate={false} />
46
+ </td>
47
+ </tr>
48
+ {props.variant.q !== null && (
49
+ <tr>
50
+ <td>Quality</td>
51
+ <td>
52
+ <FieldQual value={props.variant.q} />
53
+ </td>
54
+ </tr>
55
+ )}
56
+ {props.variant.f.length > 0 && (
57
+ <tr>
58
+ <td>Filter(s)</td>
59
+ <td>
60
+ <FieldFilter value={props.variant.f} />
61
+ </td>
62
+ </tr>
63
+ )}
64
+ </tbody>
65
+ </Table>
70
66
  );
71
67
  };
@@ -0,0 +1,34 @@
1
+ import { Component, For } from "solid-js";
2
+ import { getVariantTypes, VariantType, VariantTypeId } from "../utils/variantType.ts";
3
+
4
+ export type VariantTypeChangeEvent = { id: VariantTypeId };
5
+ export type VariantTypeChangeCallback = (event: VariantTypeChangeEvent) => void;
6
+
7
+ export const VariantTypeSelect: Component<{
8
+ value: VariantType | null;
9
+ variantTypeIds: Set<VariantTypeId>;
10
+ onChange: VariantTypeChangeCallback;
11
+ }> = (props) => {
12
+ const onChange = (variantTypeId: VariantTypeId) => {
13
+ return props.onChange({ id: variantTypeId });
14
+ };
15
+
16
+ return (
17
+ <>
18
+ <p class="has-text-weight-semibold">Variant types</p>
19
+ <div class="field">
20
+ <ul>
21
+ <For each={getVariantTypes(props.variantTypeIds)}>
22
+ {(variantType: VariantType) => (
23
+ <li>
24
+ <a onClick={() => onChange(variantType.id)}>
25
+ <abbr title={variantType.description}>{variantType.label}</abbr>
26
+ </a>
27
+ </li>
28
+ )}
29
+ </For>
30
+ </ul>
31
+ </div>
32
+ </>
33
+ );
34
+ };
@@ -0,0 +1,150 @@
1
+ import { VariantFilters } from "./VariantFilters";
2
+ import { Params } from "@molgenis/vip-report-api";
3
+ import { Component, createResource, Show } from "solid-js";
4
+ import { VariantType } from "../utils/variantType.ts";
5
+ import { useNavigate } from "@solidjs/router";
6
+ import { initConfig } from "../utils/config/config.ts";
7
+ import { createQuery } from "../utils/query/query.ts";
8
+ import { PageChangeEvent } from "./Pager";
9
+ import { writeVcf } from "@molgenis/vip-report-vcf";
10
+ import { fetchRecords, MetadataContainer, SampleContainer } from "../utils/api.ts";
11
+ import { createVcfDownloadFilename } from "../utils/download.ts";
12
+ import { RecordsPerPageChangeEvent } from "./RecordsPerPage";
13
+ import { SortChangeEvent } from "./Sort";
14
+ import { VariantTypeChangeEvent, VariantTypeSelect } from "./VariantTypeSelect";
15
+ import { Loader } from "./Loader";
16
+ import { VariantResults } from "./VariantResults";
17
+ import { FilterChangeEvent, FilterClearEvent } from "../types/filter";
18
+ import { VariantsContainerHeader } from "./VariantsContainerHeader";
19
+ import { href } from "../utils/utils.ts";
20
+ import { getPedigreeSamples } from "../utils/sample.ts";
21
+ import { ConfigJson } from "../types/config";
22
+ import { createSort } from "../utils/query/sort.ts";
23
+ import { VariantStore } from "../store/variants.ts";
24
+
25
+ export const VariantsContainer: Component<{
26
+ store: VariantStore;
27
+ config: ConfigJson;
28
+ metadata: MetadataContainer;
29
+ variantType: VariantType;
30
+ sample: SampleContainer | null;
31
+ }> = (props) => {
32
+ const navigate = useNavigate();
33
+
34
+ const config = () => initConfig(props.config, props.variantType, props.metadata, props.sample);
35
+ const variantTypeIds = () => (props.sample !== null ? props.sample.variantTypeIds : props.metadata.variantTypeIds);
36
+ const query = () => createQuery(config(), props.variantType, props.sample, props.store.getFilterValues());
37
+
38
+ const defaultSort = () => config().variants.sorts.find((configSort) => configSort.selected);
39
+ const sort = () => createSort(props.store.getSort(), defaultSort()) || undefined;
40
+ const defaultRecordsPerPage = () => config().variants.recordsPerPage.find((option) => option.selected)?.number || 10;
41
+ const recordsPerPage = () =>
42
+ props.store.getPageSize() !== null ? props.store.getPageSize()! : defaultRecordsPerPage();
43
+
44
+ const [records] = createResource(
45
+ (): Params => ({
46
+ query: query() || undefined,
47
+ page: props.store.getPageNumber() || 0,
48
+ size: recordsPerPage(),
49
+ sort: sort(),
50
+ }),
51
+ fetchRecords,
52
+ );
53
+
54
+ const onFilterChange = (event: FilterChangeEvent) => {
55
+ props.store.setFilterValue(event.id, event.value);
56
+ };
57
+ const onFilterClear = (event: FilterClearEvent) => {
58
+ props.store.clearFilter(event.id);
59
+ };
60
+ const onPageChange = (event: PageChangeEvent) => {
61
+ props.store.setPageNumber(event.page);
62
+ };
63
+
64
+ const onRecordsDownload = async () => {
65
+ const samples = props.sample ? getPedigreeSamples(props.sample) : [];
66
+ const filter = samples ? { samples: samples.map((sample) => sample.data.person.individualId) } : undefined;
67
+
68
+ // create vcf using all records that match filters, use default sort to ensure valid vcf ordering
69
+ const records = await fetchRecords({ query: query() || undefined, page: 0, size: Number.MAX_SAFE_INTEGER });
70
+ const vcf = writeVcf({ metadata: props.metadata.records, data: records.items.map((item) => item.data) }, filter);
71
+
72
+ const url = window.URL.createObjectURL(new Blob([vcf]));
73
+ const link = document.createElement("a");
74
+ link.href = url;
75
+ link.setAttribute("download", createVcfDownloadFilename(props.metadata.htsFile));
76
+ document.body.appendChild(link);
77
+ link.click();
78
+ document.body.removeChild(link);
79
+ };
80
+ const onRecordsPerPageChange = (event: RecordsPerPageChangeEvent) => {
81
+ props.store.setPageSize(event.number);
82
+ };
83
+ const onSortChange = (event: SortChangeEvent) => {
84
+ props.store.setSort(event.order);
85
+ };
86
+ const onSortClear = () => {
87
+ props.store.clearSort();
88
+ };
89
+ const onVariantTypeChange = (event: VariantTypeChangeEvent) => {
90
+ const components = props.sample !== null ? ["samples", props.sample.item.id] : [];
91
+ components.push("variants", event.id);
92
+ navigate(href(components));
93
+ };
94
+
95
+ return (
96
+ <>
97
+ <div class="columns is-1 mb-1">
98
+ <div class="column is-offset-2-fullhd is-offset-3">
99
+ <VariantsContainerHeader sample={props.sample} />
100
+ </div>
101
+ </div>
102
+ <div class="columns is-1">
103
+ <div class="column is-2-fullhd is-3">
104
+ <Show when={variantTypeIds().size > 1}>
105
+ <div class="columns">
106
+ <div class="column">
107
+ <VariantTypeSelect
108
+ value={props.variantType}
109
+ variantTypeIds={variantTypeIds()}
110
+ onChange={onVariantTypeChange}
111
+ />
112
+ </div>
113
+ </div>
114
+ </Show>
115
+ <div class="columns">
116
+ <div class="column">
117
+ <VariantFilters
118
+ filterConfigs={config().variants.filters}
119
+ filterValues={props.store.getFilterValues()}
120
+ onFilterChange={onFilterChange}
121
+ onFilterClear={onFilterClear}
122
+ />
123
+ </div>
124
+ </div>
125
+ </div>
126
+ <div class="column">
127
+ <Show when={records()} fallback={<Loader />}>
128
+ {(records) => (
129
+ <VariantResults
130
+ metadata={props.metadata}
131
+ fieldConfigs={config().variants.cells}
132
+ records={records()}
133
+ sortOptions={config().variants.sorts}
134
+ recordsPerPage={config().variants.recordsPerPage.map((option) => ({
135
+ ...option,
136
+ selected: option.number === recordsPerPage(),
137
+ }))}
138
+ onPageChange={onPageChange}
139
+ onRecordsPerPageChange={onRecordsPerPageChange}
140
+ onRecordsDownload={onRecordsDownload}
141
+ onSortChange={onSortChange}
142
+ onSortClear={onSortClear}
143
+ />
144
+ )}
145
+ </Show>
146
+ </div>
147
+ </div>
148
+ </>
149
+ );
150
+ };