@jbrowse/plugin-alignments 2.6.2 → 2.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/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +2 -1
- package/dist/AlignmentsFeatureDetail/util.d.ts +1 -3
- package/dist/BamAdapter/BamAdapter.d.ts +2 -9
- package/dist/CramAdapter/CramAdapter.d.ts +3 -11
- package/dist/CramAdapter/CramAdapter.js +2 -1
- package/dist/CramAdapter/util.js +3 -6
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +3 -4
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +3 -3
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +5 -9
- package/dist/LinearAlignmentsDisplay/models/model.js +1 -0
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +514 -0
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +547 -0
- package/dist/LinearPileupDisplay/components/ColorByModifications.d.ts +4 -5
- package/dist/LinearPileupDisplay/components/ColorByModifications.js +3 -4
- package/dist/LinearPileupDisplay/components/ColorByTag.d.ts +7 -5
- package/dist/LinearPileupDisplay/components/ColorByTag.js +4 -7
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +2 -2
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +4 -5
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +3 -3
- package/dist/LinearPileupDisplay/components/SetMaxHeight.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/SetMaxHeight.js +3 -3
- package/dist/LinearPileupDisplay/components/SortByTag.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/SortByTag.js +3 -3
- package/dist/LinearPileupDisplay/index.d.ts +1 -0
- package/dist/LinearPileupDisplay/index.js +3 -1
- package/dist/LinearPileupDisplay/model.d.ts +142 -234
- package/dist/LinearPileupDisplay/model.js +50 -446
- package/dist/LinearReadArcsDisplay/components/ReactComponent.d.ts +2 -2
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +2 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +9 -14
- package/dist/LinearReadCloudDisplay/components/ReactComponent.d.ts +2 -2
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +2 -1
- package/dist/LinearReadCloudDisplay/drawPairChains.js +1 -2
- package/dist/LinearReadCloudDisplay/model.d.ts +13 -15
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +18 -423
- package/dist/LinearSNPCoverageDisplay/models/model.js +18 -0
- package/dist/MismatchParser/index.js +6 -8
- package/dist/PileupRenderer/PileupRenderer.js +0 -25
- package/dist/PileupRenderer/colorBy.js +1 -1
- package/dist/PileupRenderer/components/PileupRendering.d.ts +9 -10
- package/dist/PileupRenderer/components/PileupRendering.js +3 -5
- package/dist/PileupRenderer/getAlignmentShapeColor.js +1 -1
- package/dist/PileupRenderer/layoutFeature.js +1 -2
- package/dist/PileupRenderer/makeImageData.d.ts +1 -3
- package/dist/PileupRenderer/renderMethylation.js +5 -10
- package/dist/PileupRenderer/renderMismatches.d.ts +2 -6
- package/dist/PileupRenderer/renderMismatches.js +8 -11
- package/dist/PileupRenderer/renderModifications.js +4 -8
- package/dist/PileupRenderer/renderSoftClipping.js +26 -25
- package/dist/PileupRenderer/sortUtil.js +2 -2
- package/dist/SNPCoverageAdapter/util.d.ts +9 -13
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +6 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/shared/BaseDisplayComponent.d.ts +2 -2
- package/dist/shared/BaseDisplayComponent.js +2 -1
- package/dist/shared/FilterByTag.d.ts +6 -15
- package/dist/shared/FilterByTag.js +4 -6
- package/dist/shared/color.d.ts +10 -0
- package/dist/shared/color.js +7 -1
- package/dist/shared/fetchChains.js +1 -0
- package/dist/shared/index.d.ts +9 -0
- package/dist/util.d.ts +3 -9
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +2 -1
- package/esm/AlignmentsFeatureDetail/util.d.ts +1 -3
- package/esm/BamAdapter/BamAdapter.d.ts +2 -9
- package/esm/CramAdapter/CramAdapter.d.ts +3 -11
- package/esm/CramAdapter/CramAdapter.js +2 -1
- package/esm/CramAdapter/util.js +3 -6
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +3 -4
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +3 -3
- package/esm/LinearAlignmentsDisplay/models/model.d.ts +5 -9
- package/esm/LinearAlignmentsDisplay/models/model.js +1 -0
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +514 -0
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +517 -0
- package/esm/LinearPileupDisplay/components/ColorByModifications.d.ts +4 -5
- package/esm/LinearPileupDisplay/components/ColorByModifications.js +3 -4
- package/esm/LinearPileupDisplay/components/ColorByTag.d.ts +7 -5
- package/esm/LinearPileupDisplay/components/ColorByTag.js +4 -7
- package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +2 -2
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.d.ts +4 -5
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.js +3 -3
- package/esm/LinearPileupDisplay/components/SetMaxHeight.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/SetMaxHeight.js +3 -3
- package/esm/LinearPileupDisplay/components/SortByTag.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/SortByTag.js +3 -3
- package/esm/LinearPileupDisplay/index.d.ts +1 -0
- package/esm/LinearPileupDisplay/index.js +1 -0
- package/esm/LinearPileupDisplay/model.d.ts +142 -234
- package/esm/LinearPileupDisplay/model.js +51 -447
- package/esm/LinearReadArcsDisplay/components/ReactComponent.d.ts +2 -2
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +2 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +9 -14
- package/esm/LinearReadCloudDisplay/components/ReactComponent.d.ts +2 -2
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +2 -1
- package/esm/LinearReadCloudDisplay/drawPairChains.js +1 -2
- package/esm/LinearReadCloudDisplay/model.d.ts +13 -15
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +18 -423
- package/esm/LinearSNPCoverageDisplay/models/model.js +18 -0
- package/esm/MismatchParser/index.js +6 -8
- package/esm/PileupRenderer/PileupRenderer.js +0 -2
- package/esm/PileupRenderer/colorBy.js +1 -1
- package/esm/PileupRenderer/components/PileupRendering.d.ts +9 -10
- package/esm/PileupRenderer/components/PileupRendering.js +3 -5
- package/esm/PileupRenderer/getAlignmentShapeColor.js +1 -1
- package/esm/PileupRenderer/layoutFeature.js +1 -2
- package/esm/PileupRenderer/makeImageData.d.ts +1 -3
- package/esm/PileupRenderer/renderMethylation.js +5 -10
- package/esm/PileupRenderer/renderMismatches.d.ts +2 -6
- package/esm/PileupRenderer/renderMismatches.js +8 -11
- package/esm/PileupRenderer/renderModifications.js +4 -8
- package/esm/PileupRenderer/renderSoftClipping.js +26 -25
- package/esm/PileupRenderer/sortUtil.js +2 -2
- package/esm/SNPCoverageAdapter/util.d.ts +9 -13
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +6 -12
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/shared/BaseDisplayComponent.d.ts +2 -2
- package/esm/shared/BaseDisplayComponent.js +3 -2
- package/esm/shared/FilterByTag.d.ts +6 -15
- package/esm/shared/FilterByTag.js +4 -6
- package/esm/shared/color.d.ts +10 -0
- package/esm/shared/color.js +6 -0
- package/esm/shared/fetchChains.js +1 -0
- package/esm/shared/index.d.ts +9 -0
- package/esm/util.d.ts +3 -9
- package/package.json +3 -4
|
@@ -8,6 +8,7 @@ const mobx_1 = require("mobx");
|
|
|
8
8
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
9
9
|
const plugin_wiggle_1 = require("@jbrowse/plugin-wiggle");
|
|
10
10
|
const util_1 = require("@jbrowse/core/util");
|
|
11
|
+
const serializableFilterChain_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain"));
|
|
11
12
|
// locals
|
|
12
13
|
const Tooltip_1 = __importDefault(require("../components/Tooltip"));
|
|
13
14
|
const shared_1 = require("../../shared");
|
|
@@ -49,6 +50,10 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
49
50
|
type: mobx_state_tree_1.types.string,
|
|
50
51
|
tag: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
51
52
|
})),
|
|
53
|
+
/**
|
|
54
|
+
* #property
|
|
55
|
+
*/
|
|
56
|
+
jexlFilters: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.array(mobx_state_tree_1.types.string), []),
|
|
52
57
|
}))
|
|
53
58
|
.volatile(() => ({
|
|
54
59
|
modificationTagMap: mobx_1.observable.map({}),
|
|
@@ -73,6 +78,12 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
73
78
|
setColorBy(colorBy) {
|
|
74
79
|
self.colorBy = (0, mobx_state_tree_1.cast)(colorBy);
|
|
75
80
|
},
|
|
81
|
+
/**
|
|
82
|
+
* #action
|
|
83
|
+
*/
|
|
84
|
+
setJexlFilters(filters) {
|
|
85
|
+
self.jexlFilters = (0, mobx_state_tree_1.cast)(filters);
|
|
86
|
+
},
|
|
76
87
|
/**
|
|
77
88
|
* #action
|
|
78
89
|
*/
|
|
@@ -147,6 +158,7 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
147
158
|
return {
|
|
148
159
|
...superProps,
|
|
149
160
|
notReady: !this.ready,
|
|
161
|
+
filters: self.filters,
|
|
150
162
|
modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),
|
|
151
163
|
// must use getSnapshot because otherwise changes to e.g. just the
|
|
152
164
|
// colorBy.type are not read
|
|
@@ -269,6 +281,12 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
269
281
|
},
|
|
270
282
|
];
|
|
271
283
|
},
|
|
284
|
+
/**
|
|
285
|
+
* #getter
|
|
286
|
+
*/
|
|
287
|
+
get filters() {
|
|
288
|
+
return new serializableFilterChain_1.default({ filters: self.jexlFilters });
|
|
289
|
+
},
|
|
272
290
|
};
|
|
273
291
|
});
|
|
274
292
|
}
|
|
@@ -151,8 +151,7 @@ function mdToMismatches(mdstring, ops, cigarMismatches, seq, qual) {
|
|
|
151
151
|
}
|
|
152
152
|
// now actually parse the MD string
|
|
153
153
|
const md = mdstring.match(mdRegex) || [];
|
|
154
|
-
for (
|
|
155
|
-
const token = md[i];
|
|
154
|
+
for (const token of md) {
|
|
156
155
|
const num = +token;
|
|
157
156
|
if (!Number.isNaN(num)) {
|
|
158
157
|
curr.start += num;
|
|
@@ -162,6 +161,7 @@ function mdToMismatches(mdstring, ops, cigarMismatches, seq, qual) {
|
|
|
162
161
|
}
|
|
163
162
|
else {
|
|
164
163
|
// mismatch
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
165
165
|
for (let j = 0; j < token.length; j += 1) {
|
|
166
166
|
curr.length = 1;
|
|
167
167
|
while (lastSkipPos < skips.length) {
|
|
@@ -274,8 +274,7 @@ function getModificationPositions(mm, fseq, fstrand) {
|
|
|
274
274
|
const seq = fstrand === -1 ? (0, util_1.revcom)(fseq) : fseq;
|
|
275
275
|
const mods = mm.split(';').filter(mod => !!mod);
|
|
276
276
|
const result = [];
|
|
277
|
-
for (
|
|
278
|
-
const mod = mods[i];
|
|
277
|
+
for (const mod of mods) {
|
|
279
278
|
const [basemod, ...skips] = mod.split(',');
|
|
280
279
|
// regexes based on parse_mm.pl from hts-specs
|
|
281
280
|
const matches = basemod.match(modificationRegex);
|
|
@@ -295,12 +294,11 @@ function getModificationPositions(mm, fseq, fstrand) {
|
|
|
295
294
|
// sequence of the read, if we have a modification type e.g. C+m;2 and a
|
|
296
295
|
// sequence ACGTACGTAC we skip the two instances of C and go to the last
|
|
297
296
|
// C
|
|
298
|
-
for (
|
|
299
|
-
const type = types[j];
|
|
297
|
+
for (const type of types) {
|
|
300
298
|
let i = 0;
|
|
301
299
|
const positions = [];
|
|
302
|
-
for (
|
|
303
|
-
let delta = +
|
|
300
|
+
for (const d of skips) {
|
|
301
|
+
let delta = +d;
|
|
304
302
|
do {
|
|
305
303
|
if (base === 'N' || base === seq[i]) {
|
|
306
304
|
delta--;
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
@@ -81,7 +58,6 @@ class PileupRenderer extends BoxRendererType_1.default {
|
|
|
81
58
|
: undefined;
|
|
82
59
|
const width = (region.end - region.start) / bpPerPx;
|
|
83
60
|
const height = Math.max(layout.getTotalHeight(), 1);
|
|
84
|
-
const Color = await Promise.resolve().then(() => __importStar(require('color'))).then(f => f.default);
|
|
85
61
|
const res = await (0, util_1.renderToAbstractCanvas)(width, height, renderProps, ctx => (0, makeImageData_1.makeImageData)({
|
|
86
62
|
ctx,
|
|
87
63
|
layoutRecords: layoutRecords.filter(util_1.notEmpty),
|
|
@@ -91,7 +67,6 @@ class PileupRenderer extends BoxRendererType_1.default {
|
|
|
91
67
|
layout,
|
|
92
68
|
features,
|
|
93
69
|
regionSequence,
|
|
94
|
-
Color,
|
|
95
70
|
},
|
|
96
71
|
}));
|
|
97
72
|
const results = await super.render({
|
|
@@ -12,7 +12,7 @@ function colorByInsertSize(feature) {
|
|
|
12
12
|
}
|
|
13
13
|
exports.colorByInsertSize = colorByInsertSize;
|
|
14
14
|
function colorByMappingQuality(feature) {
|
|
15
|
-
return `hsl(${feature.get('
|
|
15
|
+
return `hsl(${feature.get('score')},50%,50%)`;
|
|
16
16
|
}
|
|
17
17
|
exports.colorByMappingQuality = colorByMappingQuality;
|
|
18
18
|
function getOrientation(feature, config) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Region } from '@jbrowse/core/util/types';
|
|
3
3
|
import type { BaseLinearDisplayModel } from '@jbrowse/plugin-linear-genome-view';
|
|
4
|
-
declare
|
|
4
|
+
declare const PileupRendering: (props: {
|
|
5
5
|
blockKey: string;
|
|
6
6
|
displayModel: BaseLinearDisplayModel;
|
|
7
7
|
width: number;
|
|
@@ -12,17 +12,16 @@ declare function PileupRendering(props: {
|
|
|
12
12
|
type: string;
|
|
13
13
|
pos: number;
|
|
14
14
|
refName: string;
|
|
15
|
-
};
|
|
15
|
+
} | undefined;
|
|
16
16
|
colorBy?: {
|
|
17
17
|
type: string;
|
|
18
|
-
tag?: string;
|
|
19
|
-
};
|
|
18
|
+
tag?: string | undefined;
|
|
19
|
+
} | undefined;
|
|
20
20
|
filterBy?: {
|
|
21
21
|
tagFilter?: {
|
|
22
22
|
tag: string;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
onMouseMove?: (event: React.MouseEvent, featureId?: string) => void;
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
export default _default;
|
|
23
|
+
} | undefined;
|
|
24
|
+
} | undefined;
|
|
25
|
+
onMouseMove?: ((event: React.MouseEvent, featureId?: string) => void) | undefined;
|
|
26
|
+
}) => React.JSX.Element;
|
|
27
|
+
export default PileupRendering;
|
|
@@ -30,7 +30,7 @@ const mobx_react_1 = require("mobx-react");
|
|
|
30
30
|
// used so that user can click-away-from-feature below the laid out features
|
|
31
31
|
// (issue #1248)
|
|
32
32
|
const canvasPadding = 100;
|
|
33
|
-
|
|
33
|
+
const PileupRendering = (0, mobx_react_1.observer)(function (props) {
|
|
34
34
|
var _a;
|
|
35
35
|
const { onMouseMove, blockKey, displayModel, width, height, regions, bpPerPx, sortedBy, colorBy, filterBy, } = props;
|
|
36
36
|
const { selectedFeatureId, featureIdUnderMouse, contextMenuFeature } = displayModel;
|
|
@@ -133,10 +133,8 @@ function PileupRendering(props) {
|
|
|
133
133
|
}
|
|
134
134
|
function callMouseHandler(handlerName, event) {
|
|
135
135
|
// @ts-expect-error
|
|
136
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
137
136
|
const featureHandler = props[`onFeature${handlerName}`];
|
|
138
137
|
// @ts-expect-error
|
|
139
|
-
// eslint-disable-next-line react/destructuring-assignment
|
|
140
138
|
const canvasHandler = props[`on${handlerName}`];
|
|
141
139
|
if (featureHandler && featureIdUnderMouse) {
|
|
142
140
|
featureHandler(event, featureIdUnderMouse);
|
|
@@ -157,5 +155,5 @@ function PileupRendering(props) {
|
|
|
157
155
|
.join('-')}`, style: { position: 'relative', width: canvasWidth, height } },
|
|
158
156
|
react_1.default.createElement(ui_1.PrerenderedCanvas, { ...props, style: { position: 'absolute', left: 0, top: 0 } }),
|
|
159
157
|
react_1.default.createElement("canvas", { "data-testid": "pileup_overlay_canvas", width: canvasWidth, height: height + canvasPadding, style: { position: 'absolute', left: 0, top: 0 }, className: "highlightOverlayCanvas", ref: highlightOverlayCanvas, onMouseDown: event => onMouseDown(event), onMouseEnter: event => onMouseEnter(event), onMouseOut: event => onMouseOut(event), onMouseOver: event => onMouseOver(event), onMouseUp: event => onMouseUp(event), onMouseLeave: event => onMouseLeave(event), onMouseMove: event => mouseMove(event), onClick: event => onClick(event), onContextMenu: event => onContextMenu(event), onFocus: () => { }, onBlur: () => { } })));
|
|
160
|
-
}
|
|
161
|
-
exports.default =
|
|
158
|
+
});
|
|
159
|
+
exports.default = PileupRendering;
|
|
@@ -39,7 +39,7 @@ function getAlignmentShapeColor({ colorType, tag, feature, config, defaultColor,
|
|
|
39
39
|
}[val] || 'color_nostrand'];
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
return colorTagMap[val] || color_1.fillColor
|
|
42
|
+
return colorTagMap[val] || color_1.fillColor.color_nostrand;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
case 'insertSizeAndPairOrientation':
|
|
@@ -10,8 +10,7 @@ function layoutFeature({ feature, layout, bpPerPx, region, showSoftClip, heightP
|
|
|
10
10
|
const mismatches = feature.get('mismatches');
|
|
11
11
|
const seq = feature.get('seq');
|
|
12
12
|
if (seq) {
|
|
13
|
-
for (
|
|
14
|
-
const { type, start, cliplen = 0 } = mismatches[i];
|
|
13
|
+
for (const { type, start, cliplen = 0 } of mismatches) {
|
|
15
14
|
if (type === 'softclip') {
|
|
16
15
|
start === 0 ? (expansionBefore = cliplen) : (expansionAfter = cliplen);
|
|
17
16
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Feature } from '@jbrowse/core/util';
|
|
2
2
|
import { RenderArgsDeserializedWithFeaturesAndLayout } from './PileupRenderer';
|
|
3
|
-
export
|
|
4
|
-
Color: Awaited<typeof import('color')>;
|
|
5
|
-
}
|
|
3
|
+
export type RenderArgsWithColor = RenderArgsDeserializedWithFeaturesAndLayout;
|
|
6
4
|
interface LayoutFeature {
|
|
7
5
|
heightPx: number;
|
|
8
6
|
topPx: number;
|
|
@@ -4,11 +4,12 @@ exports.renderMethylation = void 0;
|
|
|
4
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
5
|
const MismatchParser_1 = require("../MismatchParser");
|
|
6
6
|
const util_2 = require("./util");
|
|
7
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
7
8
|
// Color by methylation is slightly modified version of color by
|
|
8
9
|
// modifications that focuses on CpG sites, with non-methylated CpG colored
|
|
9
10
|
function renderMethylation({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, }) {
|
|
10
11
|
var _a, _b;
|
|
11
|
-
const { regionSequence
|
|
12
|
+
const { regionSequence } = renderArgs;
|
|
12
13
|
const { feature, topPx, heightPx } = feat;
|
|
13
14
|
if (!regionSequence) {
|
|
14
15
|
throw new Error('region sequence required for methylation');
|
|
@@ -23,15 +24,9 @@ function renderMethylation({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth
|
|
|
23
24
|
function getCol(k) {
|
|
24
25
|
if (methBins[k]) {
|
|
25
26
|
const p = methProbs[k] || 0;
|
|
26
|
-
return p > 0.5
|
|
27
|
-
?
|
|
28
|
-
|
|
29
|
-
.hsl()
|
|
30
|
-
.string()
|
|
31
|
-
: Color('blue')
|
|
32
|
-
.alpha(1 - p * 2)
|
|
33
|
-
.hsl()
|
|
34
|
-
.string();
|
|
27
|
+
return (p > 0.5
|
|
28
|
+
? (0, colord_1.colord)('red').alpha((p - 0.5) * 2)
|
|
29
|
+
: (0, colord_1.colord)('blue').alpha(1 - p * 2)).toHslString();
|
|
35
30
|
}
|
|
36
31
|
return undefined;
|
|
37
32
|
}
|
|
@@ -4,12 +4,8 @@ export declare function renderMismatches({ ctx, feat, renderArgs, minSubfeatureW
|
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
6
6
|
renderArgs: RenderArgsWithColor;
|
|
7
|
-
colorForBase:
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
contrastForBase: {
|
|
11
|
-
[key: string]: string;
|
|
12
|
-
};
|
|
7
|
+
colorForBase: Record<string, string>;
|
|
8
|
+
contrastForBase: Record<string, string>;
|
|
13
9
|
mismatchAlpha?: boolean;
|
|
14
10
|
drawIndels?: boolean;
|
|
15
11
|
drawSNPsMuted?: boolean;
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.renderMismatches = void 0;
|
|
4
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
5
|
const util_2 = require("./util");
|
|
6
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
6
7
|
function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInsertionIndicatorScale, mismatchAlpha, charWidth, charHeight, colorForBase, contrastForBase, canvasWidth, drawSNPsMuted, drawIndels = true, }) {
|
|
7
|
-
const {
|
|
8
|
+
const { bpPerPx, regions } = renderArgs;
|
|
8
9
|
const { heightPx, topPx, feature } = feat;
|
|
9
10
|
const [region] = regions;
|
|
10
11
|
const start = feature.get('start');
|
|
@@ -19,8 +20,7 @@ function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInse
|
|
|
19
20
|
}
|
|
20
21
|
// two pass rendering: first pass, draw all the mismatches except wide
|
|
21
22
|
// insertion markers
|
|
22
|
-
for (
|
|
23
|
-
const mismatch = mismatches[i];
|
|
23
|
+
for (const mismatch of mismatches) {
|
|
24
24
|
const mstart = start + mismatch.start;
|
|
25
25
|
const mlen = mismatch.length;
|
|
26
26
|
const mbase = mismatch.base;
|
|
@@ -32,10 +32,9 @@ function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInse
|
|
|
32
32
|
const c = mismatchAlpha
|
|
33
33
|
? mismatch.qual === undefined
|
|
34
34
|
? baseColor
|
|
35
|
-
:
|
|
35
|
+
: (0, colord_1.colord)(baseColor)
|
|
36
36
|
.alpha(Math.min(1, mismatch.qual / 50))
|
|
37
|
-
.
|
|
38
|
-
.string()
|
|
37
|
+
.toHslString()
|
|
39
38
|
: baseColor;
|
|
40
39
|
(0, util_2.fillRect)(ctx, Math.round(leftPx), topPx, widthPx, heightPx, canvasWidth, c);
|
|
41
40
|
}
|
|
@@ -47,10 +46,9 @@ function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInse
|
|
|
47
46
|
ctx.fillStyle = mismatchAlpha
|
|
48
47
|
? mismatch.qual === undefined
|
|
49
48
|
? contrastColor
|
|
50
|
-
:
|
|
49
|
+
: (0, colord_1.colord)(contrastColor)
|
|
51
50
|
.alpha(Math.min(1, mismatch.qual / 50))
|
|
52
|
-
.
|
|
53
|
-
.string()
|
|
51
|
+
.toHslString()
|
|
54
52
|
: contrastColor;
|
|
55
53
|
ctx.fillText(mbase, leftPx + (widthPx - charWidth) / 2 + 1, topPx + heightPx);
|
|
56
54
|
}
|
|
@@ -105,8 +103,7 @@ function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInse
|
|
|
105
103
|
}
|
|
106
104
|
// second pass, draw wide insertion markers on top
|
|
107
105
|
if (drawIndels) {
|
|
108
|
-
for (
|
|
109
|
-
const mismatch = mismatches[i];
|
|
106
|
+
for (const mismatch of mismatches) {
|
|
110
107
|
const mstart = start + mismatch.start;
|
|
111
108
|
const mlen = mismatch.length;
|
|
112
109
|
const [leftPx] = (0, util_1.bpSpanPx)(mstart, mstart + mlen, region, bpPerPx);
|
|
@@ -5,6 +5,7 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
5
5
|
const MismatchParser_1 = require("../MismatchParser");
|
|
6
6
|
const util_2 = require("../util");
|
|
7
7
|
const util_3 = require("./util");
|
|
8
|
+
const colord_1 = require("@jbrowse/core/util/colord");
|
|
8
9
|
// render modifications stored in MM tag in BAM
|
|
9
10
|
//
|
|
10
11
|
// ML stores probabilities as array of numerics and MP is scaled phred scores
|
|
@@ -17,7 +18,7 @@ const util_3 = require("./util");
|
|
|
17
18
|
// about low qual calls <20 approx
|
|
18
19
|
function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, }) {
|
|
19
20
|
const { feature, topPx, heightPx } = feat;
|
|
20
|
-
const {
|
|
21
|
+
const { modificationTagMap = {} } = renderArgs;
|
|
21
22
|
const seq = feature.get('seq');
|
|
22
23
|
if (!seq) {
|
|
23
24
|
return;
|
|
@@ -33,17 +34,12 @@ function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWid
|
|
|
33
34
|
let probIndex = 0;
|
|
34
35
|
for (const { type, positions } of modifications) {
|
|
35
36
|
const col = modificationTagMap[type] || 'black';
|
|
36
|
-
const base =
|
|
37
|
+
const base = (0, colord_1.colord)(col);
|
|
37
38
|
for (const readPos of (0, MismatchParser_1.getNextRefPos)(cigarOps, positions)) {
|
|
38
39
|
const r = start + readPos;
|
|
39
40
|
const [leftPx, rightPx] = (0, util_1.bpSpanPx)(r, r + 1, region, bpPerPx);
|
|
40
41
|
const prob = (probabilities === null || probabilities === void 0 ? void 0 : probabilities[probIndex]) || 0;
|
|
41
|
-
const c = prob !== 1
|
|
42
|
-
? base
|
|
43
|
-
.alpha(prob + 0.1)
|
|
44
|
-
.hsl()
|
|
45
|
-
.string()
|
|
46
|
-
: col;
|
|
42
|
+
const c = prob !== 1 ? base.alpha(prob + 0.1).toHslString() : col;
|
|
47
43
|
const w = rightPx - leftPx + 0.5;
|
|
48
44
|
(0, util_3.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
49
45
|
probIndex++;
|
|
@@ -16,32 +16,33 @@ function renderSoftClipping({ ctx, feat, renderArgs, config, theme, colorForBase
|
|
|
16
16
|
if (!(seq && mismatches)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
const heightLim = charHeight - 2;
|
|
20
|
+
for (const mismatch of mismatches) {
|
|
21
|
+
if (mismatch.type === 'softclip') {
|
|
22
|
+
const len = mismatch.cliplen || 0;
|
|
23
|
+
const s = feature.get('start');
|
|
24
|
+
const start = mismatch.start === 0 ? s - len : s + mismatch.start;
|
|
25
|
+
for (let k = 0; k < len; k += 1) {
|
|
26
|
+
const base = seq.charAt(k + mismatch.start);
|
|
27
|
+
// If softclip length+start is longer than sequence, no need to
|
|
28
|
+
// continue showing base
|
|
29
|
+
if (!base) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const s0 = start + k;
|
|
33
|
+
const [leftPx, rightPx] = (0, util_1.bpSpanPx)(s0, s0 + 1, region, bpPerPx);
|
|
34
|
+
const widthPx = Math.max(minFeatWidth, rightPx - leftPx);
|
|
35
|
+
// Black accounts for IUPAC ambiguity code bases such as N that
|
|
36
|
+
// show in soft clipping
|
|
37
|
+
const baseColor = colorForBase[base] || '#000000';
|
|
38
|
+
ctx.fillStyle = baseColor;
|
|
39
|
+
(0, util_2.fillRect)(ctx, leftPx, topPx, widthPx, heightPx, canvasWidth);
|
|
40
|
+
if (widthPx >= charWidth && heightPx >= heightLim) {
|
|
41
|
+
ctx.fillStyle = theme.palette.getContrastText(baseColor);
|
|
42
|
+
ctx.fillText(base, leftPx + (widthPx - charWidth) / 2 + 1, topPx + heightPx);
|
|
43
|
+
}
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
}
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
exports.renderSoftClipping = renderSoftClipping;
|
|
@@ -59,8 +59,8 @@ const sortFeature = (features, sortedBy) => {
|
|
|
59
59
|
featuresInCenterLine.sort((a, b) => {
|
|
60
60
|
const aMismatch = baseMap.get(a.id());
|
|
61
61
|
const bMismatch = baseMap.get(b.id());
|
|
62
|
-
const acode = bMismatch
|
|
63
|
-
const bcode = aMismatch
|
|
62
|
+
const acode = bMismatch === null || bMismatch === void 0 ? void 0 : bMismatch.base.toUpperCase();
|
|
63
|
+
const bcode = aMismatch === null || aMismatch === void 0 ? void 0 : aMismatch.base.toUpperCase();
|
|
64
64
|
if (acode === bcode && acode === '*') {
|
|
65
65
|
// @ts-expect-error
|
|
66
66
|
return aMismatch.length - bMismatch.length;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
}
|
|
1
|
+
export type SkipMap = Record<string, {
|
|
2
|
+
score: number;
|
|
3
|
+
feature: unknown;
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
strand: number;
|
|
7
|
+
xs: string;
|
|
8
|
+
}>;
|
|
11
9
|
export interface BinType {
|
|
12
10
|
total?: number;
|
|
13
|
-
strands?:
|
|
14
|
-
[key: string]: number;
|
|
15
|
-
};
|
|
11
|
+
strands?: Record<string, number>;
|
|
16
12
|
}
|
|
17
13
|
export interface Bin {
|
|
18
14
|
refbase?: string;
|
|
@@ -61,8 +61,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
61
61
|
// Use two pass rendering, which helps in visualizing the SNPs at higher
|
|
62
62
|
// bpPerPx First pass: draw the gray background
|
|
63
63
|
ctx.fillStyle = colorForBase.total;
|
|
64
|
-
for (
|
|
65
|
-
const feature = coverage[i];
|
|
64
|
+
for (const feature of coverage) {
|
|
66
65
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
67
66
|
const w = rightPx - leftPx + fudgeFactor;
|
|
68
67
|
const score = feature.get('score');
|
|
@@ -80,8 +79,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
80
79
|
// Second pass: draw the SNP data, and add a minimum feature width of 1px
|
|
81
80
|
// which can be wider than the actual bpPerPx This reduces overdrawing of
|
|
82
81
|
// the grey background over the SNPs
|
|
83
|
-
for (
|
|
84
|
-
const feature = coverage[i];
|
|
82
|
+
for (const feature of coverage) {
|
|
85
83
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
86
84
|
const score = feature.get('score');
|
|
87
85
|
const snpinfo = feature.get('snpinfo');
|
|
@@ -89,8 +87,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
89
87
|
const totalScore = snpinfo.total;
|
|
90
88
|
const keys = Object.keys(snpinfo.cov).sort();
|
|
91
89
|
let curr = 0;
|
|
92
|
-
for (
|
|
93
|
-
const base = keys[i];
|
|
90
|
+
for (const base of keys) {
|
|
94
91
|
const { total } = snpinfo.cov[base];
|
|
95
92
|
ctx.fillStyle =
|
|
96
93
|
colorForBase[base] ||
|
|
@@ -105,8 +102,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
105
102
|
const indicatorHeight = 4.5;
|
|
106
103
|
if (drawInterbaseCounts) {
|
|
107
104
|
let curr = 0;
|
|
108
|
-
for (
|
|
109
|
-
const base = interbaseEvents[i];
|
|
105
|
+
for (const base of interbaseEvents) {
|
|
110
106
|
const { total } = snpinfo.noncov[base];
|
|
111
107
|
const r = 0.6;
|
|
112
108
|
ctx.fillStyle = colorForBase[base];
|
|
@@ -118,8 +114,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
118
114
|
let accum = 0;
|
|
119
115
|
let max = 0;
|
|
120
116
|
let maxBase = '';
|
|
121
|
-
for (
|
|
122
|
-
const base = interbaseEvents[i];
|
|
117
|
+
for (const base of interbaseEvents) {
|
|
123
118
|
const { total } = snpinfo.noncov[base];
|
|
124
119
|
accum += total;
|
|
125
120
|
if (total > max) {
|
|
@@ -144,8 +139,7 @@ class SNPCoverageRenderer extends plugin_wiggle_1.WiggleBaseRenderer {
|
|
|
144
139
|
prevTotal = totalScore;
|
|
145
140
|
}
|
|
146
141
|
if (drawArcs) {
|
|
147
|
-
for (
|
|
148
|
-
const f = skips[i];
|
|
142
|
+
for (const f of skips) {
|
|
149
143
|
const [left, right] = (0, util_1.bpSpanPx)(f.get('start'), f.get('end'), region, bpPerPx);
|
|
150
144
|
ctx.beginPath();
|
|
151
145
|
const str = f.get('strand');
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export default class AlignmentsPlugin extends Plugin {
|
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
|
6
6
|
}
|
|
7
|
-
export { linearPileupDisplayStateModelFactory, linearPileupDisplayConfigSchemaFactory, } from './LinearPileupDisplay';
|
|
7
|
+
export { linearPileupDisplayStateModelFactory, linearPileupDisplayConfigSchemaFactory, SharedLinearPileupDisplayMixin, } from './LinearPileupDisplay';
|
|
8
8
|
export { type LinearPileupDisplayModel } from './LinearPileupDisplay/model';
|
|
9
9
|
export * as MismatchParser from './MismatchParser';
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.MismatchParser = exports.linearPileupDisplayConfigSchemaFactory = exports.linearPileupDisplayStateModelFactory = void 0;
|
|
29
|
+
exports.MismatchParser = exports.SharedLinearPileupDisplayMixin = exports.linearPileupDisplayConfigSchemaFactory = exports.linearPileupDisplayStateModelFactory = void 0;
|
|
30
30
|
const Plugin_1 = __importDefault(require("@jbrowse/core/Plugin"));
|
|
31
31
|
const CramAdapter_1 = __importDefault(require("./CramAdapter"));
|
|
32
32
|
const BamAdapter_1 = __importDefault(require("./BamAdapter"));
|
|
@@ -73,4 +73,5 @@ exports.default = AlignmentsPlugin;
|
|
|
73
73
|
var LinearPileupDisplay_2 = require("./LinearPileupDisplay");
|
|
74
74
|
Object.defineProperty(exports, "linearPileupDisplayStateModelFactory", { enumerable: true, get: function () { return LinearPileupDisplay_2.linearPileupDisplayStateModelFactory; } });
|
|
75
75
|
Object.defineProperty(exports, "linearPileupDisplayConfigSchemaFactory", { enumerable: true, get: function () { return LinearPileupDisplay_2.linearPileupDisplayConfigSchemaFactory; } });
|
|
76
|
+
Object.defineProperty(exports, "SharedLinearPileupDisplayMixin", { enumerable: true, get: function () { return LinearPileupDisplay_2.SharedLinearPileupDisplayMixin; } });
|
|
76
77
|
exports.MismatchParser = __importStar(require("./MismatchParser"));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearReadCloudDisplayModel } from '../LinearReadCloudDisplay/model';
|
|
3
3
|
import { LinearReadArcsDisplayModel } from '../LinearReadArcsDisplay/model';
|
|
4
|
-
declare const
|
|
4
|
+
declare const BaseDisplayComponent: ({ model, children, }: {
|
|
5
5
|
model: LinearReadArcsDisplayModel | LinearReadCloudDisplayModel;
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
}) => React.JSX.Element | null;
|
|
8
|
-
export default
|
|
8
|
+
export default BaseDisplayComponent;
|
|
@@ -25,7 +25,7 @@ const useStyles = (0, mui_1.makeStyles)()(theme => {
|
|
|
25
25
|
},
|
|
26
26
|
};
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
const BaseDisplayComponent = (0, mobx_react_1.observer)(function ({ model, children, }) {
|
|
29
29
|
const { error, regionTooLarge } = model;
|
|
30
30
|
return error ? (react_1.default.createElement(plugin_linear_genome_view_1.BlockMsg, { message: `${error}`, severity: "error", buttonText: "Reload", action: model.reload })) : regionTooLarge ? (model.regionCannotBeRendered()) : (react_1.default.createElement(DataDisplay, { model: model }, children));
|
|
31
31
|
});
|
|
@@ -46,3 +46,4 @@ const LoadingBar = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
|
46
46
|
return (react_1.default.createElement("div", { className: classes.loading },
|
|
47
47
|
react_1.default.createElement(ui_1.LoadingEllipses, { message: message })));
|
|
48
48
|
});
|
|
49
|
+
exports.default = BaseDisplayComponent;
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
flagInclude: number;
|
|
5
|
-
readName?: string;
|
|
6
|
-
tagFilter?: {
|
|
7
|
-
tag: string;
|
|
8
|
-
value: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
declare function FilterByTagDlg(props: {
|
|
2
|
+
import { IFilter } from '.';
|
|
3
|
+
declare const FilterByTagDialog: (props: {
|
|
12
4
|
model: {
|
|
13
|
-
filterBy:
|
|
14
|
-
setFilterBy: (arg:
|
|
5
|
+
filterBy: IFilter;
|
|
6
|
+
setFilterBy: (arg: IFilter) => void;
|
|
15
7
|
};
|
|
16
8
|
handleClose: () => void;
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
export default _default;
|
|
9
|
+
}) => React.JSX.Element;
|
|
10
|
+
export default FilterByTagDialog;
|