@jbrowse/plugin-alignments 3.6.5 → 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/AlignmentsFeatureDetail/stateModelFactory.d.ts +4 -4
- package/dist/CramAdapter/CramAdapter.js +1 -1
- package/dist/CramAdapter/CramSlightlyLazyFeature.js +8 -7
- package/dist/CramAdapter/{util.js → readFeaturesToCIGAR.js} +4 -5
- package/dist/CramAdapter/readFeaturesToMismatches.d.ts +5 -0
- package/dist/CramAdapter/readFeaturesToMismatches.js +106 -0
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +6 -2
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +17 -2
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +2 -2
- package/dist/LinearPileupDisplay/components/GroupByDialog.js +4 -4
- package/dist/LinearPileupDisplay/components/SetModificationThresholdDialog.d.ts +10 -0
- package/dist/LinearPileupDisplay/components/SetModificationThresholdDialog.js +39 -0
- package/dist/LinearPileupDisplay/doAfterAttach.d.ts +1 -0
- package/dist/LinearPileupDisplay/doAfterAttach.js +3 -2
- package/dist/LinearPileupDisplay/model.d.ts +20 -2
- package/dist/LinearPileupDisplay/model.js +39 -4
- package/dist/LinearReadArcsDisplay/index.js +1 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +23 -30
- package/dist/LinearReadArcsDisplay/model.js +5 -86
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +84 -2
- package/dist/LinearReadCloudDisplay/components/SetFeatureHeightDialog.d.ts +10 -0
- package/dist/LinearReadCloudDisplay/components/SetFeatureHeightDialog.js +26 -0
- package/dist/LinearReadCloudDisplay/configSchema.d.ts +7 -0
- package/dist/LinearReadCloudDisplay/configSchema.js +5 -0
- package/dist/LinearReadCloudDisplay/drawFeatsAbstract.js +13 -0
- package/dist/LinearReadCloudDisplay/drawFeatsCloud.js +24 -0
- package/dist/LinearReadCloudDisplay/drawFeatsCommon.d.ts +23 -0
- package/dist/LinearReadCloudDisplay/drawFeatsCommon.js +198 -0
- package/dist/LinearReadCloudDisplay/drawFeatsStack.d.ts +2 -0
- package/dist/LinearReadCloudDisplay/drawFeatsStack.js +36 -0
- package/dist/LinearReadCloudDisplay/index.js +1 -1
- package/dist/LinearReadCloudDisplay/model.d.ts +51 -31
- package/dist/LinearReadCloudDisplay/model.js +93 -78
- package/dist/LinearSNPCoverageDisplay/components/TooltipContents.d.ts +3 -0
- package/dist/LinearSNPCoverageDisplay/components/TooltipContents.js +148 -19
- package/dist/LinearSNPCoverageDisplay/model.js +14 -3
- package/dist/MismatchParser/cigarToMismatches.js +1 -0
- package/dist/ModificationParser/detectSimplexModifications.d.ts +4 -0
- package/dist/ModificationParser/detectSimplexModifications.js +20 -0
- package/dist/ModificationParser/getModPositions.d.ts +1 -1
- package/dist/ModificationParser/getModPositions.js +13 -16
- package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +4 -1
- package/dist/PileupRPC/methods/GetVisibleModifications.js +16 -3
- package/dist/PileupRenderer/PileupRenderer.d.ts +6 -1
- package/dist/PileupRenderer/PileupRenderer.js +11 -14
- package/dist/PileupRenderer/components/PileupRendering.d.ts +8 -15
- package/dist/PileupRenderer/components/PileupRendering.js +18 -2
- package/dist/PileupRenderer/makeImageData.d.ts +5 -2
- package/dist/PileupRenderer/makeImageData.js +37 -6
- package/dist/PileupRenderer/{getAlignmentShapeColor.js → renderers/getAlignmentShapeColor.js} +2 -2
- package/{esm/PileupRenderer → dist/PileupRenderer/renderers}/renderAlignment.d.ts +6 -3
- package/dist/PileupRenderer/{renderAlignment.js → renderers/renderAlignment.js} +12 -3
- package/{esm/PileupRenderer → dist/PileupRenderer/renderers}/renderAlignmentShape.d.ts +2 -2
- package/dist/PileupRenderer/{renderAlignmentShape.js → renderers/renderAlignmentShape.js} +1 -1
- package/dist/PileupRenderer/{renderMethylation.d.ts → renderers/renderMethylation.d.ts} +2 -2
- package/dist/PileupRenderer/{renderMethylation.js → renderers/renderMethylation.js} +2 -2
- package/dist/PileupRenderer/{renderMismatches.d.ts → renderers/renderMismatches.d.ts} +6 -3
- package/dist/PileupRenderer/{renderMismatches.js → renderers/renderMismatches.js} +29 -5
- package/dist/PileupRenderer/{renderModifications.d.ts → renderers/renderModifications.d.ts} +6 -3
- package/dist/PileupRenderer/renderers/renderModifications.js +84 -0
- package/dist/PileupRenderer/{renderPerBaseLettering.d.ts → renderers/renderPerBaseLettering.d.ts} +1 -1
- package/dist/PileupRenderer/{renderPerBaseLettering.js → renderers/renderPerBaseLettering.js} +1 -1
- package/{esm/PileupRenderer → dist/PileupRenderer/renderers}/renderPerBaseQuality.d.ts +1 -1
- package/dist/PileupRenderer/{renderPerBaseQuality.js → renderers/renderPerBaseQuality.js} +1 -1
- package/dist/PileupRenderer/{renderSoftClipping.d.ts → renderers/renderSoftClipping.d.ts} +2 -2
- package/dist/PileupRenderer/{renderSoftClipping.js → renderers/renderSoftClipping.js} +2 -2
- package/dist/PileupRenderer/types.d.ts +6 -0
- package/dist/SNPCoverageAdapter/generateCoverageBins.js +5 -4
- package/dist/SNPCoverageAdapter/processModifications.js +14 -4
- package/dist/SNPCoverageRenderer/makeImage.js +44 -33
- package/dist/SNPCoverageRenderer/types.d.ts +1 -0
- package/dist/shared/LinearReadDisplayBaseMixin.d.ts +24 -0
- package/dist/shared/LinearReadDisplayBaseMixin.js +50 -0
- package/dist/shared/LinearReadDisplayWithLayoutMixin.d.ts +11 -0
- package/dist/shared/LinearReadDisplayWithLayoutMixin.js +24 -0
- package/dist/shared/LinearReadDisplayWithPairFiltersMixin.d.ts +11 -0
- package/dist/shared/LinearReadDisplayWithPairFiltersMixin.js +27 -0
- package/dist/shared/afterAttach.js +3 -2
- package/dist/shared/chainToSimpleFeature.d.ts +3 -0
- package/dist/shared/chainToSimpleFeature.js +43 -0
- package/dist/shared/chevron.d.ts +1 -0
- package/dist/shared/chevron.js +27 -0
- package/dist/shared/color.d.ts +43 -6
- package/dist/shared/color.js +101 -22
- package/dist/shared/components/BaseDisplayComponent.d.ts +12 -3
- package/dist/shared/components/BaseDisplayComponent.js +2 -2
- package/dist/shared/components/SetFeatureHeightDialog.d.ts +10 -0
- package/dist/shared/components/SetFeatureHeightDialog.js +26 -0
- package/dist/shared/components/SetMaxHeightDialog.d.ts +8 -0
- package/dist/shared/components/SetMaxHeightDialog.js +28 -0
- package/dist/shared/drawLongReadChains.d.ts +24 -0
- package/dist/shared/drawLongReadChains.js +104 -0
- package/dist/shared/drawPairChains.d.ts +24 -0
- package/dist/shared/drawPairChains.js +94 -0
- package/dist/shared/flatbushType.d.ts +12 -0
- package/dist/shared/flatbushType.js +2 -0
- package/dist/shared/getUniqueModifications.d.ts +4 -1
- package/dist/shared/menuItems.d.ts +23 -0
- package/dist/shared/menuItems.js +89 -0
- package/dist/shared/modificationData.d.ts +6 -0
- package/dist/shared/modificationData.js +22 -0
- package/dist/shared/primaryStrand.d.ts +3 -0
- package/dist/shared/primaryStrand.js +24 -0
- package/dist/shared/types.d.ts +2 -0
- package/dist/shared/util.d.ts +2 -0
- package/dist/shared/util.js +6 -1
- package/dist/util.d.ts +1 -6
- package/dist/util.js +4 -15
- package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +4 -4
- package/esm/CramAdapter/CramAdapter.js +1 -1
- package/esm/CramAdapter/CramSlightlyLazyFeature.js +2 -1
- package/esm/CramAdapter/{util.js → readFeaturesToCIGAR.js} +4 -5
- package/esm/CramAdapter/readFeaturesToMismatches.d.ts +5 -0
- package/esm/CramAdapter/readFeaturesToMismatches.js +103 -0
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +6 -2
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +17 -2
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +2 -2
- package/esm/LinearPileupDisplay/components/GroupByDialog.js +4 -4
- package/esm/LinearPileupDisplay/components/SetModificationThresholdDialog.d.ts +10 -0
- package/esm/LinearPileupDisplay/components/SetModificationThresholdDialog.js +37 -0
- package/esm/LinearPileupDisplay/doAfterAttach.d.ts +1 -0
- package/esm/LinearPileupDisplay/doAfterAttach.js +3 -2
- package/esm/LinearPileupDisplay/model.d.ts +20 -2
- package/esm/LinearPileupDisplay/model.js +39 -4
- package/esm/LinearReadArcsDisplay/index.js +1 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +23 -30
- package/esm/LinearReadArcsDisplay/model.js +5 -83
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +86 -4
- package/esm/LinearReadCloudDisplay/components/SetFeatureHeightDialog.d.ts +10 -0
- package/esm/LinearReadCloudDisplay/components/SetFeatureHeightDialog.js +24 -0
- package/esm/LinearReadCloudDisplay/configSchema.d.ts +7 -0
- package/esm/LinearReadCloudDisplay/configSchema.js +5 -0
- package/esm/LinearReadCloudDisplay/drawFeatsAbstract.d.ts +2 -0
- package/esm/LinearReadCloudDisplay/drawFeatsAbstract.js +10 -0
- package/esm/LinearReadCloudDisplay/drawFeatsCloud.d.ts +2 -0
- package/esm/LinearReadCloudDisplay/drawFeatsCloud.js +21 -0
- package/esm/LinearReadCloudDisplay/drawFeatsCommon.d.ts +23 -0
- package/esm/LinearReadCloudDisplay/drawFeatsCommon.js +187 -0
- package/esm/LinearReadCloudDisplay/drawFeatsStack.d.ts +2 -0
- package/esm/LinearReadCloudDisplay/drawFeatsStack.js +30 -0
- package/esm/LinearReadCloudDisplay/index.js +1 -1
- package/esm/LinearReadCloudDisplay/model.d.ts +51 -31
- package/esm/LinearReadCloudDisplay/model.js +94 -76
- package/esm/LinearSNPCoverageDisplay/components/TooltipContents.d.ts +3 -0
- package/esm/LinearSNPCoverageDisplay/components/TooltipContents.js +149 -20
- package/esm/LinearSNPCoverageDisplay/model.js +14 -3
- package/esm/MismatchParser/cigarToMismatches.js +1 -0
- package/esm/ModificationParser/detectSimplexModifications.d.ts +4 -0
- package/esm/ModificationParser/detectSimplexModifications.js +17 -0
- package/esm/ModificationParser/getModPositions.d.ts +1 -1
- package/esm/ModificationParser/getModPositions.js +13 -16
- package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +4 -1
- package/esm/PileupRPC/methods/GetVisibleModifications.js +16 -3
- package/esm/PileupRenderer/PileupRenderer.d.ts +6 -1
- package/esm/PileupRenderer/PileupRenderer.js +11 -14
- package/esm/PileupRenderer/components/PileupRendering.d.ts +8 -15
- package/esm/PileupRenderer/components/PileupRendering.js +16 -3
- package/esm/PileupRenderer/makeImageData.d.ts +5 -2
- package/esm/PileupRenderer/makeImageData.js +34 -6
- package/esm/PileupRenderer/{getAlignmentShapeColor.js → renderers/getAlignmentShapeColor.js} +2 -2
- package/{dist/PileupRenderer → esm/PileupRenderer/renderers}/renderAlignment.d.ts +6 -3
- package/esm/PileupRenderer/{renderAlignment.js → renderers/renderAlignment.js} +12 -3
- package/{dist/PileupRenderer → esm/PileupRenderer/renderers}/renderAlignmentShape.d.ts +2 -2
- package/esm/PileupRenderer/{renderAlignmentShape.js → renderers/renderAlignmentShape.js} +1 -1
- package/esm/PileupRenderer/{renderMethylation.d.ts → renderers/renderMethylation.d.ts} +2 -2
- package/esm/PileupRenderer/{renderMethylation.js → renderers/renderMethylation.js} +2 -2
- package/esm/PileupRenderer/{renderMismatches.d.ts → renderers/renderMismatches.d.ts} +6 -3
- package/esm/PileupRenderer/{renderMismatches.js → renderers/renderMismatches.js} +29 -5
- package/esm/PileupRenderer/{renderModifications.d.ts → renderers/renderModifications.d.ts} +6 -3
- package/esm/PileupRenderer/renderers/renderModifications.js +81 -0
- package/esm/PileupRenderer/{renderPerBaseLettering.d.ts → renderers/renderPerBaseLettering.d.ts} +1 -1
- package/esm/PileupRenderer/{renderPerBaseLettering.js → renderers/renderPerBaseLettering.js} +1 -1
- package/{dist/PileupRenderer → esm/PileupRenderer/renderers}/renderPerBaseQuality.d.ts +1 -1
- package/esm/PileupRenderer/{renderPerBaseQuality.js → renderers/renderPerBaseQuality.js} +1 -1
- package/esm/PileupRenderer/{renderSoftClipping.d.ts → renderers/renderSoftClipping.d.ts} +2 -2
- package/esm/PileupRenderer/{renderSoftClipping.js → renderers/renderSoftClipping.js} +2 -2
- package/esm/PileupRenderer/types.d.ts +6 -0
- package/esm/SNPCoverageAdapter/generateCoverageBins.js +5 -4
- package/esm/SNPCoverageAdapter/processModifications.js +14 -4
- package/esm/SNPCoverageRenderer/makeImage.js +44 -33
- package/esm/SNPCoverageRenderer/types.d.ts +1 -0
- package/esm/shared/LinearReadDisplayBaseMixin.d.ts +24 -0
- package/esm/shared/LinearReadDisplayBaseMixin.js +47 -0
- package/esm/shared/LinearReadDisplayWithLayoutMixin.d.ts +11 -0
- package/esm/shared/LinearReadDisplayWithLayoutMixin.js +21 -0
- package/esm/shared/LinearReadDisplayWithPairFiltersMixin.d.ts +11 -0
- package/esm/shared/LinearReadDisplayWithPairFiltersMixin.js +24 -0
- package/esm/shared/afterAttach.js +3 -2
- package/esm/shared/chainToSimpleFeature.d.ts +3 -0
- package/esm/shared/chainToSimpleFeature.js +40 -0
- package/esm/shared/chevron.d.ts +1 -0
- package/esm/shared/chevron.js +24 -0
- package/esm/shared/color.d.ts +43 -6
- package/esm/shared/color.js +96 -20
- package/esm/shared/components/BaseDisplayComponent.d.ts +12 -3
- package/esm/shared/components/BaseDisplayComponent.js +2 -2
- package/esm/shared/components/SetFeatureHeightDialog.d.ts +10 -0
- package/esm/shared/components/SetFeatureHeightDialog.js +24 -0
- package/esm/shared/components/SetMaxHeightDialog.d.ts +8 -0
- package/esm/shared/components/SetMaxHeightDialog.js +26 -0
- package/esm/shared/drawLongReadChains.d.ts +24 -0
- package/esm/shared/drawLongReadChains.js +101 -0
- package/esm/shared/drawPairChains.d.ts +24 -0
- package/esm/shared/drawPairChains.js +91 -0
- package/esm/shared/flatbushType.d.ts +12 -0
- package/esm/shared/flatbushType.js +1 -0
- package/esm/shared/getUniqueModifications.d.ts +4 -1
- package/esm/shared/menuItems.d.ts +23 -0
- package/esm/shared/menuItems.js +49 -0
- package/esm/shared/modificationData.d.ts +6 -0
- package/esm/shared/modificationData.js +18 -0
- package/esm/shared/primaryStrand.d.ts +3 -0
- package/esm/shared/primaryStrand.js +20 -0
- package/esm/shared/types.d.ts +2 -0
- package/esm/shared/util.d.ts +2 -0
- package/esm/shared/util.js +4 -0
- package/esm/util.d.ts +1 -6
- package/esm/util.js +2 -14
- package/package.json +6 -6
- package/dist/LinearReadCloudDisplay/drawFeats.js +0 -27
- package/dist/LinearReadCloudDisplay/drawLongReadChains.d.ts +0 -11
- package/dist/LinearReadCloudDisplay/drawLongReadChains.js +0 -64
- package/dist/LinearReadCloudDisplay/drawPairChains.d.ts +0 -17
- package/dist/LinearReadCloudDisplay/drawPairChains.js +0 -94
- package/dist/PileupRenderer/renderModifications.js +0 -44
- package/esm/LinearReadCloudDisplay/drawFeats.js +0 -24
- package/esm/LinearReadCloudDisplay/drawLongReadChains.d.ts +0 -11
- package/esm/LinearReadCloudDisplay/drawLongReadChains.js +0 -61
- package/esm/LinearReadCloudDisplay/drawPairChains.d.ts +0 -17
- package/esm/LinearReadCloudDisplay/drawPairChains.js +0 -90
- package/esm/PileupRenderer/renderModifications.js +0 -41
- /package/dist/CramAdapter/{util.d.ts → readFeaturesToCIGAR.d.ts} +0 -0
- /package/dist/LinearReadCloudDisplay/{drawFeats.d.ts → drawFeatsAbstract.d.ts} +0 -0
- /package/{esm/LinearReadCloudDisplay/drawFeats.d.ts → dist/LinearReadCloudDisplay/drawFeatsCloud.d.ts} +0 -0
- /package/dist/PileupRenderer/{getAlignmentShapeColor.d.ts → renderers/getAlignmentShapeColor.d.ts} +0 -0
- /package/dist/{LinearReadCloudDisplay/util.d.ts → shared/canvasUtils.d.ts} +0 -0
- /package/dist/{LinearReadCloudDisplay/util.js → shared/canvasUtils.js} +0 -0
- /package/esm/CramAdapter/{util.d.ts → readFeaturesToCIGAR.d.ts} +0 -0
- /package/esm/PileupRenderer/{getAlignmentShapeColor.d.ts → renderers/getAlignmentShapeColor.d.ts} +0 -0
- /package/esm/{LinearReadCloudDisplay/util.d.ts → shared/canvasUtils.d.ts} +0 -0
- /package/esm/{LinearReadCloudDisplay/util.js → shared/canvasUtils.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function detectSimplexModifications(modifications) {
|
|
2
|
+
const minusStrandMods = new Set();
|
|
3
|
+
const simplexModifications = new Set();
|
|
4
|
+
for (const modification of modifications) {
|
|
5
|
+
const mod = modification;
|
|
6
|
+
if (mod.strand === '-') {
|
|
7
|
+
minusStrandMods.add(mod.type);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
for (const modification of modifications) {
|
|
11
|
+
const mod = modification;
|
|
12
|
+
if (mod.strand === '+' && !minusStrandMods.has(mod.type)) {
|
|
13
|
+
simplexModifications.add(mod.type);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return simplexModifications;
|
|
17
|
+
}
|
|
@@ -2,6 +2,7 @@ import { revcom } from '@jbrowse/core/util';
|
|
|
2
2
|
import { modificationRegex } from './consts';
|
|
3
3
|
export function getModPositions(mm, fseq, fstrand) {
|
|
4
4
|
const seq = fstrand === -1 ? revcom(fseq) : fseq;
|
|
5
|
+
const seqLength = seq.length;
|
|
5
6
|
const mods = mm.split(';');
|
|
6
7
|
const result = [];
|
|
7
8
|
for (const mod of mods) {
|
|
@@ -16,44 +17,40 @@ export function getModPositions(mm, fseq, fstrand) {
|
|
|
16
17
|
}
|
|
17
18
|
const [, base, strand, typestr] = matches;
|
|
18
19
|
const types = typestr.split(/(\d+|.)/);
|
|
19
|
-
if (strand === '-') {
|
|
20
|
-
console.warn('unsupported negative strand modifications');
|
|
21
|
-
result.push({
|
|
22
|
-
type: 'unsupported',
|
|
23
|
-
positions: [],
|
|
24
|
-
base: base,
|
|
25
|
-
strand: strand,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
20
|
for (const type of types) {
|
|
29
21
|
if (type === '') {
|
|
30
22
|
continue;
|
|
31
23
|
}
|
|
24
|
+
const splitLength = split.length;
|
|
32
25
|
let currPos = 0;
|
|
33
|
-
const positions = [];
|
|
34
|
-
|
|
26
|
+
const positions = fstrand === -1 ? new Array(splitLength - 1) : [];
|
|
27
|
+
let writeIndex = fstrand === -1 ? splitLength - 2 : 0;
|
|
28
|
+
for (let i = 1; i < splitLength; i++) {
|
|
35
29
|
let delta = +split[i];
|
|
36
30
|
do {
|
|
37
31
|
if (base === 'N' || base === seq[currPos]) {
|
|
38
32
|
delta--;
|
|
39
33
|
}
|
|
40
34
|
currPos++;
|
|
41
|
-
} while (delta >= 0 && currPos <
|
|
35
|
+
} while (delta >= 0 && currPos < seqLength);
|
|
42
36
|
if (fstrand === -1) {
|
|
43
|
-
const pos =
|
|
37
|
+
const pos = seqLength - currPos;
|
|
44
38
|
if (pos >= 0) {
|
|
45
|
-
positions
|
|
39
|
+
positions[writeIndex--] = pos;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
else {
|
|
49
|
-
positions
|
|
45
|
+
positions[writeIndex++] = currPos - 1;
|
|
50
46
|
}
|
|
51
47
|
}
|
|
48
|
+
const validPositions = fstrand === -1 ? positions.slice(writeIndex + 1) : positions;
|
|
52
49
|
result.push({
|
|
53
50
|
type,
|
|
54
51
|
base: base,
|
|
55
52
|
strand: strand,
|
|
56
|
-
positions,
|
|
53
|
+
positions: validPositions,
|
|
57
54
|
});
|
|
58
55
|
}
|
|
59
56
|
}
|
|
@@ -10,5 +10,8 @@ export default class PileupGetVisibleModifications extends PileupBaseRPC {
|
|
|
10
10
|
regions: Region[];
|
|
11
11
|
sessionId: string;
|
|
12
12
|
tag: string;
|
|
13
|
-
}, rpcDriver: string): Promise<
|
|
13
|
+
}, rpcDriver: string): Promise<{
|
|
14
|
+
modifications: ModificationType[];
|
|
15
|
+
simplexModifications: string[];
|
|
16
|
+
}>;
|
|
14
17
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
2
|
import { firstValueFrom } from 'rxjs';
|
|
3
3
|
import { toArray } from 'rxjs/operators';
|
|
4
|
+
import { detectSimplexModifications } from '../../ModificationParser/detectSimplexModifications';
|
|
4
5
|
import { getModTypes } from '../../ModificationParser/getModTypes';
|
|
5
6
|
import { getTagAlt } from '../../util';
|
|
6
7
|
import PileupBaseRPC from '../base';
|
|
@@ -20,11 +21,23 @@ export default class PileupGetVisibleModifications extends PileupBaseRPC {
|
|
|
20
21
|
for (const feat of featuresArray) {
|
|
21
22
|
const mmTag = getTagAlt(feat, 'MM', 'Mm');
|
|
22
23
|
for (const mod of getModTypes(typeof mmTag === 'string' ? mmTag : '')) {
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
const key = `${mod.base}${mod.strand}${mod.type}`;
|
|
25
|
+
if (!uniqueModifications.has(key)) {
|
|
26
|
+
uniqueModifications.set(key, mod);
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
const modifications = [...uniqueModifications.values()];
|
|
31
|
+
const simplexModifications = detectSimplexModifications(modifications);
|
|
32
|
+
const modificationsForDisplay = new Map();
|
|
33
|
+
for (const mod of modifications) {
|
|
34
|
+
if (!modificationsForDisplay.has(mod.type)) {
|
|
35
|
+
modificationsForDisplay.set(mod.type, mod);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
modifications: [...modificationsForDisplay.values()],
|
|
40
|
+
simplexModifications: [...simplexModifications],
|
|
41
|
+
};
|
|
29
42
|
}
|
|
30
43
|
}
|
|
@@ -20,6 +20,8 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
20
20
|
width: number;
|
|
21
21
|
maxHeightReached: boolean;
|
|
22
22
|
containsNoTransferables: boolean;
|
|
23
|
+
flatbush: ArrayBufferLike;
|
|
24
|
+
items: import("./types").FlatbushItem[];
|
|
23
25
|
canvasRecordedData: Record<string, unknown>;
|
|
24
26
|
reactElement?: React.ReactElement;
|
|
25
27
|
html?: string;
|
|
@@ -30,6 +32,8 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
30
32
|
width: number;
|
|
31
33
|
maxHeightReached: boolean;
|
|
32
34
|
containsNoTransferables: boolean;
|
|
35
|
+
flatbush: ArrayBufferLike;
|
|
36
|
+
items: import("./types").FlatbushItem[];
|
|
33
37
|
imageData: any;
|
|
34
38
|
reactElement?: React.ReactElement;
|
|
35
39
|
html?: string;
|
|
@@ -40,9 +44,10 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
40
44
|
width: number;
|
|
41
45
|
maxHeightReached: boolean;
|
|
42
46
|
containsNoTransferables: boolean;
|
|
47
|
+
flatbush: ArrayBufferLike;
|
|
48
|
+
items: import("./types").FlatbushItem[];
|
|
43
49
|
reactElement: React.ReactElement;
|
|
44
50
|
html?: string;
|
|
45
51
|
}>;
|
|
46
52
|
createLayoutSession(args: PileupLayoutSessionProps): PileupLayoutSession;
|
|
47
53
|
}
|
|
48
|
-
export type { RenderArgs, RenderArgsSerialized, RenderResults, ResultsDeserialized, ResultsSerialized, } from '@jbrowse/core/pluggableElementTypes/renderers/BoxRendererType';
|
|
@@ -50,20 +50,17 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
50
50
|
? await this.fetchSequence(renderProps, region)
|
|
51
51
|
: undefined;
|
|
52
52
|
const { makeImageData } = await import('./makeImageData');
|
|
53
|
-
return renderToAbstractCanvas(width, height, renderProps, ctx => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
return undefined;
|
|
66
|
-
});
|
|
53
|
+
return renderToAbstractCanvas(width, height, renderProps, ctx => makeImageData({
|
|
54
|
+
ctx,
|
|
55
|
+
layoutRecords,
|
|
56
|
+
canvasWidth: width,
|
|
57
|
+
renderArgs: {
|
|
58
|
+
...renderProps,
|
|
59
|
+
layout,
|
|
60
|
+
features,
|
|
61
|
+
regionSequence,
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
67
64
|
});
|
|
68
65
|
const results = await super.render({
|
|
69
66
|
...renderProps,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ColorBy, FilterBy, SortedBy } from '../../shared/types';
|
|
2
|
+
import type { FlatbushItem } from '../types';
|
|
1
3
|
import type { Region } from '@jbrowse/core/util/types';
|
|
2
4
|
import type { BaseLinearDisplayModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
5
|
declare const PileupRendering: (props: {
|
|
@@ -7,20 +9,11 @@ declare const PileupRendering: (props: {
|
|
|
7
9
|
height: number;
|
|
8
10
|
regions: Region[];
|
|
9
11
|
bpPerPx: number;
|
|
10
|
-
sortedBy?:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
type: string;
|
|
17
|
-
tag?: string;
|
|
18
|
-
};
|
|
19
|
-
filterBy?: {
|
|
20
|
-
tagFilter?: {
|
|
21
|
-
tag: string;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
onMouseMove?: (event: React.MouseEvent, featureId?: string) => void;
|
|
12
|
+
sortedBy?: SortedBy;
|
|
13
|
+
colorBy?: ColorBy;
|
|
14
|
+
filterBy?: FilterBy;
|
|
15
|
+
items: FlatbushItem[];
|
|
16
|
+
flatbush: any;
|
|
17
|
+
onMouseMove?: (event: React.MouseEvent, featureId?: string, extra?: string) => void;
|
|
25
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
26
19
|
export default PileupRendering;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import { PrerenderedCanvas } from '@jbrowse/core/ui';
|
|
4
4
|
import { bpSpanPx } from '@jbrowse/core/util';
|
|
5
|
+
import Flatbush from '@jbrowse/core/util/flatbush';
|
|
5
6
|
import { observer } from 'mobx-react';
|
|
6
7
|
const PileupRendering = observer(function (props) {
|
|
7
8
|
var _a;
|
|
8
|
-
const { onMouseMove, blockKey, displayModel, width, height, regions, bpPerPx, sortedBy, colorBy, filterBy, } = props;
|
|
9
|
+
const { onMouseMove, blockKey, displayModel, width, height, regions, bpPerPx, sortedBy, colorBy, filterBy, flatbush, items, } = props;
|
|
10
|
+
const flatbush2 = useMemo(() => Flatbush.from(flatbush), [flatbush]);
|
|
9
11
|
const { selectedFeatureId, featureIdUnderMouse, contextMenuFeature } = displayModel || {};
|
|
10
12
|
const [firstRender, setFirstRender] = useState(false);
|
|
11
13
|
useEffect(() => {
|
|
@@ -79,7 +81,18 @@ const PileupRendering = observer(function (props) {
|
|
|
79
81
|
const offsetY = event.clientY - rect.top;
|
|
80
82
|
const px = region.reversed ? width - offsetX : offsetX;
|
|
81
83
|
const clientBp = region.start + bpPerPx * px;
|
|
82
|
-
|
|
84
|
+
const search = flatbush2.search(offsetX, offsetY, offsetX + 1, offsetY + 1);
|
|
85
|
+
const item = search.length ? items[search[0]] : undefined;
|
|
86
|
+
const label = item
|
|
87
|
+
? item.type === 'insertion'
|
|
88
|
+
? `Insertion: ${item.seq}`
|
|
89
|
+
: item.type === 'deletion'
|
|
90
|
+
? `Deletion: ${item.seq}bp`
|
|
91
|
+
: item.type === 'modification'
|
|
92
|
+
? item.seq
|
|
93
|
+
: `Mismatch: ${item.seq}`
|
|
94
|
+
: undefined;
|
|
95
|
+
onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(event, displayModel === null || displayModel === void 0 ? void 0 : displayModel.getFeatureOverlapping(blockKey, clientBp, offsetY), label);
|
|
83
96
|
}
|
|
84
97
|
function callMouseHandler(handlerName, event) {
|
|
85
98
|
const featureHandler = props[`onFeature${handlerName}`];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from './types';
|
|
1
|
+
import type { FlatbushItem, ProcessedRenderArgs } from './types';
|
|
2
2
|
import type { Feature } from '@jbrowse/core/util';
|
|
3
3
|
interface LayoutFeature {
|
|
4
4
|
heightPx: number;
|
|
@@ -10,5 +10,8 @@ export declare function makeImageData({ ctx, layoutRecords, canvasWidth, renderA
|
|
|
10
10
|
canvasWidth: number;
|
|
11
11
|
layoutRecords: LayoutFeature[];
|
|
12
12
|
renderArgs: ProcessedRenderArgs;
|
|
13
|
-
}):
|
|
13
|
+
}): {
|
|
14
|
+
flatbush: ArrayBufferLike;
|
|
15
|
+
items: FlatbushItem[];
|
|
16
|
+
};
|
|
14
17
|
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
2
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
3
|
import { forEachWithStopTokenCheck } from '@jbrowse/core/util';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import Flatbush from '@jbrowse/core/util/flatbush';
|
|
5
|
+
import { renderAlignment } from './renderers/renderAlignment';
|
|
6
|
+
import { renderMismatches } from './renderers/renderMismatches';
|
|
7
|
+
import { renderSoftClipping } from './renderers/renderSoftClipping';
|
|
7
8
|
import { getCharWidthHeight, getColorBaseMap, getContrastBaseMap, shouldDrawIndels, shouldDrawSNPsMuted, } from './util';
|
|
8
9
|
export function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
9
10
|
const { stopToken, config, showSoftClip, colorBy, theme: configTheme, } = renderArgs;
|
|
@@ -19,8 +20,10 @@ export function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, })
|
|
|
19
20
|
const { charWidth, charHeight } = getCharWidthHeight();
|
|
20
21
|
const drawSNPsMuted = shouldDrawSNPsMuted(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
|
|
21
22
|
const drawIndels = shouldDrawIndels();
|
|
23
|
+
const coords = [];
|
|
24
|
+
const items = [];
|
|
22
25
|
forEachWithStopTokenCheck(layoutRecords, stopToken, feat => {
|
|
23
|
-
renderAlignment({
|
|
26
|
+
const alignmentRet = renderAlignment({
|
|
24
27
|
ctx,
|
|
25
28
|
feat,
|
|
26
29
|
renderArgs,
|
|
@@ -31,7 +34,13 @@ export function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, })
|
|
|
31
34
|
charHeight,
|
|
32
35
|
canvasWidth,
|
|
33
36
|
});
|
|
34
|
-
|
|
37
|
+
for (let i = 0, l = alignmentRet.coords.length; i < l; i++) {
|
|
38
|
+
coords.push(alignmentRet.coords[i]);
|
|
39
|
+
}
|
|
40
|
+
for (let i = 0, l = alignmentRet.items.length; i < l; i++) {
|
|
41
|
+
items.push(alignmentRet.items[i]);
|
|
42
|
+
}
|
|
43
|
+
const ret = renderMismatches({
|
|
35
44
|
ctx,
|
|
36
45
|
feat,
|
|
37
46
|
renderArgs,
|
|
@@ -47,6 +56,12 @@ export function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, })
|
|
|
47
56
|
colorContrastMap,
|
|
48
57
|
canvasWidth,
|
|
49
58
|
});
|
|
59
|
+
for (let i = 0, l = ret.coords.length; i < l; i++) {
|
|
60
|
+
coords.push(ret.coords[i]);
|
|
61
|
+
}
|
|
62
|
+
for (let i = 0, l = ret.items.length; i < l; i++) {
|
|
63
|
+
items.push(ret.items[i]);
|
|
64
|
+
}
|
|
50
65
|
if (showSoftClip) {
|
|
51
66
|
renderSoftClipping({
|
|
52
67
|
ctx,
|
|
@@ -59,5 +74,18 @@ export function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, })
|
|
|
59
74
|
});
|
|
60
75
|
}
|
|
61
76
|
});
|
|
62
|
-
|
|
77
|
+
const flatbush = new Flatbush(Math.max(items.length, 1));
|
|
78
|
+
if (coords.length) {
|
|
79
|
+
for (let i = 0; i < coords.length; i += 4) {
|
|
80
|
+
flatbush.add(coords[i], coords[i + 1], coords[i + 2], coords[i + 3]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
flatbush.add(0, 0);
|
|
85
|
+
}
|
|
86
|
+
flatbush.finish();
|
|
87
|
+
return {
|
|
88
|
+
flatbush: flatbush.data,
|
|
89
|
+
items,
|
|
90
|
+
};
|
|
63
91
|
}
|
package/esm/PileupRenderer/{getAlignmentShapeColor.js → renderers/getAlignmentShapeColor.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { fillColor } from '../../shared/color';
|
|
3
|
+
import { colorByInsertSize, colorByMappingQuality, colorByOrientation, colorByStrand, colorByStrandedRnaSeq, } from '../colorBy';
|
|
4
4
|
export function getAlignmentShapeColor({ colorType, tag, feature, config, defaultColor, colorTagMap, }) {
|
|
5
5
|
switch (colorType) {
|
|
6
6
|
case 'insertSize':
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from '
|
|
2
|
-
import type { LayoutFeature } from '
|
|
1
|
+
import type { FlatbushItem, ProcessedRenderArgs } from '../types';
|
|
2
|
+
import type { LayoutFeature } from '../util';
|
|
3
3
|
export declare function renderAlignment({ ctx, feat, renderArgs, colorMap, colorContrastMap, charWidth, charHeight, defaultColor, canvasWidth, }: {
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
@@ -10,4 +10,7 @@ export declare function renderAlignment({ ctx, feat, renderArgs, colorMap, color
|
|
|
10
10
|
charHeight: number;
|
|
11
11
|
defaultColor: boolean;
|
|
12
12
|
canvasWidth: number;
|
|
13
|
-
}):
|
|
13
|
+
}): {
|
|
14
|
+
coords: number[];
|
|
15
|
+
items: FlatbushItem[];
|
|
16
|
+
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { getAlignmentShapeColor } from './getAlignmentShapeColor';
|
|
2
2
|
import { renderAlignmentShape } from './renderAlignmentShape';
|
|
3
|
+
import { renderMethylation } from './renderMethylation';
|
|
3
4
|
import { renderModifications } from './renderModifications';
|
|
4
5
|
import { renderPerBaseLettering } from './renderPerBaseLettering';
|
|
5
6
|
import { renderPerBaseQuality } from './renderPerBaseQuality';
|
|
6
|
-
import { parseCigar } from '
|
|
7
|
-
import { renderMethylation } from './renderMethylation';
|
|
7
|
+
import { parseCigar } from '../../MismatchParser';
|
|
8
8
|
export function renderAlignment({ ctx, feat, renderArgs, colorMap, colorContrastMap, charWidth, charHeight, defaultColor, canvasWidth, }) {
|
|
9
|
+
const items = [];
|
|
10
|
+
const coords = [];
|
|
9
11
|
const { config, bpPerPx, regions, colorBy, colorTagMap = {} } = renderArgs;
|
|
10
12
|
const { tag = '', type: colorType = '' } = colorBy || {};
|
|
11
13
|
const { feature } = feat;
|
|
@@ -50,7 +52,7 @@ export function renderAlignment({ ctx, feat, renderArgs, colorMap, colorContrast
|
|
|
50
52
|
}
|
|
51
53
|
case 'modifications': {
|
|
52
54
|
const cigarOps = parseCigar(feature.get('CIGAR'));
|
|
53
|
-
renderModifications({
|
|
55
|
+
const ret = renderModifications({
|
|
54
56
|
ctx,
|
|
55
57
|
feat,
|
|
56
58
|
region,
|
|
@@ -59,6 +61,12 @@ export function renderAlignment({ ctx, feat, renderArgs, colorMap, colorContrast
|
|
|
59
61
|
canvasWidth,
|
|
60
62
|
cigarOps,
|
|
61
63
|
});
|
|
64
|
+
for (let i = 0, l = ret.coords.length; i < l; i++) {
|
|
65
|
+
coords.push(ret.coords[i]);
|
|
66
|
+
}
|
|
67
|
+
for (let i = 0, l = ret.items.length; i < l; i++) {
|
|
68
|
+
items.push(ret.items[i]);
|
|
69
|
+
}
|
|
62
70
|
break;
|
|
63
71
|
}
|
|
64
72
|
case 'methylation': {
|
|
@@ -75,4 +83,5 @@ export function renderAlignment({ ctx, feat, renderArgs, colorMap, colorContrast
|
|
|
75
83
|
break;
|
|
76
84
|
}
|
|
77
85
|
}
|
|
86
|
+
return { coords, items };
|
|
78
87
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from '
|
|
2
|
-
import type { LayoutFeature } from '
|
|
1
|
+
import type { ProcessedRenderArgs } from '../types';
|
|
2
|
+
import type { LayoutFeature } from '../util';
|
|
3
3
|
export declare function renderAlignmentShape({ ctx, feat, renderArgs, }: {
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { bpSpanPx } from '@jbrowse/core/util';
|
|
2
|
-
import { parseCigar } from '
|
|
2
|
+
import { parseCigar } from '../../MismatchParser';
|
|
3
3
|
export function renderAlignmentShape({ ctx, feat, renderArgs, }) {
|
|
4
4
|
const { regions, bpPerPx } = renderArgs;
|
|
5
5
|
const { heightPx, topPx, feature } = feat;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from '
|
|
2
|
-
import type { LayoutFeature } from '
|
|
1
|
+
import type { ProcessedRenderArgs } from '../types';
|
|
2
|
+
import type { LayoutFeature } from '../util';
|
|
3
3
|
import type { Region } from '@jbrowse/core/util';
|
|
4
4
|
export declare function renderMethylation({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, cigarOps, }: {
|
|
5
5
|
ctx: CanvasRenderingContext2D;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { bpSpanPx } from '@jbrowse/core/util';
|
|
2
2
|
import { colord } from '@jbrowse/core/util/colord';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { getMethBins } from '../../ModificationParser/getMethBins';
|
|
4
|
+
import { fillRect } from '../util';
|
|
5
5
|
export function renderMethylation({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, cigarOps, }) {
|
|
6
6
|
const { regionSequence } = renderArgs;
|
|
7
7
|
const { feature, topPx, heightPx } = feat;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from '
|
|
2
|
-
import type { LayoutFeature } from '
|
|
1
|
+
import type { FlatbushItem, ProcessedRenderArgs } from '../types';
|
|
2
|
+
import type { LayoutFeature } from '../util';
|
|
3
3
|
export declare function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInsertionIndicatorScale, mismatchAlpha, charWidth, charHeight, colorMap, colorContrastMap, hideSmallIndels, canvasWidth, drawSNPsMuted, drawIndels, }: {
|
|
4
4
|
ctx: CanvasRenderingContext2D;
|
|
5
5
|
feat: LayoutFeature;
|
|
@@ -15,4 +15,7 @@ export declare function renderMismatches({ ctx, feat, renderArgs, minSubfeatureW
|
|
|
15
15
|
charWidth: number;
|
|
16
16
|
charHeight: number;
|
|
17
17
|
canvasWidth: number;
|
|
18
|
-
}):
|
|
18
|
+
}): {
|
|
19
|
+
coords: number[];
|
|
20
|
+
items: FlatbushItem[];
|
|
21
|
+
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { bpSpanPx, measureText } from '@jbrowse/core/util';
|
|
2
2
|
import { colord } from '@jbrowse/core/util/colord';
|
|
3
|
-
import { fillRect } from '
|
|
3
|
+
import { fillRect } from '../util';
|
|
4
4
|
export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, largeInsertionIndicatorScale, mismatchAlpha, charWidth, charHeight, colorMap, colorContrastMap, hideSmallIndels, canvasWidth, drawSNPsMuted, drawIndels = true, }) {
|
|
5
|
+
var _a;
|
|
6
|
+
const items = [];
|
|
7
|
+
const coords = [];
|
|
5
8
|
const { bpPerPx, regions } = renderArgs;
|
|
6
9
|
const { heightPx, topPx, feature } = feat;
|
|
7
10
|
const region = regions[0];
|
|
8
11
|
const start = feature.get('start');
|
|
9
12
|
const pxPerBp = Math.min(1 / bpPerPx, 2);
|
|
10
|
-
const mismatches = feature.get('mismatches');
|
|
13
|
+
const mismatches = (_a = feature.get('mismatches')) !== null && _a !== void 0 ? _a : [];
|
|
11
14
|
const heightLim = charHeight - 2;
|
|
12
15
|
const extraHorizontallyFlippedOffset = region.reversed ? 1 / bpPerPx + 1 : -1;
|
|
13
|
-
if (!mismatches) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
16
|
for (const mismatch of mismatches) {
|
|
17
17
|
const mstart = start + mismatch.start;
|
|
18
18
|
const mlen = mismatch.length;
|
|
@@ -20,6 +20,11 @@ export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, la
|
|
|
20
20
|
const [leftPx, rightPx] = bpSpanPx(mstart, mstart + mlen, region, bpPerPx);
|
|
21
21
|
const widthPx = Math.max(minSubfeatureWidth, rightPx - leftPx);
|
|
22
22
|
if (mismatch.type === 'mismatch') {
|
|
23
|
+
items.push({
|
|
24
|
+
type: 'mismatch',
|
|
25
|
+
seq: mismatch.base,
|
|
26
|
+
});
|
|
27
|
+
coords.push(leftPx, topPx, rightPx, topPx + heightPx);
|
|
23
28
|
if (!drawSNPsMuted) {
|
|
24
29
|
const baseColor = colorMap[mismatch.base] || '#888';
|
|
25
30
|
const c = mismatchAlpha && mismatch.qual !== undefined
|
|
@@ -46,6 +51,11 @@ export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, la
|
|
|
46
51
|
const len = mismatch.length;
|
|
47
52
|
if (!hideSmallIndels || len >= 10) {
|
|
48
53
|
fillRect(ctx, leftPx, topPx, Math.abs(leftPx - rightPx), heightPx, canvasWidth, colorMap.deletion);
|
|
54
|
+
items.push({
|
|
55
|
+
type: 'deletion',
|
|
56
|
+
seq: `${mismatch.length}`,
|
|
57
|
+
});
|
|
58
|
+
coords.push(leftPx, topPx, rightPx, topPx + heightPx);
|
|
49
59
|
const txt = `${mismatch.length}`;
|
|
50
60
|
const rwidth = measureText(txt, 10);
|
|
51
61
|
if (widthPx >= rwidth && heightPx >= heightLim) {
|
|
@@ -62,6 +72,11 @@ export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, la
|
|
|
62
72
|
if (!hideSmallIndels) {
|
|
63
73
|
fillRect(ctx, pos, topPx, insW, heightPx, canvasWidth, colorMap.insertion);
|
|
64
74
|
if (1 / bpPerPx >= charWidth && heightPx >= heightLim) {
|
|
75
|
+
items.push({
|
|
76
|
+
type: 'insertion',
|
|
77
|
+
seq: mismatch.insertedBases || 'unknown',
|
|
78
|
+
});
|
|
79
|
+
coords.push(leftPx - 2, topPx, leftPx + insW + 2, topPx + heightPx);
|
|
65
80
|
const l = Math.round(pos - insW);
|
|
66
81
|
fillRect(ctx, l, topPx, insW * 3, 1, canvasWidth);
|
|
67
82
|
fillRect(ctx, l, topPx + heightPx - 1, insW * 3, 1, canvasWidth);
|
|
@@ -101,6 +116,11 @@ export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, la
|
|
|
101
116
|
if (mismatch.type === 'insertion' && len >= 10) {
|
|
102
117
|
const [leftPx] = bpSpanPx(mstart, mstart + mlen, region, bpPerPx);
|
|
103
118
|
const txt = `${len}`;
|
|
119
|
+
items.push({
|
|
120
|
+
type: 'insertion',
|
|
121
|
+
seq: mismatch.insertedBases || 'unknown',
|
|
122
|
+
});
|
|
123
|
+
coords.push(leftPx - 3, topPx, leftPx + 4, topPx + heightPx);
|
|
104
124
|
if (bpPerPx > largeInsertionIndicatorScale) {
|
|
105
125
|
fillRect(ctx, leftPx - 1, topPx, 2, heightPx, canvasWidth, colorMap.insertion);
|
|
106
126
|
}
|
|
@@ -118,4 +138,8 @@ export function renderMismatches({ ctx, feat, renderArgs, minSubfeatureWidth, la
|
|
|
118
138
|
}
|
|
119
139
|
}
|
|
120
140
|
}
|
|
141
|
+
return {
|
|
142
|
+
coords,
|
|
143
|
+
items,
|
|
144
|
+
};
|
|
121
145
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ProcessedRenderArgs } from '
|
|
2
|
-
import type { LayoutFeature } from '
|
|
1
|
+
import type { FlatbushItem, ProcessedRenderArgs } from '../types';
|
|
2
|
+
import type { LayoutFeature } from '../util';
|
|
3
3
|
import type { Region } from '@jbrowse/core/util';
|
|
4
4
|
export declare function renderModifications({ ctx, feat, region, bpPerPx, renderArgs, canvasWidth, cigarOps, }: {
|
|
5
5
|
ctx: CanvasRenderingContext2D;
|
|
@@ -9,4 +9,7 @@ export declare function renderModifications({ ctx, feat, region, bpPerPx, render
|
|
|
9
9
|
renderArgs: ProcessedRenderArgs;
|
|
10
10
|
canvasWidth: number;
|
|
11
11
|
cigarOps: string[];
|
|
12
|
-
}):
|
|
12
|
+
}): {
|
|
13
|
+
coords: number[];
|
|
14
|
+
items: FlatbushItem[];
|
|
15
|
+
};
|