@jbrowse/plugin-variants 3.6.4 → 3.7.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/LinearVariantDisplay/model.d.ts +17 -2
- package/dist/MultiLinearVariantDisplay/model.d.ts +17 -2
- package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +17 -2
- package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +6 -4
- package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +6 -3
- package/dist/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.d.ts +7 -2
- package/dist/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.js +14 -17
- package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +2 -1
- package/dist/MultiLinearVariantRenderer/makeImageData.js +32 -22
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +1 -1
- package/dist/VariantFeatureWidget/AltFormatter.d.ts +2 -2
- package/dist/VariantFeatureWidget/AltFormatter.js +3 -3
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +1 -1
- package/dist/VariantFeatureWidget/stateModelFactory.d.ts +4 -4
- package/dist/VcfAdapter/VcfAdapter.d.ts +5 -5
- package/dist/VcfAdapter/VcfAdapter.js +2 -2
- package/dist/VcfFeature/index.d.ts +1 -1
- package/dist/VcfFeature/index.js +21 -5
- package/dist/shared/MultiVariantBaseModel.d.ts +17 -2
- package/dist/shared/SharedVariantMixin.d.ts +17 -2
- package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +3 -3
- package/dist/shared/components/SetColorDialog.js +2 -45
- package/dist/shared/components/SetColorDialogBulkEditPanel.d.ts +10 -0
- package/dist/shared/components/{BulkEditPanel.js → SetColorDialogBulkEditPanel.js} +2 -2
- package/dist/shared/components/SetColorDialogHelpfulTips.d.ts +1 -0
- package/dist/shared/components/{HelpfulTips.js → SetColorDialogHelpfulTips.js} +2 -2
- package/dist/shared/components/SetColorDialogRowPalettizer.d.ts +10 -0
- package/dist/shared/components/{RowPalettizer.js → SetColorDialogRowPalettizer.js} +13 -12
- package/dist/shared/components/ui/SetColorDialog.d.ts +31 -0
- package/dist/shared/components/ui/SetColorDialog.js +51 -0
- package/dist/shared/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
- package/dist/shared/components/ui/SetColorDialogBulkEditPanel.js +84 -0
- package/dist/shared/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
- package/dist/shared/components/ui/SetColorDialogHelpfulTips.js +7 -0
- package/dist/shared/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
- package/dist/shared/components/ui/SetColorDialogRowPalettizer.js +41 -0
- package/dist/shared/util.d.ts +0 -1
- package/dist/shared/util.js +0 -8
- package/esm/LinearVariantDisplay/model.d.ts +17 -2
- package/esm/MultiLinearVariantDisplay/model.d.ts +17 -2
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +17 -2
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +6 -4
- package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +6 -3
- package/esm/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.d.ts +7 -2
- package/esm/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.js +14 -17
- package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +2 -1
- package/esm/MultiLinearVariantRenderer/makeImageData.js +32 -22
- package/esm/StructuralVariantChordRenderer/ReactComponent.js +1 -1
- package/esm/VariantFeatureWidget/AltFormatter.d.ts +2 -2
- package/esm/VariantFeatureWidget/AltFormatter.js +4 -4
- package/esm/VariantFeatureWidget/VariantFeatureWidget.js +1 -1
- package/esm/VariantFeatureWidget/stateModelFactory.d.ts +4 -4
- package/esm/VcfAdapter/VcfAdapter.d.ts +5 -5
- package/esm/VcfAdapter/VcfAdapter.js +1 -1
- package/esm/VcfFeature/index.d.ts +1 -1
- package/esm/VcfFeature/index.js +19 -3
- package/esm/shared/MultiVariantBaseModel.d.ts +17 -2
- package/esm/shared/SharedVariantMixin.d.ts +17 -2
- package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +3 -3
- package/esm/shared/components/SetColorDialog.js +3 -46
- package/esm/shared/components/SetColorDialogBulkEditPanel.d.ts +10 -0
- package/esm/shared/components/{BulkEditPanel.js → SetColorDialogBulkEditPanel.js} +1 -1
- package/esm/shared/components/SetColorDialogHelpfulTips.d.ts +1 -0
- package/esm/shared/components/{HelpfulTips.js → SetColorDialogHelpfulTips.js} +1 -1
- package/esm/shared/components/SetColorDialogRowPalettizer.d.ts +10 -0
- package/esm/shared/components/{RowPalettizer.js → SetColorDialogRowPalettizer.js} +11 -10
- package/esm/shared/components/ui/SetColorDialog.d.ts +31 -0
- package/esm/shared/components/ui/SetColorDialog.js +45 -0
- package/esm/shared/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
- package/esm/shared/components/ui/SetColorDialogBulkEditPanel.js +81 -0
- package/esm/shared/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
- package/esm/shared/components/ui/SetColorDialogHelpfulTips.js +4 -0
- package/esm/shared/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
- package/esm/shared/components/ui/SetColorDialogRowPalettizer.js +38 -0
- package/esm/shared/util.d.ts +0 -1
- package/esm/shared/util.js +0 -7
- package/package.json +7 -7
- package/dist/shared/components/BulkEditPanel.d.ts +0 -5
- package/dist/shared/components/HelpfulTips.d.ts +0 -1
- package/dist/shared/components/RowPalettizer.d.ts +0 -5
- package/esm/shared/components/BulkEditPanel.d.ts +0 -5
- package/esm/shared/components/HelpfulTips.d.ts +0 -1
- package/esm/shared/components/RowPalettizer.d.ts +0 -5
|
@@ -181,6 +181,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
181
181
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
182
182
|
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
183
183
|
} & {
|
|
184
|
+
mouseoverExtraInformation: string | undefined;
|
|
184
185
|
featureIdUnderMouse: undefined | string;
|
|
185
186
|
contextMenuFeature: undefined | Feature;
|
|
186
187
|
} & {
|
|
@@ -195,9 +196,22 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
195
196
|
} & {
|
|
196
197
|
readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
|
|
197
198
|
readonly featureUnderMouse: Feature | undefined;
|
|
199
|
+
readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
|
|
200
|
+
label?: string;
|
|
201
|
+
description?: string;
|
|
202
|
+
refName: string;
|
|
203
|
+
}]>;
|
|
198
204
|
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
199
|
-
getFeatureByID(blockKey: string, id: string): [number, number, number, number] |
|
|
200
|
-
|
|
205
|
+
getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
206
|
+
label?: string;
|
|
207
|
+
description?: string;
|
|
208
|
+
refName: string;
|
|
209
|
+
}]) | undefined;
|
|
210
|
+
searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
211
|
+
label?: string;
|
|
212
|
+
description?: string;
|
|
213
|
+
refName: string;
|
|
214
|
+
}]) | undefined;
|
|
201
215
|
} & {
|
|
202
216
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
203
217
|
deleteBlock(key: string): void;
|
|
@@ -206,6 +220,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
206
220
|
clearFeatureSelection(): void;
|
|
207
221
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
208
222
|
setContextMenuFeature(feature?: Feature): void;
|
|
223
|
+
setMouseoverExtraInformation(extra?: string): void;
|
|
209
224
|
} & {
|
|
210
225
|
reload(): Promise<void>;
|
|
211
226
|
} & {
|
|
@@ -189,6 +189,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
189
189
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
190
190
|
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
191
191
|
} & {
|
|
192
|
+
mouseoverExtraInformation: string | undefined;
|
|
192
193
|
featureIdUnderMouse: undefined | string;
|
|
193
194
|
contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
|
|
194
195
|
} & {
|
|
@@ -203,9 +204,22 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
203
204
|
} & {
|
|
204
205
|
readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
|
|
205
206
|
readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
|
|
207
|
+
readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
|
|
208
|
+
label?: string;
|
|
209
|
+
description?: string;
|
|
210
|
+
refName: string;
|
|
211
|
+
}]>;
|
|
206
212
|
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
207
|
-
getFeatureByID(blockKey: string, id: string): [number, number, number, number] |
|
|
208
|
-
|
|
213
|
+
getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
214
|
+
label?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
refName: string;
|
|
217
|
+
}]) | undefined;
|
|
218
|
+
searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
219
|
+
label?: string;
|
|
220
|
+
description?: string;
|
|
221
|
+
refName: string;
|
|
222
|
+
}]) | undefined;
|
|
209
223
|
} & {
|
|
210
224
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
211
225
|
deleteBlock(key: string): void;
|
|
@@ -214,6 +228,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
214
228
|
clearFeatureSelection(): void;
|
|
215
229
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
216
230
|
setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
|
|
231
|
+
setMouseoverExtraInformation(extra?: string): void;
|
|
217
232
|
} & {
|
|
218
233
|
reload(): Promise<void>;
|
|
219
234
|
} & {
|
|
@@ -189,6 +189,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
189
189
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
190
190
|
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
191
191
|
} & {
|
|
192
|
+
mouseoverExtraInformation: string | undefined;
|
|
192
193
|
featureIdUnderMouse: undefined | string;
|
|
193
194
|
contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
|
|
194
195
|
} & {
|
|
@@ -203,9 +204,22 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
203
204
|
} & {
|
|
204
205
|
readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
|
|
205
206
|
readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
|
|
207
|
+
readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
|
|
208
|
+
label?: string;
|
|
209
|
+
description?: string;
|
|
210
|
+
refName: string;
|
|
211
|
+
}]>;
|
|
206
212
|
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
207
|
-
getFeatureByID(blockKey: string, id: string): [number, number, number, number] |
|
|
208
|
-
|
|
213
|
+
getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
214
|
+
label?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
refName: string;
|
|
217
|
+
}]) | undefined;
|
|
218
|
+
searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
219
|
+
label?: string;
|
|
220
|
+
description?: string;
|
|
221
|
+
refName: string;
|
|
222
|
+
}]) | undefined;
|
|
209
223
|
} & {
|
|
210
224
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
211
225
|
deleteBlock(key: string): void;
|
|
@@ -214,6 +228,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
|
|
|
214
228
|
clearFeatureSelection(): void;
|
|
215
229
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
216
230
|
setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
|
|
231
|
+
setMouseoverExtraInformation(extra?: string): void;
|
|
217
232
|
} & {
|
|
218
233
|
reload(): Promise<void>;
|
|
219
234
|
} & {
|
|
@@ -53,7 +53,8 @@ async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
|
|
56
|
+
const cacheKey = `${genotype}:${mostFrequentAlt}`;
|
|
57
|
+
let c = colorCache[cacheKey];
|
|
57
58
|
if (c === undefined) {
|
|
58
59
|
let alt = 0;
|
|
59
60
|
let uncalled = 0;
|
|
@@ -77,7 +78,7 @@ async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
c = (0, drawAlleleCount_1.getColorAlleleCount)(ref, alt, alt2, uncalled, total, true);
|
|
80
|
-
colorCache[
|
|
81
|
+
colorCache[cacheKey] = c;
|
|
81
82
|
}
|
|
82
83
|
if (c) {
|
|
83
84
|
(0, drawAlleleCount_1.drawColorAlleleCount)(c, ctx, x, y, w, h);
|
|
@@ -109,7 +110,8 @@ async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
|
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
else {
|
|
112
|
-
|
|
113
|
+
const cacheKey = `${genotype}:${mostFrequentAlt}`;
|
|
114
|
+
let c = colorCache[cacheKey];
|
|
113
115
|
if (c === undefined) {
|
|
114
116
|
let alt = 0;
|
|
115
117
|
let uncalled = 0;
|
|
@@ -133,7 +135,7 @@ async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
c = (0, drawAlleleCount_1.getColorAlleleCount)(ref, alt, alt2, uncalled, total, true);
|
|
136
|
-
colorCache[
|
|
138
|
+
colorCache[cacheKey] = c;
|
|
137
139
|
}
|
|
138
140
|
if (c) {
|
|
139
141
|
(0, drawAlleleCount_1.drawColorAlleleCount)(c, ctx, x, y, w, h);
|
|
@@ -8,7 +8,8 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
8
8
|
height: number;
|
|
9
9
|
width: number;
|
|
10
10
|
containsNoTransferables: boolean;
|
|
11
|
-
|
|
11
|
+
flatbush: ArrayBufferLike;
|
|
12
|
+
items: any[];
|
|
12
13
|
featureGenotypeMap: {
|
|
13
14
|
[k: string]: {
|
|
14
15
|
alt: any;
|
|
@@ -26,7 +27,8 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
26
27
|
height: number;
|
|
27
28
|
width: number;
|
|
28
29
|
containsNoTransferables: boolean;
|
|
29
|
-
|
|
30
|
+
flatbush: ArrayBufferLike;
|
|
31
|
+
items: any[];
|
|
30
32
|
featureGenotypeMap: {
|
|
31
33
|
[k: string]: {
|
|
32
34
|
alt: any;
|
|
@@ -44,7 +46,8 @@ export default class MultiVariantBaseRenderer extends FeatureRendererType {
|
|
|
44
46
|
height: number;
|
|
45
47
|
width: number;
|
|
46
48
|
containsNoTransferables: boolean;
|
|
47
|
-
|
|
49
|
+
flatbush: ArrayBufferLike;
|
|
50
|
+
items: any[];
|
|
48
51
|
featureGenotypeMap: {
|
|
49
52
|
[k: string]: {
|
|
50
53
|
alt: any;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { Source } from '../../shared/types';
|
|
2
2
|
import type { Feature } from '@jbrowse/core/util';
|
|
3
3
|
import type { Region } from '@jbrowse/core/util/types';
|
|
4
|
-
|
|
4
|
+
interface Item {
|
|
5
|
+
genotype: string;
|
|
6
|
+
featureId: string;
|
|
7
|
+
bpLen: number;
|
|
8
|
+
}
|
|
5
9
|
interface MinimizedVariantRecord {
|
|
6
10
|
alt: string[];
|
|
7
11
|
ref: string;
|
|
@@ -19,7 +23,8 @@ declare const MultiVariantRendering: (props: {
|
|
|
19
23
|
scrollTop: number;
|
|
20
24
|
featureGenotypeMap: Record<string, MinimizedVariantRecord>;
|
|
21
25
|
totalHeight: number;
|
|
22
|
-
|
|
26
|
+
flatbush: any;
|
|
27
|
+
items: Item[];
|
|
23
28
|
displayModel: any;
|
|
24
29
|
onMouseLeave?: (event: React.MouseEvent) => void;
|
|
25
30
|
onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void;
|
|
@@ -7,33 +7,30 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const ui_1 = require("@jbrowse/core/ui");
|
|
9
9
|
const util_1 = require("@jbrowse/core/util");
|
|
10
|
+
const flatbush_1 = __importDefault(require("@jbrowse/core/util/flatbush"));
|
|
10
11
|
const mobx_react_1 = require("mobx-react");
|
|
11
|
-
const rbush_1 = __importDefault(require("rbush"));
|
|
12
12
|
const util_2 = require("./util");
|
|
13
13
|
const util_3 = require("../../VcfFeature/util");
|
|
14
14
|
const MultiVariantRendering = (0, mobx_react_1.observer)(function (props) {
|
|
15
|
-
const { featureGenotypeMap, totalHeight, scrollTop } = props;
|
|
16
|
-
const { rbush, displayModel } = props;
|
|
15
|
+
const { flatbush, items, displayModel, featureGenotypeMap, totalHeight, scrollTop, } = props;
|
|
17
16
|
const ref = (0, react_1.useRef)(null);
|
|
18
|
-
const
|
|
17
|
+
const flatbush2 = (0, react_1.useMemo)(() => flatbush_1.default.from(flatbush), [flatbush]);
|
|
19
18
|
function getFeatureUnderMouse(eventClientX, eventClientY) {
|
|
19
|
+
var _a;
|
|
20
20
|
let offsetX = 0;
|
|
21
21
|
let offsetY = 0;
|
|
22
|
-
if (ref.current) {
|
|
23
|
-
|
|
24
|
-
offsetX = eventClientX - r.left;
|
|
25
|
-
offsetY = eventClientY - r.top - ((displayModel === null || displayModel === void 0 ? void 0 : displayModel.scrollTop) || 0);
|
|
22
|
+
if (!ref.current) {
|
|
23
|
+
return;
|
|
26
24
|
}
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
maxY: offsetY + 1,
|
|
32
|
-
});
|
|
25
|
+
const rect = ref.current.getBoundingClientRect();
|
|
26
|
+
offsetX = eventClientX - rect.left;
|
|
27
|
+
offsetY = eventClientY - rect.top - ((displayModel === null || displayModel === void 0 ? void 0 : displayModel.scrollTop) || 0);
|
|
28
|
+
const x = flatbush2.search(offsetX, offsetY, offsetX + 1, offsetY + 1);
|
|
33
29
|
if (x.length) {
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
30
|
+
const res = (0, util_2.minElt)(x, idx => { var _a, _b; return (_b = (_a = items[idx]) === null || _a === void 0 ? void 0 : _a.bpLen) !== null && _b !== void 0 ? _b : 0; });
|
|
31
|
+
const { bpLen, genotype, featureId, ...rest } = (_a = items[res]) !== null && _a !== void 0 ? _a : {};
|
|
32
|
+
const ret = featureId !== undefined ? featureGenotypeMap[featureId] : undefined;
|
|
33
|
+
if (ret && genotype) {
|
|
37
34
|
const { ref, alt, name, description, length } = ret;
|
|
38
35
|
const alleles = (0, util_3.makeSimpleAltString)(genotype, ref, alt);
|
|
39
36
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MultiRenderArgsDeserialized } from './types';
|
|
2
2
|
export declare function makeImageData(ctx: CanvasRenderingContext2D, props: MultiRenderArgsDeserialized): Promise<{
|
|
3
|
-
|
|
3
|
+
flatbush: ArrayBufferLike;
|
|
4
|
+
items: any[];
|
|
4
5
|
featureGenotypeMap: {
|
|
5
6
|
[k: string]: {
|
|
6
7
|
alt: any;
|
|
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.makeImageData = makeImageData;
|
|
7
7
|
const util_1 = require("@jbrowse/core/util");
|
|
8
|
+
const flatbush_1 = __importDefault(require("@jbrowse/core/util/flatbush"));
|
|
8
9
|
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
9
|
-
const rbush_1 = __importDefault(require("rbush"));
|
|
10
10
|
const constants_1 = require("../shared/constants");
|
|
11
11
|
const drawAlleleCount_1 = require("../shared/drawAlleleCount");
|
|
12
12
|
const drawPhased_1 = require("../shared/drawPhased");
|
|
@@ -23,11 +23,14 @@ async function makeImageData(ctx, props) {
|
|
|
23
23
|
lengthCutoffFilter,
|
|
24
24
|
}));
|
|
25
25
|
(0, stopToken_1.checkStopToken)(stopToken);
|
|
26
|
-
const
|
|
26
|
+
const coords = [];
|
|
27
|
+
const items = [];
|
|
28
|
+
const colorCache = {};
|
|
27
29
|
await (0, util_1.updateStatus)('Drawing variants', statusCallback, () => {
|
|
28
30
|
(0, util_1.forEachWithStopTokenCheck)(mafs, stopToken, ({ mostFrequentAlt, feature }) => {
|
|
29
31
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
30
|
-
const
|
|
32
|
+
const featureId = feature.id();
|
|
33
|
+
const bpLen = feature.get('end') - feature.get('start');
|
|
31
34
|
const w = Math.max(Math.round(rightPx - leftPx), 2);
|
|
32
35
|
const samp = feature.get('genotypes');
|
|
33
36
|
let y = -scrollTop;
|
|
@@ -43,15 +46,13 @@ async function makeImageData(ctx, props) {
|
|
|
43
46
|
if (isPhased) {
|
|
44
47
|
const alleles = genotype.split('|');
|
|
45
48
|
if ((0, drawPhased_1.drawPhased)(alleles, ctx, x, y, w, h, HP, undefined, referenceDrawingMode === 'draw')) {
|
|
46
|
-
|
|
47
|
-
minX: x,
|
|
48
|
-
maxX: x + w,
|
|
49
|
-
minY: y,
|
|
50
|
-
maxY: y + h,
|
|
51
|
-
genotype,
|
|
49
|
+
items.push({
|
|
52
50
|
name,
|
|
53
|
-
|
|
51
|
+
genotype,
|
|
52
|
+
featureId,
|
|
53
|
+
bpLen,
|
|
54
54
|
});
|
|
55
|
+
coords.push(x, y, x + w, y + h);
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
else {
|
|
@@ -63,14 +64,14 @@ async function makeImageData(ctx, props) {
|
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
else {
|
|
66
|
-
const colorCache = {};
|
|
67
67
|
for (let j = 0; j < s; j++) {
|
|
68
68
|
const { name } = sources[j];
|
|
69
69
|
const genotype = samp[name];
|
|
70
70
|
const x = Math.floor(leftPx);
|
|
71
71
|
const h = Math.max(rowHeight, 1);
|
|
72
72
|
if (genotype) {
|
|
73
|
-
|
|
73
|
+
const cacheKey = `${genotype}:${mostFrequentAlt}`;
|
|
74
|
+
let c = colorCache[cacheKey];
|
|
74
75
|
if (c === undefined) {
|
|
75
76
|
let alt = 0;
|
|
76
77
|
let uncalled = 0;
|
|
@@ -94,19 +95,17 @@ async function makeImageData(ctx, props) {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
c = (0, drawAlleleCount_1.getColorAlleleCount)(ref, alt, alt2, uncalled, total, referenceDrawingMode === 'draw');
|
|
97
|
-
colorCache[
|
|
98
|
+
colorCache[cacheKey] = c;
|
|
98
99
|
}
|
|
99
100
|
if (c) {
|
|
100
|
-
(0, drawAlleleCount_1.drawColorAlleleCount)(c, ctx, x, y, w, h, feature.get('type'), feature.get('strand'),
|
|
101
|
-
|
|
102
|
-
minX: x,
|
|
103
|
-
maxX: x + w,
|
|
104
|
-
minY: y,
|
|
105
|
-
maxY: y + h,
|
|
106
|
-
genotype,
|
|
101
|
+
(0, drawAlleleCount_1.drawColorAlleleCount)(c, ctx, x, y, w, h, feature.get('type'), feature.get('strand'), bpLen > 5 ? 0.75 : 1);
|
|
102
|
+
items.push({
|
|
107
103
|
name,
|
|
108
|
-
|
|
104
|
+
genotype,
|
|
105
|
+
featureId,
|
|
106
|
+
bpLen,
|
|
109
107
|
});
|
|
108
|
+
coords.push(x, y, x + w, y + h);
|
|
110
109
|
}
|
|
111
110
|
}
|
|
112
111
|
y += rowHeight;
|
|
@@ -114,8 +113,19 @@ async function makeImageData(ctx, props) {
|
|
|
114
113
|
}
|
|
115
114
|
});
|
|
116
115
|
});
|
|
116
|
+
const flatbush = new flatbush_1.default(Math.max(items.length, 1));
|
|
117
|
+
if (items.length) {
|
|
118
|
+
for (let i = 0; i < coords.length; i += 4) {
|
|
119
|
+
flatbush.add(coords[i], coords[i + 1], coords[i + 2], coords[i + 3]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
flatbush.add(0, 0);
|
|
124
|
+
}
|
|
125
|
+
flatbush.finish();
|
|
117
126
|
return {
|
|
118
|
-
|
|
127
|
+
flatbush: flatbush.data,
|
|
128
|
+
items,
|
|
119
129
|
featureGenotypeMap: Object.fromEntries(mafs.map(({ feature }) => [
|
|
120
130
|
feature.id(),
|
|
121
131
|
{
|
|
@@ -23,7 +23,7 @@ const StructuralVariantChordsReactComponent = (0, mobx_react_1.observer)(functio
|
|
|
23
23
|
}, [blockDefinitions]);
|
|
24
24
|
return ((0, jsx_runtime_1.jsx)("g", { "data-testid": "structuralVariantChordRenderer", children: [...features.values()].map(feature => {
|
|
25
25
|
const id = feature.id();
|
|
26
|
-
const selected =
|
|
26
|
+
const selected = selectedFeatureId === id;
|
|
27
27
|
return ((0, jsx_runtime_1.jsx)(Chord_1.default, { feature: feature, config: config, radius: radius, bezierRadius: bezierRadius, blocksForRefs: blocksForRefsMemo, selected: selected, onClick: onChordClick }, id));
|
|
28
28
|
}) }));
|
|
29
29
|
});
|
|
@@ -4,10 +4,10 @@ exports.default = AltFormatter;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const util_1 = require("../VcfFeature/util");
|
|
7
|
-
function AltFormatter({ value,
|
|
7
|
+
function AltFormatter({ value, refString, }) {
|
|
8
8
|
const [show, setShow] = (0, react_1.useState)(false);
|
|
9
|
-
const alt = (0, util_1.getMinimalDesc)(
|
|
9
|
+
const alt = (0, react_1.useMemo)(() => (0, util_1.getMinimalDesc)(refString, value), [refString, value]);
|
|
10
10
|
return alt !== value ? ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("button", { onClick: () => {
|
|
11
11
|
setShow(!show);
|
|
12
|
-
}, children: show ? 'Show simplified ALT' : 'Show raw ALT' }), ' ', show ? value :
|
|
12
|
+
}, children: show ? 'Show simplified ALT' : 'Show raw ALT' }), ' ', show ? value : alt] })) : (value);
|
|
13
13
|
}
|
|
@@ -91,7 +91,7 @@ const FeatDefined = (0, mobx_react_1.observer)(function (props) {
|
|
|
91
91
|
...variantFieldDescriptions_1.variantFieldDescriptions,
|
|
92
92
|
...descriptions,
|
|
93
93
|
}, formatter: (value, key) => {
|
|
94
|
-
return key === 'ALT' ? ((0, jsx_runtime_1.jsx)(AltFormatter_1.default, { value: `${value}`,
|
|
94
|
+
return key === 'ALT' ? ((0, jsx_runtime_1.jsx)(AltFormatter_1.default, { value: `${value}`, refString: REF })) : ((0, jsx_runtime_1.jsx)(Formatter_1.default, { value: value }));
|
|
95
95
|
}, ...props }), (0, jsx_runtime_1.jsxs)(react_1.Suspense, { fallback: null, children: [(0, jsx_runtime_1.jsx)(CsqPanel, { feature: rest, descriptions: descriptions }), (0, jsx_runtime_1.jsx)(AnnPanel, { feature: rest, descriptions: descriptions }), (0, jsx_runtime_1.jsx)(LaunchBreakendWidgetArea, { model: model })] }), (0, jsx_runtime_1.jsx)(VariantSampleGrid_1.default, { feature: feat, ...props, descriptions: descriptions })] }));
|
|
96
96
|
});
|
|
97
97
|
const VariantFeatureWidget = (0, mobx_react_1.observer)(function (props) {
|
|
@@ -18,14 +18,14 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
18
18
|
upperCaseCDS: boolean;
|
|
19
19
|
charactersPerRow: number;
|
|
20
20
|
feature: import("@jbrowse/core/util").SimpleFeatureSerialized | undefined;
|
|
21
|
-
mode:
|
|
21
|
+
mode: "" | "genomic" | "gene" | "gene_collapsed_intron" | "gene_updownstream" | "cdna" | "cds" | "genomic_sequence_updownstream" | "protein";
|
|
22
22
|
} & {
|
|
23
23
|
setFeature(f: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
24
24
|
setUpDownBp(f: number): void;
|
|
25
25
|
setIntronBp(f: number): void;
|
|
26
26
|
setUpperCaseCDS(f: boolean): void;
|
|
27
27
|
setShowCoordinates(f: "none" | "relative" | "genomic"): void;
|
|
28
|
-
setMode(mode:
|
|
28
|
+
setMode(mode: "" | "genomic" | "gene" | "gene_collapsed_intron" | "gene_updownstream" | "cdna" | "cds" | "genomic_sequence_updownstream" | "protein"): void;
|
|
29
29
|
} & {
|
|
30
30
|
readonly showCoordinates: boolean;
|
|
31
31
|
readonly showGenomicCoordsOption: boolean;
|
|
@@ -69,14 +69,14 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
69
69
|
upperCaseCDS: boolean;
|
|
70
70
|
charactersPerRow: number;
|
|
71
71
|
feature: import("@jbrowse/core/util").SimpleFeatureSerialized | undefined;
|
|
72
|
-
mode:
|
|
72
|
+
mode: "" | "genomic" | "gene" | "gene_collapsed_intron" | "gene_updownstream" | "cdna" | "cds" | "genomic_sequence_updownstream" | "protein";
|
|
73
73
|
} & {
|
|
74
74
|
setFeature(f: import("@jbrowse/core/util").SimpleFeatureSerialized): void;
|
|
75
75
|
setUpDownBp(f: number): void;
|
|
76
76
|
setIntronBp(f: number): void;
|
|
77
77
|
setUpperCaseCDS(f: boolean): void;
|
|
78
78
|
setShowCoordinates(f: "none" | "relative" | "genomic"): void;
|
|
79
|
-
setMode(mode:
|
|
79
|
+
setMode(mode: "" | "genomic" | "gene" | "gene_collapsed_intron" | "gene_updownstream" | "cdna" | "cds" | "genomic_sequence_updownstream" | "protein"): void;
|
|
80
80
|
} & {
|
|
81
81
|
readonly showCoordinates: boolean;
|
|
82
82
|
readonly showGenomicCoordsOption: boolean;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import IntervalTree from '@flatten-js/interval-tree';
|
|
1
|
+
import { IntervalTree } from '@flatten-js/interval-tree';
|
|
2
2
|
import VcfParser from '@gmod/vcf';
|
|
3
3
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
4
4
|
import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
5
5
|
import type { Feature, Region } from '@jbrowse/core/util';
|
|
6
6
|
type StatusCallback = (arg: string) => void;
|
|
7
7
|
export default class VcfAdapter extends BaseFeatureDataAdapter {
|
|
8
|
-
calculatedIntervalTreeMap: Record<string, IntervalTree
|
|
8
|
+
calculatedIntervalTreeMap: Record<string, IntervalTree<Feature>>;
|
|
9
9
|
vcfFeatures?: Promise<{
|
|
10
10
|
header: string;
|
|
11
11
|
parser: VcfParser;
|
|
12
|
-
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree
|
|
12
|
+
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree<Feature>>;
|
|
13
13
|
}>;
|
|
14
14
|
static capabilities: string[];
|
|
15
15
|
getHeader(): Promise<string>;
|
|
@@ -18,13 +18,13 @@ export default class VcfAdapter extends BaseFeatureDataAdapter {
|
|
|
18
18
|
header: string;
|
|
19
19
|
parser: VcfParser;
|
|
20
20
|
intervalTreeMap: {
|
|
21
|
-
[k: string]: (sc?: (arg: string) => void) => IntervalTree<
|
|
21
|
+
[k: string]: (sc?: (arg: string) => void) => IntervalTree<Feature>;
|
|
22
22
|
};
|
|
23
23
|
}>;
|
|
24
24
|
setup(): Promise<{
|
|
25
25
|
header: string;
|
|
26
26
|
parser: VcfParser;
|
|
27
|
-
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree
|
|
27
|
+
intervalTreeMap: Record<string, (sc?: StatusCallback) => IntervalTree<Feature>>;
|
|
28
28
|
}>;
|
|
29
29
|
getRefNames(_?: BaseOptions): Promise<string[]>;
|
|
30
30
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const interval_tree_1 =
|
|
6
|
+
const interval_tree_1 = require("@flatten-js/interval-tree");
|
|
7
7
|
const vcf_1 = __importDefault(require("@gmod/vcf"));
|
|
8
8
|
const BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
9
9
|
const util_1 = require("@jbrowse/core/util");
|
|
@@ -36,7 +36,7 @@ class VcfAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
36
36
|
if (!this.calculatedIntervalTreeMap[refName]) {
|
|
37
37
|
sc === null || sc === void 0 ? void 0 : sc('Parsing VCF data');
|
|
38
38
|
let idx = 0;
|
|
39
|
-
const intervalTree = new interval_tree_1.
|
|
39
|
+
const intervalTree = new interval_tree_1.IntervalTree();
|
|
40
40
|
for (const line of lines) {
|
|
41
41
|
const f = new VcfFeature_1.default({
|
|
42
42
|
variant: parser.parseLine(line),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type Feature } from '@jbrowse/core/util';
|
|
1
2
|
import type VCFParser from '@gmod/vcf';
|
|
2
3
|
import type { Variant } from '@gmod/vcf';
|
|
3
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
export default class VCFFeature implements Feature {
|
|
5
5
|
private variant;
|
|
6
6
|
private parser;
|
package/dist/VcfFeature/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util_1 = require("
|
|
3
|
+
const util_1 = require("@jbrowse/core/util");
|
|
4
|
+
const util_2 = require("./util");
|
|
4
5
|
function dataFromVariant(variant, parser) {
|
|
5
6
|
const { REF = '', ALT, POS, CHROM, ID } = variant;
|
|
6
7
|
const start = POS - 1;
|
|
7
|
-
const [type, description] = (0,
|
|
8
|
+
const [type, description] = (0, util_2.getSOTermAndDescription)(REF, ALT, parser);
|
|
8
9
|
return {
|
|
9
10
|
refName: CHROM,
|
|
10
11
|
start,
|
|
@@ -15,15 +16,30 @@ function dataFromVariant(variant, parser) {
|
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
function getEnd(variant) {
|
|
18
|
-
|
|
19
|
-
const
|
|
19
|
+
var _a;
|
|
20
|
+
const { POS, REF = '', ALT = [] } = variant;
|
|
21
|
+
const isTRA = ALT.includes('<TRA>');
|
|
20
22
|
const start = POS - 1;
|
|
21
|
-
const isSymbolic = ALT
|
|
23
|
+
const isSymbolic = ALT.some(f => f.includes('<'));
|
|
22
24
|
if (isSymbolic) {
|
|
23
25
|
const info = variant.INFO;
|
|
24
26
|
if (info.END && !isTRA) {
|
|
25
27
|
return +info.END[0];
|
|
26
28
|
}
|
|
29
|
+
const lens = [];
|
|
30
|
+
if (info.SVLEN && !isTRA) {
|
|
31
|
+
const svlens = info.SVLEN;
|
|
32
|
+
for (let i = 0; i < svlens.length; i++) {
|
|
33
|
+
const svlen = svlens[i];
|
|
34
|
+
if ((_a = ALT[i]) === null || _a === void 0 ? void 0 : _a.startsWith('<INS')) {
|
|
35
|
+
lens.push(1);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
lens.push(Math.abs(+svlen));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return start + (0, util_1.max)(lens);
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
44
|
return start + REF.length;
|
|
29
45
|
}
|
|
@@ -186,6 +186,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
186
186
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
187
187
|
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
|
|
188
188
|
} & {
|
|
189
|
+
mouseoverExtraInformation: string | undefined;
|
|
189
190
|
featureIdUnderMouse: undefined | string;
|
|
190
191
|
contextMenuFeature: undefined | Feature;
|
|
191
192
|
} & {
|
|
@@ -200,9 +201,22 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
200
201
|
} & {
|
|
201
202
|
readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
|
|
202
203
|
readonly featureUnderMouse: Feature | undefined;
|
|
204
|
+
readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
|
|
205
|
+
label?: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
refName: string;
|
|
208
|
+
}]>;
|
|
203
209
|
getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
|
|
204
|
-
getFeatureByID(blockKey: string, id: string): [number, number, number, number] |
|
|
205
|
-
|
|
210
|
+
getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
211
|
+
label?: string;
|
|
212
|
+
description?: string;
|
|
213
|
+
refName: string;
|
|
214
|
+
}]) | undefined;
|
|
215
|
+
searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
|
|
216
|
+
label?: string;
|
|
217
|
+
description?: string;
|
|
218
|
+
refName: string;
|
|
219
|
+
}]) | undefined;
|
|
206
220
|
} & {
|
|
207
221
|
addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
|
|
208
222
|
deleteBlock(key: string): void;
|
|
@@ -211,6 +225,7 @@ export default function MultiVariantBaseModelF(configSchema: AnyConfigurationSch
|
|
|
211
225
|
clearFeatureSelection(): void;
|
|
212
226
|
setFeatureIdUnderMouse(feature?: string): void;
|
|
213
227
|
setContextMenuFeature(feature?: Feature): void;
|
|
228
|
+
setMouseoverExtraInformation(extra?: string): void;
|
|
214
229
|
} & {
|
|
215
230
|
reload(): Promise<void>;
|
|
216
231
|
} & {
|