@jbrowse/plugin-alignments 2.16.1 → 2.17.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.js +1 -2
- package/dist/AlignmentsFeatureDetail/getSAFeatures.js +2 -2
- package/dist/AlignmentsFeatureDetail/stateModelFactory.d.ts +1 -1
- package/dist/BamAdapter/BamAdapter.d.ts +3 -2
- package/dist/BamAdapter/BamAdapter.js +34 -11
- package/dist/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -17
- package/dist/BamAdapter/BamSlightlyLazyFeature.js +42 -72
- package/dist/CramAdapter/CramAdapter.d.ts +4 -3
- package/dist/CramAdapter/CramAdapter.js +24 -7
- package/dist/CramAdapter/CramSlightlyLazyFeature.d.ts +21 -27
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +74 -73
- package/dist/CramAdapter/util.d.ts +1 -10
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +1 -1
- package/dist/LinearAlignmentsDisplay/index.js +2 -2
- package/dist/LinearAlignmentsDisplay/{models/model.d.ts → model.d.ts} +6 -3
- package/dist/LinearAlignmentsDisplay/{models/model.js → model.js} +11 -7
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +6 -27
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +43 -21
- package/dist/LinearPileupDisplay/components/ColorByTagDialog.d.ts +5 -4
- package/dist/LinearPileupDisplay/components/ColorByTagDialog.js +3 -1
- package/dist/LinearPileupDisplay/components/GroupByDialog.js +8 -6
- package/dist/LinearPileupDisplay/components/SortByTagDialog.js +6 -4
- package/dist/LinearPileupDisplay/model.d.ts +40 -40
- package/dist/LinearPileupDisplay/model.js +118 -41
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +22 -21
- package/dist/LinearReadArcsDisplay/model.js +13 -14
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +1 -1
- package/dist/LinearReadCloudDisplay/model.d.ts +14 -22
- package/dist/LinearReadCloudDisplay/model.js +12 -13
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +49 -19
- package/dist/LinearSNPCoverageDisplay/index.js +3 -2
- package/dist/LinearSNPCoverageDisplay/{models/model.d.ts → model.d.ts} +3 -13
- package/dist/LinearSNPCoverageDisplay/{models/model.js → model.js} +71 -45
- package/dist/MismatchParser/cigarToMismatches.d.ts +3 -0
- package/dist/MismatchParser/cigarToMismatches.js +94 -0
- package/dist/MismatchParser/getNextRefPos.d.ts +4 -0
- package/dist/MismatchParser/getNextRefPos.js +40 -0
- package/dist/MismatchParser/index.d.ts +4 -29
- package/dist/MismatchParser/index.js +10 -327
- package/dist/MismatchParser/mdToMismatches.d.ts +3 -0
- package/dist/MismatchParser/mdToMismatches.js +80 -0
- package/dist/ModificationParser/index.d.ts +19 -0
- package/dist/ModificationParser/index.js +144 -0
- package/dist/PileupRPC/methods/GetGlobalValueForTag.js +1 -2
- package/dist/PileupRPC/methods/GetReducedFeatures.d.ts +1 -1
- package/dist/PileupRPC/methods/GetReducedFeatures.js +19 -16
- package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +2 -1
- package/dist/PileupRPC/methods/GetVisibleModifications.js +9 -6
- package/dist/PileupRenderer/PileupLayoutSession.d.ts +8 -7
- package/dist/PileupRenderer/PileupRenderer.d.ts +6 -14
- package/dist/PileupRenderer/PileupRenderer.js +7 -5
- package/dist/PileupRenderer/renderAlignment.js +17 -4
- package/dist/PileupRenderer/renderAlignmentShape.js +102 -21
- package/dist/PileupRenderer/renderMethylation.d.ts +2 -1
- package/dist/PileupRenderer/renderMethylation.js +17 -9
- package/dist/PileupRenderer/renderMismatches.js +19 -19
- package/dist/PileupRenderer/renderModifications.d.ts +3 -2
- package/dist/PileupRenderer/renderModifications.js +31 -34
- package/dist/PileupRenderer/renderPerBaseLettering.d.ts +2 -1
- package/dist/PileupRenderer/renderPerBaseLettering.js +1 -3
- package/dist/PileupRenderer/renderPerBaseQuality.d.ts +2 -1
- package/dist/PileupRenderer/renderPerBaseQuality.js +1 -3
- package/dist/PileupRenderer/renderSoftClipping.js +6 -6
- package/dist/PileupRenderer/sortUtil.d.ts +2 -7
- package/dist/PileupRenderer/sortUtil.js +13 -13
- package/dist/SNPCoverageAdapter/SNPCoverageAdapter.js +10 -5
- package/dist/SNPCoverageAdapter/generateCoverageBins.d.ts +13 -9
- package/dist/SNPCoverageAdapter/generateCoverageBins.js +269 -166
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -1
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +171 -54
- package/dist/shared/color.d.ts +0 -10
- package/dist/shared/color.js +1 -7
- package/{esm/shared → dist/shared/components}/BaseDisplayComponent.d.ts +2 -2
- package/{esm/shared → dist/shared/components}/FilterByTagDialog.d.ts +3 -3
- package/dist/shared/{FilterByTagDialog.js → components/FilterByTagDialog.js} +5 -1
- package/dist/shared/fetchChains.js +1 -2
- package/dist/shared/getMaximumModificationAtEachPosition.d.ts +8 -0
- package/dist/shared/getMaximumModificationAtEachPosition.js +42 -0
- package/dist/shared/getUniqueModifications.d.ts +14 -0
- package/dist/shared/getUniqueModifications.js +16 -0
- package/dist/shared/getUniqueTags.d.ts +15 -0
- package/dist/shared/getUniqueTags.js +18 -0
- package/dist/shared/types.d.ts +94 -0
- package/dist/shared/util.d.ts +8 -0
- package/dist/shared/util.js +26 -0
- package/dist/util.d.ts +6 -3
- package/dist/util.js +24 -29
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +1 -2
- package/esm/AlignmentsFeatureDetail/getSAFeatures.js +2 -2
- package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +1 -1
- package/esm/BamAdapter/BamAdapter.d.ts +3 -2
- package/esm/BamAdapter/BamAdapter.js +31 -8
- package/esm/BamAdapter/BamSlightlyLazyFeature.d.ts +3 -17
- package/esm/BamAdapter/BamSlightlyLazyFeature.js +43 -73
- package/esm/CramAdapter/CramAdapter.d.ts +4 -3
- package/esm/CramAdapter/CramAdapter.js +22 -5
- package/esm/CramAdapter/CramSlightlyLazyFeature.d.ts +21 -27
- package/esm/CramAdapter/CramSlightlyLazyFeature.js +74 -73
- package/esm/CramAdapter/util.d.ts +1 -10
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +1 -1
- package/esm/LinearAlignmentsDisplay/index.js +2 -2
- package/esm/LinearAlignmentsDisplay/{models/model.d.ts → model.d.ts} +6 -3
- package/esm/LinearAlignmentsDisplay/{models/model.js → model.js} +11 -7
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +6 -27
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +45 -23
- package/esm/LinearPileupDisplay/components/ColorByTagDialog.d.ts +5 -4
- package/esm/LinearPileupDisplay/components/ColorByTagDialog.js +3 -1
- package/esm/LinearPileupDisplay/components/GroupByDialog.js +8 -6
- package/esm/LinearPileupDisplay/components/SortByTagDialog.js +6 -4
- package/esm/LinearPileupDisplay/model.d.ts +40 -40
- package/esm/LinearPileupDisplay/model.js +119 -42
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +22 -21
- package/esm/LinearReadArcsDisplay/model.js +14 -15
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +1 -1
- package/esm/LinearReadCloudDisplay/model.d.ts +14 -22
- package/esm/LinearReadCloudDisplay/model.js +13 -14
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +49 -19
- package/esm/LinearSNPCoverageDisplay/index.js +3 -2
- package/esm/LinearSNPCoverageDisplay/{models/model.d.ts → model.d.ts} +3 -13
- package/esm/LinearSNPCoverageDisplay/{models/model.js → model.js} +72 -46
- package/esm/MismatchParser/cigarToMismatches.d.ts +3 -0
- package/esm/MismatchParser/cigarToMismatches.js +91 -0
- package/esm/MismatchParser/getNextRefPos.d.ts +4 -0
- package/esm/MismatchParser/getNextRefPos.js +37 -0
- package/esm/MismatchParser/index.d.ts +4 -29
- package/esm/MismatchParser/index.js +5 -317
- package/esm/MismatchParser/mdToMismatches.d.ts +3 -0
- package/esm/MismatchParser/mdToMismatches.js +77 -0
- package/esm/ModificationParser/index.d.ts +19 -0
- package/esm/ModificationParser/index.js +138 -0
- package/esm/PileupRPC/methods/GetGlobalValueForTag.js +1 -2
- package/esm/PileupRPC/methods/GetReducedFeatures.d.ts +1 -1
- package/esm/PileupRPC/methods/GetReducedFeatures.js +19 -16
- package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +2 -1
- package/esm/PileupRPC/methods/GetVisibleModifications.js +9 -6
- package/esm/PileupRenderer/PileupLayoutSession.d.ts +8 -7
- package/esm/PileupRenderer/PileupRenderer.d.ts +6 -14
- package/esm/PileupRenderer/PileupRenderer.js +8 -6
- package/esm/PileupRenderer/renderAlignment.js +17 -4
- package/esm/PileupRenderer/renderAlignmentShape.js +102 -21
- package/esm/PileupRenderer/renderMethylation.d.ts +2 -1
- package/esm/PileupRenderer/renderMethylation.js +17 -9
- package/esm/PileupRenderer/renderMismatches.js +19 -19
- package/esm/PileupRenderer/renderModifications.d.ts +3 -2
- package/esm/PileupRenderer/renderModifications.js +30 -33
- package/esm/PileupRenderer/renderPerBaseLettering.d.ts +2 -1
- package/esm/PileupRenderer/renderPerBaseLettering.js +1 -3
- package/esm/PileupRenderer/renderPerBaseQuality.d.ts +2 -1
- package/esm/PileupRenderer/renderPerBaseQuality.js +1 -3
- package/esm/PileupRenderer/renderSoftClipping.js +6 -6
- package/esm/PileupRenderer/sortUtil.d.ts +2 -7
- package/esm/PileupRenderer/sortUtil.js +13 -13
- package/esm/SNPCoverageAdapter/SNPCoverageAdapter.js +10 -5
- package/esm/SNPCoverageAdapter/generateCoverageBins.d.ts +13 -9
- package/esm/SNPCoverageAdapter/generateCoverageBins.js +269 -166
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -1
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +171 -54
- package/esm/shared/color.d.ts +0 -10
- package/esm/shared/color.js +0 -6
- package/{dist/shared → esm/shared/components}/BaseDisplayComponent.d.ts +2 -2
- package/{dist/shared → esm/shared/components}/FilterByTagDialog.d.ts +3 -3
- package/esm/shared/{FilterByTagDialog.js → components/FilterByTagDialog.js} +5 -1
- package/esm/shared/fetchChains.js +1 -2
- package/esm/shared/getMaximumModificationAtEachPosition.d.ts +8 -0
- package/esm/shared/getMaximumModificationAtEachPosition.js +39 -0
- package/esm/shared/getUniqueModifications.d.ts +14 -0
- package/esm/shared/getUniqueModifications.js +13 -0
- package/esm/shared/getUniqueTags.d.ts +15 -0
- package/esm/shared/getUniqueTags.js +15 -0
- package/esm/shared/types.d.ts +94 -0
- package/esm/shared/util.d.ts +8 -0
- package/esm/shared/util.js +23 -0
- package/esm/util.d.ts +6 -3
- package/esm/util.js +22 -26
- package/package.json +4 -4
- package/dist/LinearPileupDisplay/components/ColorByModificationsDialog.d.ts +0 -15
- package/dist/LinearPileupDisplay/components/ColorByModificationsDialog.js +0 -41
- package/dist/LinearPileupDisplay/components/ModificationsTable.d.ts +0 -4
- package/dist/LinearPileupDisplay/components/ModificationsTable.js +0 -28
- package/dist/SNPCoverageAdapter/util.d.ts +0 -25
- package/dist/shared/index.d.ts +0 -49
- package/dist/shared/index.js +0 -41
- package/esm/LinearPileupDisplay/components/ColorByModificationsDialog.d.ts +0 -15
- package/esm/LinearPileupDisplay/components/ColorByModificationsDialog.js +0 -36
- package/esm/LinearPileupDisplay/components/ModificationsTable.d.ts +0 -4
- package/esm/LinearPileupDisplay/components/ModificationsTable.js +0 -22
- package/esm/SNPCoverageAdapter/util.d.ts +0 -25
- package/esm/shared/index.d.ts +0 -49
- package/esm/shared/index.js +0 -36
- /package/dist/LinearAlignmentsDisplay/{models/alignmentsModel.d.ts → alignmentsModel.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/alignmentsModel.js → alignmentsModel.js} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/util.d.ts → util.d.ts} +0 -0
- /package/dist/LinearAlignmentsDisplay/{models/util.js → util.js} +0 -0
- /package/dist/LinearSNPCoverageDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/LinearSNPCoverageDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/dist/shared/{BaseDisplayComponent.js → components/BaseDisplayComponent.js} +0 -0
- /package/dist/shared/{renderSvg.d.ts → renderSvgUtil.d.ts} +0 -0
- /package/dist/shared/{renderSvg.js → renderSvgUtil.js} +0 -0
- /package/dist/{SNPCoverageAdapter/util.js → shared/types.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/alignmentsModel.d.ts → alignmentsModel.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/alignmentsModel.js → alignmentsModel.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/util.d.ts → util.d.ts} +0 -0
- /package/esm/LinearAlignmentsDisplay/{models/util.js → util.js} +0 -0
- /package/esm/LinearSNPCoverageDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/LinearSNPCoverageDisplay/{models/configSchema.js → configSchema.js} +0 -0
- /package/esm/shared/{BaseDisplayComponent.js → components/BaseDisplayComponent.js} +0 -0
- /package/esm/shared/{renderSvg.d.ts → renderSvgUtil.d.ts} +0 -0
- /package/esm/shared/{renderSvg.js → renderSvgUtil.js} +0 -0
- /package/esm/{SNPCoverageAdapter/util.js → shared/types.js} +0 -0
|
@@ -2,47 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderModifications = renderModifications;
|
|
4
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
|
-
|
|
6
|
-
const util_2 = require("
|
|
7
|
-
const util_3 = require("
|
|
8
|
-
const
|
|
5
|
+
// locals
|
|
6
|
+
const util_2 = require("./util");
|
|
7
|
+
const util_3 = require("../shared/util");
|
|
8
|
+
const getMaximumModificationAtEachPosition_1 = require("../shared/getMaximumModificationAtEachPosition");
|
|
9
9
|
// render modifications stored in MM tag in BAM
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// https://github.com/samtools/hts-specs/pull/418/files#diff-e765c6479316309f56b636f88189cdde8c40b854c7bdcce9ee7fe87a4e76febcR596
|
|
13
|
-
//
|
|
14
|
-
// if we have ML or Ml, it is an 8bit probability, divide by 255
|
|
15
|
-
//
|
|
16
|
-
// if we have MP or Mp it is phred scaled ASCII, which can go up to 90 but
|
|
17
|
-
// has very high likelihood basecalls at that point, we really only care
|
|
18
|
-
// about low qual calls <20 approx
|
|
19
|
-
function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, }) {
|
|
10
|
+
function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, cigarOps, }) {
|
|
11
|
+
var _a, _b, _c;
|
|
20
12
|
const { feature, topPx, heightPx } = feat;
|
|
21
|
-
const {
|
|
13
|
+
const { colorBy, visibleModifications = {} } = renderArgs;
|
|
22
14
|
const seq = feature.get('seq');
|
|
23
15
|
if (!seq) {
|
|
24
16
|
return;
|
|
25
17
|
}
|
|
26
|
-
const mm = (0, util_2.getTagAlt)(feature, 'MM', 'Mm') || '';
|
|
27
|
-
const cigar = feature.get('CIGAR');
|
|
28
18
|
const start = feature.get('start');
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
19
|
+
const isolatedModification = (_a = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _a === void 0 ? void 0 : _a.isolatedModification;
|
|
20
|
+
const twoColor = (_b = colorBy === null || colorBy === void 0 ? void 0 : colorBy.modifications) === null || _b === void 0 ? void 0 : _b.twoColor;
|
|
21
|
+
(_c = (0, getMaximumModificationAtEachPosition_1.getMaxProbModAtEachPosition)(feature, cigarOps)) === null || _c === void 0 ? void 0 : _c.forEach(({ allProbs, prob, type }, pos) => {
|
|
22
|
+
const r = start + pos;
|
|
23
|
+
const [leftPx, rightPx] = (0, util_1.bpSpanPx)(r, r + 1, region, bpPerPx);
|
|
24
|
+
const mod = visibleModifications[type];
|
|
25
|
+
if (!mod) {
|
|
26
|
+
console.warn(`${type} not known yet`);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (isolatedModification && mod.type !== isolatedModification) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const col = mod.color || 'black';
|
|
33
|
+
const s = 1 - (0, util_1.sum)(allProbs);
|
|
34
|
+
if (twoColor && s > (0, util_1.max)(allProbs)) {
|
|
35
|
+
const c = (0, util_3.alphaColor)('blue', s);
|
|
43
36
|
const w = rightPx - leftPx + 0.5;
|
|
44
|
-
(0,
|
|
45
|
-
probIndex++;
|
|
37
|
+
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
46
38
|
}
|
|
47
|
-
|
|
39
|
+
else {
|
|
40
|
+
const c = (0, util_3.alphaColor)(col, prob);
|
|
41
|
+
const w = rightPx - leftPx + 0.5;
|
|
42
|
+
(0, util_2.fillRect)(ctx, leftPx, topPx, w, heightPx, canvasWidth, c);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
48
45
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Region } from '@jbrowse/core/util';
|
|
2
2
|
import { LayoutFeature } from './util';
|
|
3
|
-
export declare function renderPerBaseLettering({ ctx, feat, region, bpPerPx, colorForBase, contrastForBase, charWidth, charHeight, canvasWidth, }: {
|
|
3
|
+
export declare function renderPerBaseLettering({ ctx, feat, region, bpPerPx, colorForBase, contrastForBase, charWidth, charHeight, canvasWidth, cigarOps, }: {
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
6
6
|
region: Region;
|
|
@@ -10,4 +10,5 @@ export declare function renderPerBaseLettering({ ctx, feat, region, bpPerPx, col
|
|
|
10
10
|
charWidth: number;
|
|
11
11
|
charHeight: number;
|
|
12
12
|
canvasWidth: number;
|
|
13
|
+
cigarOps: string[];
|
|
13
14
|
}): void;
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderPerBaseLettering = renderPerBaseLettering;
|
|
4
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
|
-
const MismatchParser_1 = require("../MismatchParser");
|
|
6
5
|
const util_2 = require("./util");
|
|
7
|
-
function renderPerBaseLettering({ ctx, feat, region, bpPerPx, colorForBase, contrastForBase, charWidth, charHeight, canvasWidth, }) {
|
|
6
|
+
function renderPerBaseLettering({ ctx, feat, region, bpPerPx, colorForBase, contrastForBase, charWidth, charHeight, canvasWidth, cigarOps, }) {
|
|
8
7
|
const heightLim = charHeight - 2;
|
|
9
8
|
const { feature, topPx, heightPx } = feat;
|
|
10
9
|
const seq = feature.get('seq');
|
|
11
|
-
const cigarOps = (0, MismatchParser_1.parseCigar)(feature.get('CIGAR'));
|
|
12
10
|
const w = 1 / bpPerPx;
|
|
13
11
|
const start = feature.get('start');
|
|
14
12
|
let soffset = 0;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Region } from '@jbrowse/core/util';
|
|
2
2
|
import { LayoutFeature } from './util';
|
|
3
|
-
export declare function renderPerBaseQuality({ ctx, feat, region, bpPerPx, canvasWidth, }: {
|
|
3
|
+
export declare function renderPerBaseQuality({ ctx, feat, region, bpPerPx, canvasWidth, cigarOps, }: {
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
6
6
|
region: Region;
|
|
7
7
|
bpPerPx: number;
|
|
8
8
|
canvasWidth: number;
|
|
9
|
+
cigarOps: string[];
|
|
9
10
|
}): void;
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderPerBaseQuality = renderPerBaseQuality;
|
|
4
4
|
const util_1 = require("@jbrowse/core/util");
|
|
5
|
-
const MismatchParser_1 = require("../MismatchParser");
|
|
6
5
|
const util_2 = require("./util");
|
|
7
|
-
function renderPerBaseQuality({ ctx, feat, region, bpPerPx, canvasWidth, }) {
|
|
6
|
+
function renderPerBaseQuality({ ctx, feat, region, bpPerPx, canvasWidth, cigarOps, }) {
|
|
8
7
|
const { feature, topPx, heightPx } = feat;
|
|
9
8
|
const qual = feature.get('qual') || '';
|
|
10
9
|
const scores = qual.split(' ').map(val => +val);
|
|
11
|
-
const cigarOps = (0, MismatchParser_1.parseCigar)(feature.get('CIGAR'));
|
|
12
10
|
const w = 1 / bpPerPx;
|
|
13
11
|
const start = feature.get('start');
|
|
14
12
|
let soffset = 0; // sequence offset
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.renderSoftClipping = renderSoftClipping;
|
|
4
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
-
// locals
|
|
7
|
-
const MismatchParser_1 = require("../MismatchParser");
|
|
8
6
|
const util_2 = require("./util");
|
|
7
|
+
const MismatchParser_1 = require("../MismatchParser");
|
|
9
8
|
function renderSoftClipping({ ctx, feat, renderArgs, config, theme, colorForBase, canvasWidth, }) {
|
|
10
9
|
const { feature, topPx, heightPx } = feat;
|
|
11
10
|
const { regions, bpPerPx } = renderArgs;
|
|
@@ -19,12 +18,13 @@ function renderSoftClipping({ ctx, feat, renderArgs, config, theme, colorForBase
|
|
|
19
18
|
return;
|
|
20
19
|
}
|
|
21
20
|
const heightLim = charHeight - 2;
|
|
22
|
-
const CIGAR = (0, MismatchParser_1.parseCigar)(feature.get('CIGAR'));
|
|
23
21
|
let seqOffset = 0;
|
|
24
22
|
let refOffset = 0;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const CIGAR = feature.get('CIGAR');
|
|
24
|
+
const cigarOps = (0, MismatchParser_1.parseCigar)(CIGAR);
|
|
25
|
+
for (let i = 0; i < cigarOps.length; i += 2) {
|
|
26
|
+
const op = cigarOps[i + 1];
|
|
27
|
+
const len = +cigarOps[i];
|
|
28
28
|
if (op === 'S') {
|
|
29
29
|
for (let k = 0; k < len; k++) {
|
|
30
30
|
const base = seq[seqOffset + k];
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { Feature } from '@jbrowse/core/util';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type: string;
|
|
5
|
-
tag?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const sortFeature: (features: Map<string, Feature>, sortedBy: SortObject) => Map<string, Feature>;
|
|
8
|
-
export {};
|
|
2
|
+
import { SortedBy } from '../shared/types';
|
|
3
|
+
export declare const sortFeature: (features: Map<string, Feature>, sortedBy: SortedBy) => Map<string, Feature>;
|
|
@@ -43,29 +43,29 @@ const sortFeature = (features, sortedBy) => {
|
|
|
43
43
|
// first sort all mismatches, then all reference bases at the end
|
|
44
44
|
case 'Base pair': {
|
|
45
45
|
const baseSortArray = [];
|
|
46
|
-
|
|
46
|
+
for (const feature of featuresInCenterLine) {
|
|
47
47
|
const mismatches = feature.get('mismatches');
|
|
48
|
-
|
|
48
|
+
for (const m of mismatches) {
|
|
49
49
|
const start = feature.get('start');
|
|
50
|
-
const offset = start +
|
|
51
|
-
const consuming =
|
|
52
|
-
const len = consuming ? 0 :
|
|
50
|
+
const offset = start + m.start + 1;
|
|
51
|
+
const consuming = m.type === 'insertion' || m.type === 'softclip';
|
|
52
|
+
const len = consuming ? 0 : m.length;
|
|
53
53
|
if (pos >= offset && pos < offset + len) {
|
|
54
|
-
baseSortArray.push([feature.id(),
|
|
54
|
+
baseSortArray.push([feature.id(), m]);
|
|
55
55
|
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
58
|
const baseMap = new Map(baseSortArray);
|
|
59
59
|
featuresInCenterLine.sort((a, b) => {
|
|
60
60
|
const aMismatch = baseMap.get(a.id());
|
|
61
61
|
const bMismatch = baseMap.get(b.id());
|
|
62
62
|
const acode = bMismatch === null || bMismatch === void 0 ? void 0 : bMismatch.base.toUpperCase();
|
|
63
63
|
const bcode = aMismatch === null || aMismatch === void 0 ? void 0 : aMismatch.base.toUpperCase();
|
|
64
|
-
|
|
65
|
-
// @ts-expect-error
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
return acode === bcode && acode === '*'
|
|
65
|
+
? // @ts-expect-error
|
|
66
|
+
aMismatch.length - bMismatch.length
|
|
67
|
+
: (acode ? acode.charCodeAt(0) : 0) -
|
|
68
|
+
(bcode ? bcode.charCodeAt(0) : 0);
|
|
69
69
|
});
|
|
70
70
|
break;
|
|
71
71
|
}
|
|
@@ -9,8 +9,8 @@ const rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
|
9
9
|
const operators_1 = require("rxjs/operators");
|
|
10
10
|
const rxjs_2 = require("rxjs");
|
|
11
11
|
// locals
|
|
12
|
-
const generateCoverageBins_1 = __importDefault(require("./generateCoverageBins"));
|
|
13
12
|
const util_1 = require("../util");
|
|
13
|
+
const generateCoverageBins_1 = require("./generateCoverageBins");
|
|
14
14
|
class SNPCoverageAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
15
15
|
async configure() {
|
|
16
16
|
var _a, _b;
|
|
@@ -38,14 +38,19 @@ class SNPCoverageAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
38
38
|
getFeatures(region, opts = {}) {
|
|
39
39
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
40
40
|
const { subadapter } = await this.configure();
|
|
41
|
-
const
|
|
42
|
-
const { bins, skipmap } = await (0, generateCoverageBins_1.
|
|
41
|
+
const features = await (0, rxjs_2.firstValueFrom)(subadapter.getFeatures(region, opts).pipe((0, operators_1.toArray)()));
|
|
42
|
+
const { bins, skipmap } = await (0, generateCoverageBins_1.generateCoverageBins)({
|
|
43
|
+
features,
|
|
44
|
+
region,
|
|
45
|
+
opts,
|
|
46
|
+
fetchSequence: (region) => this.fetchSequence(region),
|
|
47
|
+
});
|
|
43
48
|
bins.forEach((bin, index) => {
|
|
44
49
|
const start = region.start + index;
|
|
45
50
|
observer.next(new simpleFeature_1.default({
|
|
46
51
|
id: `${this.id}-${start}`,
|
|
47
52
|
data: {
|
|
48
|
-
score: bin.
|
|
53
|
+
score: bin.depth,
|
|
49
54
|
snpinfo: bin,
|
|
50
55
|
start,
|
|
51
56
|
end: start + 1,
|
|
@@ -63,7 +68,7 @@ class SNPCoverageAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
63
68
|
end: skip.end,
|
|
64
69
|
strand: skip.strand,
|
|
65
70
|
score: skip.score,
|
|
66
|
-
|
|
71
|
+
effectiveStrand: skip.effectiveStrand,
|
|
67
72
|
},
|
|
68
73
|
}));
|
|
69
74
|
});
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { AugmentedRegion as Region } from '@jbrowse/core/util/types';
|
|
2
|
-
import { Feature } from '@jbrowse/core/util
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { Feature } from '@jbrowse/core/util';
|
|
3
|
+
import { ColorBy, PreBaseCoverageBin, SkipMap } from '../shared/types';
|
|
4
|
+
interface Opts {
|
|
5
5
|
bpPerPx?: number;
|
|
6
|
-
colorBy?:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
colorBy?: ColorBy;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateCoverageBins({ fetchSequence, features, region, opts, }: {
|
|
9
|
+
features: Feature[];
|
|
10
|
+
region: Region;
|
|
11
|
+
opts: Opts;
|
|
12
|
+
fetchSequence: (arg: Region) => Promise<string>;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
bins: PreBaseCoverageBin[];
|
|
12
15
|
skipmap: SkipMap;
|
|
13
16
|
}>;
|
|
17
|
+
export {};
|