@genome-spy/core 0.65.0 → 0.67.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.
- package/dist/bundle/browser-BRemItdO.js +138 -0
- package/dist/bundle/{index-CD7FLu9x.js → index-BatuyGAI.js} +23 -21
- package/dist/bundle/{index-C0llXMqm.js → index-ByuE8dvu.js} +140 -88
- package/dist/bundle/index-Cq3QFUxX.js +1781 -0
- package/dist/bundle/index-D28m8tSW.js +1607 -0
- package/dist/bundle/index-DbJ0oeYM.js +631 -0
- package/dist/bundle/index.es.js +15821 -14601
- package/dist/bundle/index.js +214 -212
- package/dist/bundle/{inflate-DRgHi_KK.js → inflate-GtwLkvSP.js} +222 -224
- package/dist/bundle/unzip-NywezaRR.js +1492 -0
- package/dist/schema.json +13 -3
- package/dist/src/config/scaleDefaults.d.ts +8 -0
- package/dist/src/config/scaleDefaults.d.ts.map +1 -0
- package/dist/src/config/scaleDefaults.js +45 -0
- package/dist/src/data/flowHandle.d.ts +2 -0
- package/dist/src/data/flowHandle.d.ts.map +1 -1
- package/dist/src/data/flowHandle.js +1 -0
- package/dist/src/data/flowInit.d.ts +12 -4
- package/dist/src/data/flowInit.d.ts.map +1 -1
- package/dist/src/data/flowInit.js +115 -16
- package/dist/src/data/sources/lazy/axisTickSource.js +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisLazySource.js +10 -3
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.d.ts.map +1 -1
- package/dist/src/data/sources/lazy/singleAxisWindowedSource.js +5 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts +1 -1
- package/dist/src/data/transforms/filterScoredLabels.d.ts.map +1 -1
- package/dist/src/data/transforms/filterScoredLabels.js +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.d.ts.map +1 -1
- package/dist/src/data/transforms/linearizeGenomicCoordinate.js +2 -1
- package/dist/src/encoder/encoder.d.ts +1 -1
- package/dist/src/encoder/encoder.d.ts.map +1 -1
- package/dist/src/encoder/encoder.js +1 -1
- package/dist/src/genome/scaleLocus.d.ts +39 -0
- package/dist/src/genome/scaleLocus.d.ts.map +1 -1
- package/dist/src/genome/scaleLocus.js +76 -0
- package/dist/src/genomeSpy/canvasExport.d.ts +19 -0
- package/dist/src/genomeSpy/canvasExport.d.ts.map +1 -0
- package/dist/src/genomeSpy/canvasExport.js +66 -0
- package/dist/src/genomeSpy/containerUi.d.ts +17 -0
- package/dist/src/genomeSpy/containerUi.d.ts.map +1 -0
- package/dist/src/genomeSpy/containerUi.js +78 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts +19 -0
- package/dist/src/genomeSpy/eventListenerRegistry.d.ts.map +1 -0
- package/dist/src/genomeSpy/eventListenerRegistry.js +38 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts +14 -0
- package/dist/src/genomeSpy/inputBindingManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/inputBindingManager.js +63 -0
- package/dist/src/genomeSpy/interactionController.d.ts +40 -0
- package/dist/src/genomeSpy/interactionController.d.ts.map +1 -0
- package/dist/src/genomeSpy/interactionController.js +371 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts +10 -0
- package/dist/src/genomeSpy/keyboardListenerManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/keyboardListenerManager.js +31 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts +15 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.d.ts.map +1 -0
- package/dist/src/genomeSpy/loadingIndicatorManager.js +92 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts +22 -0
- package/dist/src/genomeSpy/renderCoordinator.d.ts.map +1 -0
- package/dist/src/genomeSpy/renderCoordinator.js +118 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts +18 -0
- package/dist/src/genomeSpy/viewContextFactory.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewContextFactory.js +79 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts +22 -0
- package/dist/src/genomeSpy/viewDataInit.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewDataInit.js +160 -0
- package/dist/src/genomeSpy/viewDataInit.test.d.ts +2 -0
- package/dist/src/genomeSpy/viewDataInit.test.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts +14 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHierarchyConfig.js +24 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts +5 -0
- package/dist/src/genomeSpy/viewHighlight.d.ts.map +1 -0
- package/dist/src/genomeSpy/viewHighlight.js +30 -0
- package/dist/src/genomeSpy.d.ts +17 -71
- package/dist/src/genomeSpy.d.ts.map +1 -1
- package/dist/src/genomeSpy.js +197 -741
- package/dist/src/gl/dataToVertices.d.ts.map +1 -1
- package/dist/src/gl/dataToVertices.js +16 -4
- package/dist/src/gl/glslScaleGenerator.d.ts +1 -1
- package/dist/src/gl/webGLHelper.d.ts +2 -2
- package/dist/src/gl/webGLHelper.d.ts.map +1 -1
- package/dist/src/gl/webGLHelper.js +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -12
- package/dist/src/marks/mark.d.ts.map +1 -1
- package/dist/src/marks/mark.js +4 -2
- package/dist/src/{view → scales}/axisResolution.d.ts +9 -16
- package/dist/src/scales/axisResolution.d.ts.map +1 -0
- package/dist/src/{view → scales}/axisResolution.js +29 -18
- package/dist/src/scales/axisResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts +57 -0
- package/dist/src/scales/scaleDomainAggregator.d.ts.map +1 -0
- package/dist/src/scales/scaleDomainAggregator.js +167 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts +2 -0
- package/dist/src/scales/scaleDomainAggregator.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.d.ts +40 -0
- package/dist/src/scales/scaleInstanceManager.d.ts.map +1 -0
- package/dist/src/scales/scaleInstanceManager.js +317 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts +2 -0
- package/dist/src/scales/scaleInstanceManager.test.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.d.ts +73 -0
- package/dist/src/scales/scaleInteractionController.d.ts.map +1 -0
- package/dist/src/scales/scaleInteractionController.js +336 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts +2 -0
- package/dist/src/scales/scaleInteractionController.test.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.d.ts +23 -0
- package/dist/src/scales/scalePropsResolver.d.ts.map +1 -0
- package/dist/src/scales/scalePropsResolver.js +74 -0
- package/dist/src/{view → scales}/scaleResolution.d.ts +53 -35
- package/dist/src/scales/scaleResolution.d.ts.map +1 -0
- package/dist/src/scales/scaleResolution.js +732 -0
- package/dist/src/scales/scaleResolution.test.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts +6 -0
- package/dist/src/scales/scaleResolutionConstants.d.ts.map +1 -0
- package/dist/src/scales/scaleResolutionConstants.js +5 -0
- package/dist/src/scales/scaleRules.d.ts +16 -0
- package/dist/src/scales/scaleRules.d.ts.map +1 -0
- package/dist/src/scales/scaleRules.js +103 -0
- package/dist/src/scales/scaleRules.test.d.ts +2 -0
- package/dist/src/scales/scaleRules.test.d.ts.map +1 -0
- package/dist/src/spec/channel.d.ts +13 -18
- package/dist/src/spec/scale.d.ts +6 -0
- package/dist/src/types/embedApi.d.ts +5 -0
- package/dist/src/types/scaleResolutionApi.d.ts +1 -1
- package/dist/src/utils/domainArray.d.ts.map +1 -1
- package/dist/src/utils/domainArray.js +3 -0
- package/dist/src/utils/indexer.d.ts +3 -0
- package/dist/src/utils/indexer.d.ts.map +1 -1
- package/dist/src/utils/indexer.js +3 -0
- package/dist/src/view/concatView.d.ts +18 -0
- package/dist/src/view/concatView.d.ts.map +1 -1
- package/dist/src/view/concatView.js +73 -0
- package/dist/src/view/concatView.test.d.ts +2 -0
- package/dist/src/view/concatView.test.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.d.ts +74 -0
- package/dist/src/view/containerMutationHelper.d.ts.map +1 -0
- package/dist/src/view/containerMutationHelper.js +118 -0
- package/dist/src/view/containerView.d.ts +0 -7
- package/dist/src/view/containerView.d.ts.map +1 -1
- package/dist/src/view/containerView.js +0 -10
- package/dist/src/view/facetView.d.ts.map +1 -1
- package/dist/src/view/facetView.js +0 -15
- package/dist/src/view/flowBuilder.d.ts +5 -3
- package/dist/src/view/flowBuilder.d.ts.map +1 -1
- package/dist/src/view/flowBuilder.js +69 -6
- package/dist/src/view/gridView/gridChild.d.ts +11 -0
- package/dist/src/view/gridView/gridChild.d.ts.map +1 -1
- package/dist/src/view/gridView/gridChild.js +32 -6
- package/dist/src/view/gridView/gridView.d.ts +39 -1
- package/dist/src/view/gridView/gridView.d.ts.map +1 -1
- package/dist/src/view/gridView/gridView.js +106 -48
- package/dist/src/view/gridView/gridView.test.d.ts +2 -0
- package/dist/src/view/gridView/gridView.test.d.ts.map +1 -0
- package/dist/src/view/gridView/scrollbar.d.ts +39 -8
- package/dist/src/view/gridView/scrollbar.d.ts.map +1 -1
- package/dist/src/view/gridView/scrollbar.js +184 -69
- package/dist/src/view/layerView.d.ts +14 -0
- package/dist/src/view/layerView.d.ts.map +1 -1
- package/dist/src/view/layerView.js +66 -0
- package/dist/src/view/layerView.test.d.ts +2 -0
- package/dist/src/view/layerView.test.d.ts.map +1 -0
- package/dist/src/view/testUtils.d.ts.map +1 -1
- package/dist/src/view/testUtils.js +7 -1
- package/dist/src/view/unitView.d.ts.map +1 -1
- package/dist/src/view/unitView.js +41 -36
- package/dist/src/view/view.d.ts +18 -6
- package/dist/src/view/view.d.ts.map +1 -1
- package/dist/src/view/view.js +30 -4
- package/package.json +2 -2
- package/dist/bundle/browser-txUcLy2H.js +0 -123
- package/dist/bundle/index-BQpbYrv4.js +0 -1712
- package/dist/bundle/index-BhtHKLUo.js +0 -73
- package/dist/bundle/index-CCe8rnZz.js +0 -716
- package/dist/bundle/index-DhcU-Gk-.js +0 -1487
- package/dist/src/data/collector.test.js +0 -138
- package/dist/src/data/dataFlow.test.js +0 -38
- package/dist/src/data/flow.test.js +0 -81
- package/dist/src/data/flowInit.test.js +0 -413
- package/dist/src/data/flowNode.test.js +0 -50
- package/dist/src/data/flowOptimizer.test.js +0 -209
- package/dist/src/data/formats/fasta.test.js +0 -27
- package/dist/src/data/sources/inlineSource.test.js +0 -63
- package/dist/src/data/sources/sequenceSource.test.js +0 -81
- package/dist/src/data/transforms/aggregate.test.js +0 -134
- package/dist/src/data/transforms/clone.test.js +0 -11
- package/dist/src/data/transforms/coverage.test.js +0 -238
- package/dist/src/data/transforms/filter.test.js +0 -20
- package/dist/src/data/transforms/flatten.test.js +0 -96
- package/dist/src/data/transforms/flattenDelimited.test.js +0 -90
- package/dist/src/data/transforms/flattenSequence.test.js +0 -34
- package/dist/src/data/transforms/formula.test.js +0 -25
- package/dist/src/data/transforms/identifier.test.js +0 -92
- package/dist/src/data/transforms/pileup.test.js +0 -70
- package/dist/src/data/transforms/project.test.js +0 -32
- package/dist/src/data/transforms/regexExtract.test.js +0 -70
- package/dist/src/data/transforms/regexFold.test.js +0 -201
- package/dist/src/data/transforms/sample.test.js +0 -38
- package/dist/src/data/transforms/stack.test.js +0 -91
- package/dist/src/encoder/accessor.test.js +0 -162
- package/dist/src/encoder/encoder.test.js +0 -105
- package/dist/src/genome/genome.test.js +0 -268
- package/dist/src/genome/genomes.test.js +0 -8
- package/dist/src/genome/scaleIndex.test.js +0 -78
- package/dist/src/genome/scaleLocus.test.js +0 -4
- package/dist/src/scale/scale.test.js +0 -326
- package/dist/src/scale/ticks.test.js +0 -46
- package/dist/src/selection/selection.test.js +0 -14
- package/dist/src/utils/addBaseUrl.test.js +0 -30
- package/dist/src/utils/binnedIndex.test.js +0 -201
- package/dist/src/utils/cloner.test.js +0 -35
- package/dist/src/utils/coalesce.test.js +0 -16
- package/dist/src/utils/concatIterables.test.js +0 -8
- package/dist/src/utils/domainArray.test.js +0 -130
- package/dist/src/utils/indexer.test.js +0 -49
- package/dist/src/utils/interactionEvent.test.js +0 -35
- package/dist/src/utils/iterateNestedMaps.test.js +0 -33
- package/dist/src/utils/kWayMerge.test.js +0 -30
- package/dist/src/utils/mergeObjects.test.js +0 -42
- package/dist/src/utils/numberExtractor.test.js +0 -6
- package/dist/src/utils/propertyCacher.test.js +0 -89
- package/dist/src/utils/propertyCoalescer.test.js +0 -25
- package/dist/src/utils/radixSort.test.js +0 -51
- package/dist/src/utils/reservationMap.test.js +0 -20
- package/dist/src/utils/ringBuffer.test.js +0 -39
- package/dist/src/utils/topK.test.js +0 -54
- package/dist/src/utils/trees.test.js +0 -135
- package/dist/src/utils/url.test.js +0 -28
- package/dist/src/utils/variableTools.test.js +0 -13
- package/dist/src/view/axisResolution.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.d.ts.map +0 -1
- package/dist/src/view/axisResolution.test.js +0 -206
- package/dist/src/view/flowBuilder.test.js +0 -125
- package/dist/src/view/gridView/selectionRect.test.js +0 -87
- package/dist/src/view/layout/flexLayout.test.js +0 -323
- package/dist/src/view/layout/grid.test.js +0 -71
- package/dist/src/view/layout/rectangle.test.js +0 -192
- package/dist/src/view/paramMediator.test.js +0 -282
- package/dist/src/view/scaleResolution.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.js +0 -1059
- package/dist/src/view/scaleResolution.test.d.ts.map +0 -1
- package/dist/src/view/scaleResolution.test.js +0 -645
- package/dist/src/view/view.test.js +0 -245
- package/dist/src/view/viewDispose.test.js +0 -110
- package/dist/src/view/viewFactory.test.js +0 -25
- package/dist/src/view/viewUtils.test.js +0 -87
- /package/dist/src/{view → scales}/axisResolution.test.d.ts +0 -0
- /package/dist/src/{view → scales}/scaleResolution.test.d.ts +0 -0
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import CoverageTransform from "./coverage.js";
|
|
3
|
-
import { processData } from "../flowTestUtils.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {import("../../spec/transform.js").CoverageParams} CoverageParams
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @param {CoverageParams} params
|
|
11
|
-
* @param {any[]} data
|
|
12
|
-
*/
|
|
13
|
-
function transform(params, data) {
|
|
14
|
-
const t = new CoverageTransform(params);
|
|
15
|
-
t.initialize();
|
|
16
|
-
return processData(t, data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
*
|
|
21
|
-
* @param {[number, number][]} reads Start, end
|
|
22
|
-
* @param {[number, number, number][]} coverageSegments Start, end, coverage
|
|
23
|
-
*/
|
|
24
|
-
function testSimpleCoverage(reads, coverageSegments) {
|
|
25
|
-
/** @type {CoverageParams} */
|
|
26
|
-
const coverageConfig = {
|
|
27
|
-
type: "coverage",
|
|
28
|
-
start: "start",
|
|
29
|
-
end: "end",
|
|
30
|
-
};
|
|
31
|
-
expect(
|
|
32
|
-
transform(
|
|
33
|
-
coverageConfig,
|
|
34
|
-
reads.map((d) => ({
|
|
35
|
-
start: d[0],
|
|
36
|
-
end: d[1],
|
|
37
|
-
}))
|
|
38
|
-
)
|
|
39
|
-
).toEqual(
|
|
40
|
-
coverageSegments.map((d) => ({
|
|
41
|
-
start: d[0],
|
|
42
|
-
end: d[1],
|
|
43
|
-
coverage: d[2],
|
|
44
|
-
}))
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @param {[number, number, number][]} reads Start, end, weight
|
|
51
|
-
* @param {[number, number, number][]} coverageSegments Start, end, coverage
|
|
52
|
-
*/
|
|
53
|
-
function testWeightedCoverage(reads, coverageSegments) {
|
|
54
|
-
/** @type {CoverageParams} */
|
|
55
|
-
const coverageConfig = {
|
|
56
|
-
type: "coverage",
|
|
57
|
-
start: "start",
|
|
58
|
-
end: "end",
|
|
59
|
-
weight: "weight",
|
|
60
|
-
};
|
|
61
|
-
expect(
|
|
62
|
-
transform(
|
|
63
|
-
coverageConfig,
|
|
64
|
-
reads.map((d) => ({
|
|
65
|
-
start: d[0],
|
|
66
|
-
end: d[1],
|
|
67
|
-
weight: d[2],
|
|
68
|
-
}))
|
|
69
|
-
)
|
|
70
|
-
).toEqual(
|
|
71
|
-
coverageSegments.map((d) => ({
|
|
72
|
-
start: d[0],
|
|
73
|
-
end: d[1],
|
|
74
|
-
coverage: d[2],
|
|
75
|
-
}))
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
describe("Coverage transform", () => {
|
|
80
|
-
test("Typical case", () =>
|
|
81
|
-
testSimpleCoverage(
|
|
82
|
-
[
|
|
83
|
-
[0, 4],
|
|
84
|
-
[1, 3],
|
|
85
|
-
[2, 6],
|
|
86
|
-
[4, 8],
|
|
87
|
-
[8, 10],
|
|
88
|
-
[11, 14],
|
|
89
|
-
[11, 13],
|
|
90
|
-
[11, 12],
|
|
91
|
-
[15, 18],
|
|
92
|
-
[16, 18],
|
|
93
|
-
[17, 18],
|
|
94
|
-
],
|
|
95
|
-
[
|
|
96
|
-
[0, 1, 1],
|
|
97
|
-
[1, 2, 2],
|
|
98
|
-
[2, 3, 3],
|
|
99
|
-
[3, 6, 2],
|
|
100
|
-
[6, 10, 1],
|
|
101
|
-
[11, 12, 3],
|
|
102
|
-
[12, 13, 2],
|
|
103
|
-
[13, 14, 1],
|
|
104
|
-
[15, 16, 1],
|
|
105
|
-
[16, 17, 2],
|
|
106
|
-
[17, 18, 3],
|
|
107
|
-
]
|
|
108
|
-
));
|
|
109
|
-
|
|
110
|
-
test("Multiple identical overlapping segments", () =>
|
|
111
|
-
testSimpleCoverage(
|
|
112
|
-
[
|
|
113
|
-
[1, 2],
|
|
114
|
-
[3, 4],
|
|
115
|
-
[3, 4],
|
|
116
|
-
[5, 6],
|
|
117
|
-
[5, 6],
|
|
118
|
-
[5, 6],
|
|
119
|
-
],
|
|
120
|
-
[
|
|
121
|
-
[1, 2, 1],
|
|
122
|
-
[3, 4, 2],
|
|
123
|
-
[5, 6, 3],
|
|
124
|
-
]
|
|
125
|
-
));
|
|
126
|
-
|
|
127
|
-
test("Adjacent segments with equal coverage are merged", () =>
|
|
128
|
-
testSimpleCoverage(
|
|
129
|
-
[
|
|
130
|
-
[1, 2],
|
|
131
|
-
[2, 3],
|
|
132
|
-
[3, 4],
|
|
133
|
-
[5, 6],
|
|
134
|
-
[6, 7],
|
|
135
|
-
[7, 8],
|
|
136
|
-
],
|
|
137
|
-
[
|
|
138
|
-
[1, 4, 1],
|
|
139
|
-
[5, 8, 1],
|
|
140
|
-
]
|
|
141
|
-
));
|
|
142
|
-
|
|
143
|
-
test("Chromosomes pass through", () => {
|
|
144
|
-
const reads = [
|
|
145
|
-
{ chrom: "chr1", start: 0, end: 1 },
|
|
146
|
-
{ chrom: "chr2", start: 0, end: 1 },
|
|
147
|
-
{ chrom: "chr3", start: 1, end: 3 },
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
const coverageSegments = [
|
|
151
|
-
{ chrom: "chr1", start: 0, end: 1, coverage: 1 },
|
|
152
|
-
{ chrom: "chr2", start: 0, end: 1, coverage: 1 },
|
|
153
|
-
{ chrom: "chr3", start: 1, end: 3, coverage: 1 },
|
|
154
|
-
];
|
|
155
|
-
|
|
156
|
-
/** @type {CoverageParams} */
|
|
157
|
-
const coverageConfig = {
|
|
158
|
-
type: "coverage",
|
|
159
|
-
chrom: "chrom",
|
|
160
|
-
start: "start",
|
|
161
|
-
end: "end",
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
expect(transform(coverageConfig, reads)).toEqual(coverageSegments);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test("Typical weighted coverage", () =>
|
|
168
|
-
testWeightedCoverage(
|
|
169
|
-
[
|
|
170
|
-
[0, 4, 1],
|
|
171
|
-
[1, 3, 2],
|
|
172
|
-
[2, 6, 3],
|
|
173
|
-
[8, 10, -1],
|
|
174
|
-
],
|
|
175
|
-
[
|
|
176
|
-
[0, 1, 1],
|
|
177
|
-
[1, 2, 3],
|
|
178
|
-
[2, 3, 6],
|
|
179
|
-
[3, 4, 4],
|
|
180
|
-
[4, 6, 3],
|
|
181
|
-
[8, 10, -1],
|
|
182
|
-
]
|
|
183
|
-
));
|
|
184
|
-
|
|
185
|
-
test("Multiple weights at a single locus", () =>
|
|
186
|
-
testWeightedCoverage(
|
|
187
|
-
[
|
|
188
|
-
// -- Locus 1
|
|
189
|
-
[1, 2, 1],
|
|
190
|
-
[1, 2, 2],
|
|
191
|
-
[1, 2, 3],
|
|
192
|
-
[1, 2, 4],
|
|
193
|
-
[1, 2, 5],
|
|
194
|
-
// -- Locus 2
|
|
195
|
-
[2, 3, 2],
|
|
196
|
-
[2, 3, 3],
|
|
197
|
-
[2, 3, 4],
|
|
198
|
-
[2, 3, 5],
|
|
199
|
-
[2, 3, 6],
|
|
200
|
-
],
|
|
201
|
-
[
|
|
202
|
-
// -- Locus 1
|
|
203
|
-
[1, 2, 15],
|
|
204
|
-
// -- Locus 2
|
|
205
|
-
[2, 3, 20],
|
|
206
|
-
]
|
|
207
|
-
));
|
|
208
|
-
|
|
209
|
-
test("Adjacent segments with different weights produce separated segments", () =>
|
|
210
|
-
testWeightedCoverage(
|
|
211
|
-
[
|
|
212
|
-
// -- Cluster 1
|
|
213
|
-
[1, 2, 2],
|
|
214
|
-
[2, 3, 1],
|
|
215
|
-
[3, 4, 1],
|
|
216
|
-
// -- Cluster 2
|
|
217
|
-
[5, 6, 1],
|
|
218
|
-
[6, 7, 2],
|
|
219
|
-
[7, 8, 1],
|
|
220
|
-
// -- Cluster 3
|
|
221
|
-
[9, 10, 1],
|
|
222
|
-
[10, 11, 1],
|
|
223
|
-
[11, 12, 2],
|
|
224
|
-
],
|
|
225
|
-
[
|
|
226
|
-
// -- Cluster 1
|
|
227
|
-
[1, 2, 2],
|
|
228
|
-
[2, 4, 1],
|
|
229
|
-
// -- Cluster 2
|
|
230
|
-
[5, 6, 1],
|
|
231
|
-
[6, 7, 2],
|
|
232
|
-
[7, 8, 1],
|
|
233
|
-
// -- Cluster 3
|
|
234
|
-
[9, 11, 1],
|
|
235
|
-
[11, 12, 2],
|
|
236
|
-
]
|
|
237
|
-
));
|
|
238
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { makeParamMediatorProvider, processData } from "../flowTestUtils.js";
|
|
3
|
-
import FilterTransform from "./filter.js";
|
|
4
|
-
|
|
5
|
-
test.todo("Implement stub for ParamMediator");
|
|
6
|
-
|
|
7
|
-
test("FilterTransform filter rows", () => {
|
|
8
|
-
const data = [1, 2, 3, 4, 5, 6].map((x) => ({ x }));
|
|
9
|
-
|
|
10
|
-
/** @type {import("../../spec/transform.js").FilterParams} */
|
|
11
|
-
const filterParams = {
|
|
12
|
-
type: "filter",
|
|
13
|
-
expr: "datum.x > 3 && datum.x != 5",
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const t = new FilterTransform(filterParams, makeParamMediatorProvider());
|
|
17
|
-
t.initialize();
|
|
18
|
-
|
|
19
|
-
expect(processData(t, data)).toEqual([4, 6].map((x) => ({ x })));
|
|
20
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { processData } from "../flowTestUtils.js";
|
|
3
|
-
import FlattenTransform from "./flatten.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {import("../../spec/transform.js").FlattenParams} params
|
|
7
|
-
* @param {any[]} data
|
|
8
|
-
*/
|
|
9
|
-
function transform(params, data) {
|
|
10
|
-
return processData(new FlattenTransform(params), data);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe("Flatten transform", () => {
|
|
14
|
-
/**
|
|
15
|
-
* @typedef {import("../../spec/transform.js").FlattenParams} FlattenParams
|
|
16
|
-
*/
|
|
17
|
-
test("With a single field", () => {
|
|
18
|
-
/** @type {FlattenParams} */
|
|
19
|
-
const params = { type: "flatten", fields: ["foo"] };
|
|
20
|
-
|
|
21
|
-
const input = [
|
|
22
|
-
{ name: "alpha", data: 123, foo: [1, 2] },
|
|
23
|
-
{ name: "beta", data: 456, foo: [3, 4, 5] },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
expect(transform(params, input)).toEqual([
|
|
27
|
-
{ name: "alpha", data: 123, foo: 1 },
|
|
28
|
-
{ name: "alpha", data: 123, foo: 2 },
|
|
29
|
-
{ name: "beta", data: 456, foo: 3 },
|
|
30
|
-
{ name: "beta", data: 456, foo: 4 },
|
|
31
|
-
{ name: "beta", data: 456, foo: 5 },
|
|
32
|
-
]);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test("With an index field", () => {
|
|
36
|
-
/** @type {FlattenParams} */
|
|
37
|
-
const params = { type: "flatten", fields: ["foo"], index: "idx" };
|
|
38
|
-
|
|
39
|
-
const input = [
|
|
40
|
-
{ name: "alpha", data: 123, foo: [1, 2] },
|
|
41
|
-
{ name: "beta", data: 456, foo: [3, 4, 5] },
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
expect(transform(params, input)).toEqual([
|
|
45
|
-
{ name: "alpha", data: 123, foo: 1, idx: 0 },
|
|
46
|
-
{ name: "alpha", data: 123, foo: 2, idx: 1 },
|
|
47
|
-
{ name: "beta", data: 456, foo: 3, idx: 0 },
|
|
48
|
-
{ name: "beta", data: 456, foo: 4, idx: 1 },
|
|
49
|
-
{ name: "beta", data: 456, foo: 5, idx: 2 },
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
test("With multiple fields", () => {
|
|
54
|
-
/** @type {FlattenParams} */
|
|
55
|
-
const params = { type: "flatten", fields: ["foo", "bar"] };
|
|
56
|
-
|
|
57
|
-
const input = [
|
|
58
|
-
{ key: "alpha", foo: [1, 2], bar: ["A", "B"] },
|
|
59
|
-
{ key: "beta", foo: [3, 4, 5], bar: ["C", "D"] },
|
|
60
|
-
];
|
|
61
|
-
|
|
62
|
-
expect(transform(params, input)).toEqual([
|
|
63
|
-
{ key: "alpha", foo: 1, bar: "A" },
|
|
64
|
-
{ key: "alpha", foo: 2, bar: "B" },
|
|
65
|
-
{ key: "beta", foo: 3, bar: "C" },
|
|
66
|
-
{ key: "beta", foo: 4, bar: "D" },
|
|
67
|
-
{ key: "beta", foo: 5, bar: null },
|
|
68
|
-
]);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
test("Throws on mismatching spec lengths", () => {
|
|
72
|
-
/** @type {FlattenParams} */
|
|
73
|
-
const params = {
|
|
74
|
-
type: "flatten",
|
|
75
|
-
fields: ["a", "b"],
|
|
76
|
-
as: ["a"],
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
expect(() => transform(params, [])).toThrow();
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
test("Missing fields property treats the input object as an array", () => {
|
|
83
|
-
/** @type {FlattenParams} */
|
|
84
|
-
const params = {
|
|
85
|
-
type: "flatten",
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const input = [[{ a: 1 }], [{ a: 2 }, { a: 3 }]];
|
|
89
|
-
|
|
90
|
-
expect(transform(params, input)).toEqual([
|
|
91
|
-
{ a: 1 },
|
|
92
|
-
{ a: 2 },
|
|
93
|
-
{ a: 3 },
|
|
94
|
-
]);
|
|
95
|
-
});
|
|
96
|
-
});
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { processData } from "../flowTestUtils.js";
|
|
3
|
-
import FlattenDelimitedTransform from "./flattenDelimited.js";
|
|
4
|
-
|
|
5
|
-
const sampleData = [
|
|
6
|
-
{ id: 1, a: "q, w, e", b: "a-s-d" },
|
|
7
|
-
{ id: 2, a: "r, t, y", b: "f-g-h" },
|
|
8
|
-
{ id: 3, a: "u", b: "j" },
|
|
9
|
-
];
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param {import("../../spec/transform.js").FlattenDelimitedParams} params
|
|
13
|
-
* @param {any[]} data
|
|
14
|
-
*/
|
|
15
|
-
function transform(params, data) {
|
|
16
|
-
return processData(new FlattenDelimitedTransform(params), data);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
describe("FlattenDelimited transform", () => {
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {import("../../spec/transform.js").FlattenDelimitedParams} FlattenDelimitedParams
|
|
22
|
-
*/
|
|
23
|
-
test("With a single field", () => {
|
|
24
|
-
/** @type {FlattenDelimitedParams} */
|
|
25
|
-
const params = {
|
|
26
|
-
type: "flattenDelimited",
|
|
27
|
-
field: "a",
|
|
28
|
-
separator: ", ",
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
expect(transform(params, sampleData)).toEqual([
|
|
32
|
-
{ id: 1, a: "q", b: "a-s-d" },
|
|
33
|
-
{ id: 1, a: "w", b: "a-s-d" },
|
|
34
|
-
{ id: 1, a: "e", b: "a-s-d" },
|
|
35
|
-
{ id: 2, a: "r", b: "f-g-h" },
|
|
36
|
-
{ id: 2, a: "t", b: "f-g-h" },
|
|
37
|
-
{ id: 2, a: "y", b: "f-g-h" },
|
|
38
|
-
{ id: 3, a: "u", b: "j" },
|
|
39
|
-
]);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test("With two fields", () => {
|
|
43
|
-
/** @type {FlattenDelimitedParams} */
|
|
44
|
-
const params = {
|
|
45
|
-
type: "flattenDelimited",
|
|
46
|
-
field: ["a", "b"],
|
|
47
|
-
as: ["a", "c"],
|
|
48
|
-
separator: [", ", "-"],
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
expect(transform(params, sampleData)).toEqual([
|
|
52
|
-
{ id: 1, a: "q", b: "a-s-d", c: "a" },
|
|
53
|
-
{ id: 1, a: "w", b: "a-s-d", c: "s" },
|
|
54
|
-
{ id: 1, a: "e", b: "a-s-d", c: "d" },
|
|
55
|
-
{ id: 2, a: "r", b: "f-g-h", c: "f" },
|
|
56
|
-
{ id: 2, a: "t", b: "f-g-h", c: "g" },
|
|
57
|
-
{ id: 2, a: "y", b: "f-g-h", c: "h" },
|
|
58
|
-
{ id: 3, a: "u", b: "j", c: "j" },
|
|
59
|
-
]);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test("Throws on differing field lengths", () => {
|
|
63
|
-
const data = [
|
|
64
|
-
{
|
|
65
|
-
a: "1-2",
|
|
66
|
-
b: "1-2-3",
|
|
67
|
-
},
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
/** @type {FlattenDelimitedParams} */
|
|
71
|
-
const params = {
|
|
72
|
-
type: "flattenDelimited",
|
|
73
|
-
field: ["a", "b"],
|
|
74
|
-
separator: ["-", "-"],
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
expect(() => transform(params, data)).toThrow();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("Throws on mismatching spec lengths", () => {
|
|
81
|
-
/** @type {FlattenDelimitedParams} */
|
|
82
|
-
const params = {
|
|
83
|
-
type: "flattenDelimited",
|
|
84
|
-
field: ["a", "b"],
|
|
85
|
-
separator: ["a"],
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
expect(() => transform(params, sampleData)).toThrow();
|
|
89
|
-
});
|
|
90
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { processData } from "../flowTestUtils.js";
|
|
3
|
-
import FlattenSequenceTransform from "./flattenSequence.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @param {import("../../spec/transform.js").FlattenSequenceParams} params
|
|
7
|
-
* @param {any[]} data
|
|
8
|
-
*/
|
|
9
|
-
function transform(params, data) {
|
|
10
|
-
return processData(new FlattenSequenceTransform(params), data);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
test("FlattenSequenece", () => {
|
|
14
|
-
expect(
|
|
15
|
-
transform(
|
|
16
|
-
{
|
|
17
|
-
type: "flattenSequence",
|
|
18
|
-
field: "seq",
|
|
19
|
-
as: ["p", "seq"],
|
|
20
|
-
},
|
|
21
|
-
[
|
|
22
|
-
{ identifier: "A", seq: "TCG" },
|
|
23
|
-
{ identifier: "B", seq: "AAT" },
|
|
24
|
-
]
|
|
25
|
-
)
|
|
26
|
-
).toEqual([
|
|
27
|
-
{ identifier: "A", seq: "T", p: 0 },
|
|
28
|
-
{ identifier: "A", seq: "C", p: 1 },
|
|
29
|
-
{ identifier: "A", seq: "G", p: 2 },
|
|
30
|
-
{ identifier: "B", seq: "A", p: 0 },
|
|
31
|
-
{ identifier: "B", seq: "A", p: 1 },
|
|
32
|
-
{ identifier: "B", seq: "T", p: 2 },
|
|
33
|
-
]);
|
|
34
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { makeParamMediatorProvider, processData } from "../flowTestUtils.js";
|
|
3
|
-
import FormulaTransform from "./formula.js";
|
|
4
|
-
|
|
5
|
-
test.todo("Implement stub for ParamMediator");
|
|
6
|
-
|
|
7
|
-
test("FormulaTransform", () => {
|
|
8
|
-
const data = [{ a: 2 }, { a: 3 }];
|
|
9
|
-
|
|
10
|
-
const t = new FormulaTransform(
|
|
11
|
-
{
|
|
12
|
-
type: "formula",
|
|
13
|
-
expr: "datum.a * 2",
|
|
14
|
-
as: "b",
|
|
15
|
-
},
|
|
16
|
-
makeParamMediatorProvider()
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
t.initialize();
|
|
20
|
-
|
|
21
|
-
expect(processData(t, data)).toEqual([
|
|
22
|
-
{ a: 2, b: 4 },
|
|
23
|
-
{ a: 3, b: 6 },
|
|
24
|
-
]);
|
|
25
|
-
});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { range } from "d3-array";
|
|
3
|
-
import { processData } from "../flowTestUtils.js";
|
|
4
|
-
import IdentifierTransform, {
|
|
5
|
-
BLOCK_SIZE,
|
|
6
|
-
UNIQUE_ID_KEY,
|
|
7
|
-
} from "./identifier.js";
|
|
8
|
-
|
|
9
|
-
test("An IdentifierTransform adds identifiers correctly", () => {
|
|
10
|
-
const data = range(BLOCK_SIZE * 2).map((x) => ({ data: x }));
|
|
11
|
-
|
|
12
|
-
const identifiedData = processData(
|
|
13
|
-
new IdentifierTransform({ type: "identifier" }),
|
|
14
|
-
data
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
// The fist block is skipped
|
|
18
|
-
const firstId = BLOCK_SIZE;
|
|
19
|
-
|
|
20
|
-
expect(identifiedData[0]).toEqual({ data: 0, [UNIQUE_ID_KEY]: firstId });
|
|
21
|
-
expect(identifiedData[1]).toEqual({
|
|
22
|
-
data: 1,
|
|
23
|
-
[UNIQUE_ID_KEY]: firstId + 1,
|
|
24
|
-
});
|
|
25
|
-
expect(identifiedData[BLOCK_SIZE]).toEqual({
|
|
26
|
-
data: BLOCK_SIZE,
|
|
27
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE,
|
|
28
|
-
});
|
|
29
|
-
expect(identifiedData[BLOCK_SIZE + 1]).toEqual({
|
|
30
|
-
data: BLOCK_SIZE + 1,
|
|
31
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE + 1,
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test("Another transform instance adds identifiers correctly", () => {
|
|
36
|
-
const data = range(BLOCK_SIZE * 2).map((x) => ({ data: x }));
|
|
37
|
-
// Another instance
|
|
38
|
-
const identifiedData = processData(
|
|
39
|
-
new IdentifierTransform({ type: "identifier" }),
|
|
40
|
-
data
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
// The fist block was skipped and the previous test case consumed two blocks
|
|
44
|
-
const firstId = BLOCK_SIZE * 3;
|
|
45
|
-
|
|
46
|
-
expect(identifiedData[0]).toEqual({ data: 0, [UNIQUE_ID_KEY]: firstId });
|
|
47
|
-
expect(identifiedData[1]).toEqual({
|
|
48
|
-
data: 1,
|
|
49
|
-
[UNIQUE_ID_KEY]: firstId + 1,
|
|
50
|
-
});
|
|
51
|
-
expect(identifiedData[BLOCK_SIZE]).toEqual({
|
|
52
|
-
data: BLOCK_SIZE,
|
|
53
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE,
|
|
54
|
-
});
|
|
55
|
-
expect(identifiedData[BLOCK_SIZE + 1]).toEqual({
|
|
56
|
-
data: BLOCK_SIZE + 1,
|
|
57
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE + 1,
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("IdentifierTransform recycles allocated blocks", () => {
|
|
62
|
-
let data = range(BLOCK_SIZE * 2).map((x) => ({ data: x }));
|
|
63
|
-
|
|
64
|
-
const transform = new IdentifierTransform({ type: "identifier" });
|
|
65
|
-
let identifiedData = processData(transform, data);
|
|
66
|
-
|
|
67
|
-
let firstId = BLOCK_SIZE * 5;
|
|
68
|
-
|
|
69
|
-
expect(identifiedData[0]).toEqual({ data: 0, [UNIQUE_ID_KEY]: firstId });
|
|
70
|
-
expect(identifiedData[BLOCK_SIZE]).toEqual({
|
|
71
|
-
data: BLOCK_SIZE,
|
|
72
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
data = range(BLOCK_SIZE * 3).map((x) => ({ data: x }));
|
|
76
|
-
|
|
77
|
-
// Resetting the transform. It should now reuse the allocated blocks.
|
|
78
|
-
transform.reset();
|
|
79
|
-
identifiedData = processData(transform, data);
|
|
80
|
-
|
|
81
|
-
expect(identifiedData[0]).toEqual({ data: 0, [UNIQUE_ID_KEY]: firstId });
|
|
82
|
-
expect(identifiedData[BLOCK_SIZE]).toEqual({
|
|
83
|
-
data: BLOCK_SIZE,
|
|
84
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE,
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
// ... and reserve one extra
|
|
88
|
-
expect(identifiedData[BLOCK_SIZE * 2]).toEqual({
|
|
89
|
-
data: BLOCK_SIZE * 2,
|
|
90
|
-
[UNIQUE_ID_KEY]: firstId + BLOCK_SIZE * 2,
|
|
91
|
-
});
|
|
92
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import PileupTransform from "./pileup.js";
|
|
3
|
-
import { processData } from "../flowTestUtils.js";
|
|
4
|
-
|
|
5
|
-
// TODO: Test for lane preferences
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @typedef {import("../../spec/transform.js").PileupParams} PileupParams
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const reads = [
|
|
12
|
-
[0, 4],
|
|
13
|
-
[1, 3],
|
|
14
|
-
[2, 6],
|
|
15
|
-
[4, 8],
|
|
16
|
-
[8, 10],
|
|
17
|
-
[11, 14],
|
|
18
|
-
[11, 13],
|
|
19
|
-
[11, 12],
|
|
20
|
-
[15, 18],
|
|
21
|
-
[16, 18],
|
|
22
|
-
[17, 18],
|
|
23
|
-
].map((d) => ({
|
|
24
|
-
start: d[0],
|
|
25
|
-
end: d[1],
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
const lanes = [0, 1, 2, 1, 0, 0, 1, 2, 0, 1, 2];
|
|
29
|
-
|
|
30
|
-
/** @type {PileupParams} */
|
|
31
|
-
const params = {
|
|
32
|
-
type: "pileup",
|
|
33
|
-
start: "start",
|
|
34
|
-
end: "end",
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* @param {PileupParams} params
|
|
39
|
-
* @param {any[]} data
|
|
40
|
-
*/
|
|
41
|
-
function pileupTransform(params, data) {
|
|
42
|
-
const t = new PileupTransform(params);
|
|
43
|
-
t.initialize();
|
|
44
|
-
return processData(t, data);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
test("Pileup transform produces correct pileup", () => {
|
|
48
|
-
const piledUp = lanes.map((d, i) => ({
|
|
49
|
-
...reads[i],
|
|
50
|
-
lane: d,
|
|
51
|
-
}));
|
|
52
|
-
|
|
53
|
-
expect(pileupTransform(params, reads)).toEqual(piledUp);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test("Pileup transform produces correct pileup with consecutive contigs", () => {
|
|
57
|
-
// Simulate data having multiple chromosomes, sorted by [chrom, pos].
|
|
58
|
-
// Piling should handle suddenly decreasing start positions by freeing all
|
|
59
|
-
// reserved lanes.
|
|
60
|
-
|
|
61
|
-
const repeatedReads = [...reads, ...reads];
|
|
62
|
-
const repeatedLanes = [...lanes, ...lanes];
|
|
63
|
-
|
|
64
|
-
const piledUp = repeatedLanes.map((d, i) => ({
|
|
65
|
-
...repeatedReads[i],
|
|
66
|
-
lane: d,
|
|
67
|
-
}));
|
|
68
|
-
|
|
69
|
-
expect(pileupTransform(params, repeatedReads)).toEqual(piledUp);
|
|
70
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { processData } from "../flowTestUtils.js";
|
|
3
|
-
import ProjectTransform from "./project.js";
|
|
4
|
-
|
|
5
|
-
test("Project", () => {
|
|
6
|
-
const data = [
|
|
7
|
-
{
|
|
8
|
-
foo: "FOO",
|
|
9
|
-
bar: "BAR",
|
|
10
|
-
baz: { a: "A" },
|
|
11
|
-
},
|
|
12
|
-
];
|
|
13
|
-
|
|
14
|
-
/** @param {import("../../spec/transform.js").ProjectParams} params */
|
|
15
|
-
const p = (params) => processData(new ProjectTransform(params), data);
|
|
16
|
-
|
|
17
|
-
expect(p({ type: "project", fields: ["bar"] })).toEqual([{ bar: "BAR" }]);
|
|
18
|
-
|
|
19
|
-
expect(
|
|
20
|
-
p({ type: "project", fields: ["bar", "foo"], as: ["xBar", "xFoo"] })
|
|
21
|
-
).toEqual([{ xBar: "BAR", xFoo: "FOO" }]);
|
|
22
|
-
|
|
23
|
-
expect(p({ type: "project", fields: ["baz.a"] })).toEqual([
|
|
24
|
-
{ "baz.a": "A" },
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
expect(p({ type: "project", fields: ["baz.a"], as: ["a"] })).toEqual([
|
|
28
|
-
{ a: "A" },
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
expect(() => p({ type: "project", fields: ["bar"], as: [] })).toThrow();
|
|
32
|
-
});
|