@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
|
@@ -4,21 +4,159 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
6
|
const mui_1 = require("tss-react/mui");
|
|
7
|
+
const modificationData_1 = require("../../shared/modificationData");
|
|
7
8
|
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
8
9
|
td: {
|
|
9
10
|
whiteSpace: 'nowrap',
|
|
10
11
|
},
|
|
12
|
+
table: {
|
|
13
|
+
width: '100%',
|
|
14
|
+
tableLayout: 'auto',
|
|
15
|
+
},
|
|
11
16
|
}));
|
|
12
|
-
const toP = (s = 0) => +
|
|
17
|
+
const toP = (s = 0) => +s.toFixed(1);
|
|
13
18
|
const pct = (n, total = 1) => `${toP((n / (total || 1)) * 100)}%`;
|
|
14
|
-
function
|
|
19
|
+
function getModificationColor(base, model) {
|
|
15
20
|
var _a;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (!base.startsWith('mod_') && !base.startsWith('nonmod_')) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
if (base.startsWith('nonmod_')) {
|
|
25
|
+
return 'blue';
|
|
26
|
+
}
|
|
27
|
+
return (_a = model.visibleModifications.get(base.replace(/^mod_/, ''))) === null || _a === void 0 ? void 0 : _a.color;
|
|
28
|
+
}
|
|
29
|
+
function isModification(base) {
|
|
30
|
+
return base.startsWith('mod_') || base.startsWith('nonmod_');
|
|
31
|
+
}
|
|
32
|
+
function getModificationType(base) {
|
|
33
|
+
return base.replace(/^(mod_|nonmod_)/, '');
|
|
34
|
+
}
|
|
35
|
+
function formatStrandCounts(score) {
|
|
36
|
+
const neg = score['-1'] ? `${score['-1']}(-)` : '';
|
|
37
|
+
const pos = score['1'] ? `${score['1']}(+)` : '';
|
|
38
|
+
return neg + pos;
|
|
39
|
+
}
|
|
40
|
+
function shouldShowPercentage(base) {
|
|
41
|
+
return base !== 'depth' && base !== 'skip';
|
|
42
|
+
}
|
|
43
|
+
function getModificationLabel(base, model) {
|
|
44
|
+
const isNonmod = base.startsWith('nonmod_');
|
|
45
|
+
if (isNonmod) {
|
|
46
|
+
const genomicBase = base.replace('nonmod_', '');
|
|
47
|
+
return `Unmodified ${genomicBase}`;
|
|
48
|
+
}
|
|
49
|
+
const modType = getModificationType(base);
|
|
50
|
+
const mod = model.visibleModifications.get(modType);
|
|
51
|
+
if (mod) {
|
|
52
|
+
const modName = (0, modificationData_1.getModificationName)(modType);
|
|
53
|
+
return modName;
|
|
54
|
+
}
|
|
55
|
+
return base.toUpperCase();
|
|
56
|
+
}
|
|
57
|
+
function getDuplexModificationLabel(base, model) {
|
|
58
|
+
const isNonmod = base.startsWith('nonmod_');
|
|
59
|
+
if (isNonmod) {
|
|
60
|
+
const genomicBase = base.replace('nonmod_', '');
|
|
61
|
+
return `Unmodified ${genomicBase}`;
|
|
62
|
+
}
|
|
63
|
+
const modType = getModificationType(base);
|
|
64
|
+
const mod = model.visibleModifications.get(modType);
|
|
65
|
+
if (!mod) {
|
|
66
|
+
return base.toUpperCase();
|
|
67
|
+
}
|
|
68
|
+
const modName = (0, modificationData_1.getModificationName)(modType);
|
|
69
|
+
return modName;
|
|
70
|
+
}
|
|
71
|
+
function ColorSquare({ base, model }) {
|
|
72
|
+
const color = getModificationColor(base, model);
|
|
73
|
+
if (!color) {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
return (0, jsx_runtime_1.jsx)("div", { style: { width: 10, height: 10, background: color } });
|
|
77
|
+
}
|
|
78
|
+
function TableHeader() {
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("th", {}), (0, jsx_runtime_1.jsx)("th", { children: "Base" }), (0, jsx_runtime_1.jsx)("th", { children: "Count" }), (0, jsx_runtime_1.jsx)("th", { children: "% of Reads" }), (0, jsx_runtime_1.jsx)("th", { children: "Strands" }), (0, jsx_runtime_1.jsx)("th", { children: "Avg Prob" })] }) }));
|
|
80
|
+
}
|
|
81
|
+
function TotalRow({ readsCounted }) {
|
|
82
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", {}), (0, jsx_runtime_1.jsx)("td", { children: "Total" }), (0, jsx_runtime_1.jsx)("td", { children: readsCounted }), (0, jsx_runtime_1.jsx)("td", { children: " " }), (0, jsx_runtime_1.jsx)("td", { children: " " }), (0, jsx_runtime_1.jsx)("td", { children: " " })] }));
|
|
83
|
+
}
|
|
84
|
+
function RefRow({ referenceBase, reference, readsCounted, }) {
|
|
85
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", {}), (0, jsx_runtime_1.jsxs)("td", { children: ["REF ", referenceBase ? `(${referenceBase.toUpperCase()})` : ''] }), (0, jsx_runtime_1.jsx)("td", { children: reference.entryDepth }), (0, jsx_runtime_1.jsx)("td", { children: pct(reference.entryDepth, readsCounted) }), (0, jsx_runtime_1.jsx)("td", { children: formatStrandCounts(reference) }), (0, jsx_runtime_1.jsx)("td", { children: " " })] }));
|
|
86
|
+
}
|
|
87
|
+
function DuplexModificationRow({ base, score, readsCounted, model, tdClass, rowKey, }) {
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ColorSquare, { model: model, base: base }) }), (0, jsx_runtime_1.jsx)("td", { children: getDuplexModificationLabel(base, model) }), (0, jsx_runtime_1.jsx)("td", { className: tdClass, children: score.entryDepth }), (0, jsx_runtime_1.jsx)("td", { children: shouldShowPercentage(base)
|
|
89
|
+
? pct(score.entryDepth, readsCounted)
|
|
90
|
+
: '---' }), (0, jsx_runtime_1.jsx)("td", { children: formatStrandCounts(score) }), (0, jsx_runtime_1.jsx)("td", { children: score.avgProbability !== undefined ? pct(score.avgProbability) : '' })] }, rowKey));
|
|
91
|
+
}
|
|
92
|
+
function SimplexOrRegularRow({ base, score, isMod, readsCounted, model, tdClass, rowKey, }) {
|
|
93
|
+
return ((0, jsx_runtime_1.jsxs)("tr", { children: [(0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(ColorSquare, { model: model, base: base }) }), (0, jsx_runtime_1.jsx)("td", { children: isMod ? getModificationLabel(base, model) : base.toUpperCase() }), (0, jsx_runtime_1.jsx)("td", { className: tdClass, children: score.entryDepth }), (0, jsx_runtime_1.jsx)("td", { children: shouldShowPercentage(base)
|
|
94
|
+
? pct(score.entryDepth, readsCounted)
|
|
95
|
+
: '---' }), (0, jsx_runtime_1.jsx)("td", { children: formatStrandCounts(score) }), (0, jsx_runtime_1.jsx)("td", { children: score.avgProbability !== undefined ? pct(score.avgProbability) : '' })] }, rowKey));
|
|
96
|
+
}
|
|
97
|
+
function ModificationRows({ info, readsCounted, model, tdClass, }) {
|
|
98
|
+
const consolidatedEntries = {};
|
|
99
|
+
for (const [key, entry] of Object.entries(info)) {
|
|
100
|
+
for (const [base, score] of Object.entries(entry)) {
|
|
101
|
+
const isNonmod = base.startsWith('nonmod_');
|
|
102
|
+
if (isNonmod) {
|
|
103
|
+
const modType = getModificationType(base);
|
|
104
|
+
const mod = model.visibleModifications.get(modType);
|
|
105
|
+
const genomicBase = (mod === null || mod === void 0 ? void 0 : mod.base) || 'X';
|
|
106
|
+
const consolidatedKey = `${key}_nonmod_${genomicBase}`;
|
|
107
|
+
if (!consolidatedEntries[consolidatedKey]) {
|
|
108
|
+
consolidatedEntries[consolidatedKey] = {
|
|
109
|
+
base: `nonmod_${genomicBase}`,
|
|
110
|
+
score: {
|
|
111
|
+
entryDepth: 0,
|
|
112
|
+
'1': 0,
|
|
113
|
+
'-1': 0,
|
|
114
|
+
avgProbability: 0,
|
|
115
|
+
},
|
|
116
|
+
isNonmod: true,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const consolidated = consolidatedEntries[consolidatedKey];
|
|
120
|
+
consolidated.score.entryDepth += score.entryDepth;
|
|
121
|
+
consolidated.score['1'] += score['1'];
|
|
122
|
+
consolidated.score['-1'] += score['-1'];
|
|
123
|
+
if (score.avgProbability !== undefined) {
|
|
124
|
+
const prevAvg = consolidated.score.avgProbability || 0;
|
|
125
|
+
const prevCount = consolidated.score.entryDepth - score.entryDepth;
|
|
126
|
+
consolidated.score.avgProbability =
|
|
127
|
+
prevCount > 0
|
|
128
|
+
? (prevAvg * prevCount +
|
|
129
|
+
score.avgProbability * score.entryDepth) /
|
|
130
|
+
consolidated.score.entryDepth
|
|
131
|
+
: score.avgProbability;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
consolidatedEntries[`${key}_${base}`] = {
|
|
136
|
+
base,
|
|
137
|
+
score: { ...score },
|
|
138
|
+
isNonmod: false,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.entries(consolidatedEntries).map(([rowKey, { base, score, isNonmod }]) => {
|
|
144
|
+
var _a;
|
|
145
|
+
const modType = getModificationType(base);
|
|
146
|
+
const isMod = isModification(base) || isNonmod;
|
|
147
|
+
const isSimplex = !isNonmod && isMod && ((_a = model.simplexModifications) === null || _a === void 0 ? void 0 : _a.has(modType));
|
|
148
|
+
const posStrandCount = score['1'] || 0;
|
|
149
|
+
const negStrandCount = score['-1'] || 0;
|
|
150
|
+
if (isNonmod) {
|
|
151
|
+
return ((0, jsx_runtime_1.jsx)(SimplexOrRegularRow, { base: base, score: score, isMod: true, isSimplex: false, readsCounted: readsCounted, model: model, tdClass: tdClass, rowKey: rowKey }, rowKey));
|
|
152
|
+
}
|
|
153
|
+
if (isMod &&
|
|
154
|
+
!isSimplex &&
|
|
155
|
+
(posStrandCount > 0 || negStrandCount > 0)) {
|
|
156
|
+
return ((0, jsx_runtime_1.jsx)(DuplexModificationRow, { base: base, score: score, posStrandCount: posStrandCount, negStrandCount: negStrandCount, readsCounted: readsCounted, model: model, tdClass: tdClass, rowKey: rowKey }, rowKey));
|
|
157
|
+
}
|
|
158
|
+
return ((0, jsx_runtime_1.jsx)(SimplexOrRegularRow, { base: base, score: score, isMod: isMod, isSimplex: isSimplex, readsCounted: readsCounted, model: model, tdClass: tdClass, rowKey: rowKey }, rowKey));
|
|
159
|
+
}) }));
|
|
22
160
|
}
|
|
23
161
|
const TooltipContents = (0, react_1.forwardRef)(function TooltipContents2(props, reactRef) {
|
|
24
162
|
const { feature, model } = props;
|
|
@@ -26,7 +164,7 @@ const TooltipContents = (0, react_1.forwardRef)(function TooltipContents2(props,
|
|
|
26
164
|
const start = feature.get('start') + 1;
|
|
27
165
|
const end = feature.get('end');
|
|
28
166
|
const name = feature.get('refName');
|
|
29
|
-
const { refbase, readsCounted, depth, ref, ...info } = feature.get('snpinfo');
|
|
167
|
+
const { refbase: referenceBase, readsCounted, depth, ref: reference, ...info } = feature.get('snpinfo');
|
|
30
168
|
return ((0, jsx_runtime_1.jsx)("div", { ref: reactRef, children: (0, jsx_runtime_1.jsxs)("table", { children: [(0, jsx_runtime_1.jsx)("caption", { children: [
|
|
31
169
|
name,
|
|
32
170
|
start === end
|
|
@@ -34,15 +172,6 @@ const TooltipContents = (0, react_1.forwardRef)(function TooltipContents2(props,
|
|
|
34
172
|
: `${(0, util_1.toLocale)(start)}..${(0, util_1.toLocale)(end)}`,
|
|
35
173
|
]
|
|
36
174
|
.filter(f => !!f)
|
|
37
|
-
.join(':') }), (0, jsx_runtime_1.jsx)(
|
|
38
|
-
score.entryDepth,
|
|
39
|
-
score.avgProbability !== undefined
|
|
40
|
-
? `(avg. ${pct(score.avgProbability)} prob.)`
|
|
41
|
-
: '',
|
|
42
|
-
]
|
|
43
|
-
.filter(f => !!f)
|
|
44
|
-
.join(' ') }), (0, jsx_runtime_1.jsx)("td", { children: base === 'depth' || base === 'skip'
|
|
45
|
-
? '---'
|
|
46
|
-
: pct(score.entryDepth, readsCounted) }), (0, jsx_runtime_1.jsxs)("td", { children: [score['-1'] ? `${score['-1']}(-)` : '', score['1'] ? `${score['1']}(+)` : ''] })] }, `${key}_${base}`))))] })] }) }));
|
|
175
|
+
.join(':') }), (0, jsx_runtime_1.jsx)(TableHeader, {}), (0, jsx_runtime_1.jsxs)("tbody", { children: [(0, jsx_runtime_1.jsx)(TotalRow, { readsCounted: readsCounted }), (0, jsx_runtime_1.jsx)(RefRow, { referenceBase: referenceBase, reference: reference, readsCounted: readsCounted }), (0, jsx_runtime_1.jsx)(ModificationRows, { info: info, readsCounted: readsCounted, model: model, tdClass: classes.td })] })] }) }));
|
|
47
176
|
});
|
|
48
177
|
exports.default = TooltipContents;
|
|
@@ -61,6 +61,7 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
61
61
|
}))
|
|
62
62
|
.volatile(() => ({
|
|
63
63
|
visibleModifications: mobx_1.observable.map({}),
|
|
64
|
+
simplexModifications: new Set(),
|
|
64
65
|
modificationsReady: false,
|
|
65
66
|
}))
|
|
66
67
|
.views(self => ({
|
|
@@ -102,10 +103,17 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
102
103
|
}
|
|
103
104
|
}
|
|
104
105
|
},
|
|
106
|
+
setSimplexModifications(simplex) {
|
|
107
|
+
self.simplexModifications = new Set(simplex);
|
|
108
|
+
},
|
|
105
109
|
}))
|
|
106
110
|
.views(self => {
|
|
107
111
|
const { adapterProps: superAdapterProps } = self;
|
|
108
112
|
return {
|
|
113
|
+
get modificationThreshold() {
|
|
114
|
+
var _a, _b, _c;
|
|
115
|
+
return (_c = (_b = (_a = self.colorBy) === null || _a === void 0 ? void 0 : _a.modifications) === null || _b === void 0 ? void 0 : _b.threshold) !== null && _c !== void 0 ? _c : 10;
|
|
116
|
+
},
|
|
109
117
|
get rendererConfig() {
|
|
110
118
|
const configBlob = (0, configuration_1.getConf)(self, ['renderers', self.rendererTypeName]) || {};
|
|
111
119
|
const { showArcs, showInterbaseCounts, showInterbaseIndicators } = self;
|
|
@@ -141,6 +149,7 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
141
149
|
...superProps,
|
|
142
150
|
filters,
|
|
143
151
|
filterBy,
|
|
152
|
+
modificationThreshold: this.modificationThreshold,
|
|
144
153
|
};
|
|
145
154
|
},
|
|
146
155
|
};
|
|
@@ -170,13 +179,14 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
170
179
|
const { staticBlocks } = view;
|
|
171
180
|
const { colorBy } = self;
|
|
172
181
|
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
173
|
-
const
|
|
182
|
+
const { modifications, simplexModifications } = await (0, getUniqueModifications_1.getUniqueModifications)({
|
|
174
183
|
model: self,
|
|
175
184
|
adapterConfig: (0, configuration_1.getConf)(self.parentTrack, 'adapter'),
|
|
176
185
|
blocks: staticBlocks,
|
|
177
186
|
});
|
|
178
187
|
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
179
|
-
self.updateVisibleModifications(
|
|
188
|
+
self.updateVisibleModifications(modifications);
|
|
189
|
+
self.setSimplexModifications(simplexModifications);
|
|
180
190
|
self.setModificationsReady(true);
|
|
181
191
|
}
|
|
182
192
|
}
|
|
@@ -194,12 +204,13 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
194
204
|
return !superProps.notReady && self.modificationsReady;
|
|
195
205
|
},
|
|
196
206
|
renderProps() {
|
|
197
|
-
const { colorBy, visibleModifications } = self;
|
|
207
|
+
const { colorBy, visibleModifications, simplexModifications } = self;
|
|
198
208
|
return {
|
|
199
209
|
...superRenderProps(),
|
|
200
210
|
notReady: !this.renderReady(),
|
|
201
211
|
colorBy,
|
|
202
212
|
visibleModifications: Object.fromEntries(visibleModifications.toJSON()),
|
|
213
|
+
simplexModifications: [...simplexModifications],
|
|
203
214
|
};
|
|
204
215
|
},
|
|
205
216
|
get TooltipComponent() {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.detectSimplexModifications = detectSimplexModifications;
|
|
4
|
+
function detectSimplexModifications(modifications) {
|
|
5
|
+
const minusStrandMods = new Set();
|
|
6
|
+
const simplexModifications = new Set();
|
|
7
|
+
for (const modification of modifications) {
|
|
8
|
+
const mod = modification;
|
|
9
|
+
if (mod.strand === '-') {
|
|
10
|
+
minusStrandMods.add(mod.type);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
for (const modification of modifications) {
|
|
14
|
+
const mod = modification;
|
|
15
|
+
if (mod.strand === '+' && !minusStrandMods.has(mod.type)) {
|
|
16
|
+
simplexModifications.add(mod.type);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return simplexModifications;
|
|
20
|
+
}
|
|
@@ -5,6 +5,7 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
5
5
|
const consts_1 = require("./consts");
|
|
6
6
|
function getModPositions(mm, fseq, fstrand) {
|
|
7
7
|
const seq = fstrand === -1 ? (0, util_1.revcom)(fseq) : fseq;
|
|
8
|
+
const seqLength = seq.length;
|
|
8
9
|
const mods = mm.split(';');
|
|
9
10
|
const result = [];
|
|
10
11
|
for (const mod of mods) {
|
|
@@ -19,44 +20,40 @@ function getModPositions(mm, fseq, fstrand) {
|
|
|
19
20
|
}
|
|
20
21
|
const [, base, strand, typestr] = matches;
|
|
21
22
|
const types = typestr.split(/(\d+|.)/);
|
|
22
|
-
if (strand === '-') {
|
|
23
|
-
console.warn('unsupported negative strand modifications');
|
|
24
|
-
result.push({
|
|
25
|
-
type: 'unsupported',
|
|
26
|
-
positions: [],
|
|
27
|
-
base: base,
|
|
28
|
-
strand: strand,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
23
|
for (const type of types) {
|
|
32
24
|
if (type === '') {
|
|
33
25
|
continue;
|
|
34
26
|
}
|
|
27
|
+
const splitLength = split.length;
|
|
35
28
|
let currPos = 0;
|
|
36
|
-
const positions = [];
|
|
37
|
-
|
|
29
|
+
const positions = fstrand === -1 ? new Array(splitLength - 1) : [];
|
|
30
|
+
let writeIndex = fstrand === -1 ? splitLength - 2 : 0;
|
|
31
|
+
for (let i = 1; i < splitLength; i++) {
|
|
38
32
|
let delta = +split[i];
|
|
39
33
|
do {
|
|
40
34
|
if (base === 'N' || base === seq[currPos]) {
|
|
41
35
|
delta--;
|
|
42
36
|
}
|
|
43
37
|
currPos++;
|
|
44
|
-
} while (delta >= 0 && currPos <
|
|
38
|
+
} while (delta >= 0 && currPos < seqLength);
|
|
45
39
|
if (fstrand === -1) {
|
|
46
|
-
const pos =
|
|
40
|
+
const pos = seqLength - currPos;
|
|
47
41
|
if (pos >= 0) {
|
|
48
|
-
positions
|
|
42
|
+
positions[writeIndex--] = pos;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
49
45
|
}
|
|
50
46
|
}
|
|
51
47
|
else {
|
|
52
|
-
positions
|
|
48
|
+
positions[writeIndex++] = currPos - 1;
|
|
53
49
|
}
|
|
54
50
|
}
|
|
51
|
+
const validPositions = fstrand === -1 ? positions.slice(writeIndex + 1) : positions;
|
|
55
52
|
result.push({
|
|
56
53
|
type,
|
|
57
54
|
base: base,
|
|
58
55
|
strand: strand,
|
|
59
|
-
positions,
|
|
56
|
+
positions: validPositions,
|
|
60
57
|
});
|
|
61
58
|
}
|
|
62
59
|
}
|
|
@@ -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
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
8
|
const operators_1 = require("rxjs/operators");
|
|
9
|
+
const detectSimplexModifications_1 = require("../../ModificationParser/detectSimplexModifications");
|
|
9
10
|
const getModTypes_1 = require("../../ModificationParser/getModTypes");
|
|
10
11
|
const util_1 = require("../../util");
|
|
11
12
|
const base_1 = __importDefault(require("../base"));
|
|
@@ -25,12 +26,24 @@ class PileupGetVisibleModifications extends base_1.default {
|
|
|
25
26
|
for (const feat of featuresArray) {
|
|
26
27
|
const mmTag = (0, util_1.getTagAlt)(feat, 'MM', 'Mm');
|
|
27
28
|
for (const mod of (0, getModTypes_1.getModTypes)(typeof mmTag === 'string' ? mmTag : '')) {
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const key = `${mod.base}${mod.strand}${mod.type}`;
|
|
30
|
+
if (!uniqueModifications.has(key)) {
|
|
31
|
+
uniqueModifications.set(key, mod);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
|
-
|
|
35
|
+
const modifications = [...uniqueModifications.values()];
|
|
36
|
+
const simplexModifications = (0, detectSimplexModifications_1.detectSimplexModifications)(modifications);
|
|
37
|
+
const modificationsForDisplay = new Map();
|
|
38
|
+
for (const mod of modifications) {
|
|
39
|
+
if (!modificationsForDisplay.has(mod.type)) {
|
|
40
|
+
modificationsForDisplay.set(mod.type, mod);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
modifications: [...modificationsForDisplay.values()],
|
|
45
|
+
simplexModifications: [...simplexModifications],
|
|
46
|
+
};
|
|
34
47
|
}
|
|
35
48
|
}
|
|
36
49
|
exports.default = PileupGetVisibleModifications;
|
|
@@ -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';
|
|
@@ -88,20 +88,17 @@ class PileupRenderer extends BoxRendererType_1.default {
|
|
|
88
88
|
? await this.fetchSequence(renderProps, region)
|
|
89
89
|
: undefined;
|
|
90
90
|
const { makeImageData } = await Promise.resolve().then(() => __importStar(require('./makeImageData')));
|
|
91
|
-
return (0, util_1.renderToAbstractCanvas)(width, height, renderProps, ctx => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
});
|
|
103
|
-
return undefined;
|
|
104
|
-
});
|
|
91
|
+
return (0, util_1.renderToAbstractCanvas)(width, height, renderProps, ctx => makeImageData({
|
|
92
|
+
ctx,
|
|
93
|
+
layoutRecords,
|
|
94
|
+
canvasWidth: width,
|
|
95
|
+
renderArgs: {
|
|
96
|
+
...renderProps,
|
|
97
|
+
layout,
|
|
98
|
+
features,
|
|
99
|
+
regionSequence,
|
|
100
|
+
},
|
|
101
|
+
}));
|
|
105
102
|
});
|
|
106
103
|
const results = await super.render({
|
|
107
104
|
...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,13 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
7
|
const react_1 = require("react");
|
|
5
8
|
const ui_1 = require("@jbrowse/core/ui");
|
|
6
9
|
const util_1 = require("@jbrowse/core/util");
|
|
10
|
+
const flatbush_1 = __importDefault(require("@jbrowse/core/util/flatbush"));
|
|
7
11
|
const mobx_react_1 = require("mobx-react");
|
|
8
12
|
const PileupRendering = (0, mobx_react_1.observer)(function (props) {
|
|
9
13
|
var _a;
|
|
10
|
-
const { onMouseMove, blockKey, displayModel, width, height, regions, bpPerPx, sortedBy, colorBy, filterBy, } = props;
|
|
14
|
+
const { onMouseMove, blockKey, displayModel, width, height, regions, bpPerPx, sortedBy, colorBy, filterBy, flatbush, items, } = props;
|
|
15
|
+
const flatbush2 = (0, react_1.useMemo)(() => flatbush_1.default.from(flatbush), [flatbush]);
|
|
11
16
|
const { selectedFeatureId, featureIdUnderMouse, contextMenuFeature } = displayModel || {};
|
|
12
17
|
const [firstRender, setFirstRender] = (0, react_1.useState)(false);
|
|
13
18
|
(0, react_1.useEffect)(() => {
|
|
@@ -81,7 +86,18 @@ const PileupRendering = (0, mobx_react_1.observer)(function (props) {
|
|
|
81
86
|
const offsetY = event.clientY - rect.top;
|
|
82
87
|
const px = region.reversed ? width - offsetX : offsetX;
|
|
83
88
|
const clientBp = region.start + bpPerPx * px;
|
|
84
|
-
|
|
89
|
+
const search = flatbush2.search(offsetX, offsetY, offsetX + 1, offsetY + 1);
|
|
90
|
+
const item = search.length ? items[search[0]] : undefined;
|
|
91
|
+
const label = item
|
|
92
|
+
? item.type === 'insertion'
|
|
93
|
+
? `Insertion: ${item.seq}`
|
|
94
|
+
: item.type === 'deletion'
|
|
95
|
+
? `Deletion: ${item.seq}bp`
|
|
96
|
+
: item.type === 'modification'
|
|
97
|
+
? item.seq
|
|
98
|
+
: `Mismatch: ${item.seq}`
|
|
99
|
+
: undefined;
|
|
100
|
+
onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(event, displayModel === null || displayModel === void 0 ? void 0 : displayModel.getFeatureOverlapping(blockKey, clientBp, offsetY), label);
|
|
85
101
|
}
|
|
86
102
|
function callMouseHandler(handlerName, event) {
|
|
87
103
|
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,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.makeImageData = makeImageData;
|
|
4
7
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
8
|
const ui_1 = require("@jbrowse/core/ui");
|
|
6
9
|
const util_1 = require("@jbrowse/core/util");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
+
const flatbush_1 = __importDefault(require("@jbrowse/core/util/flatbush"));
|
|
11
|
+
const renderAlignment_1 = require("./renderers/renderAlignment");
|
|
12
|
+
const renderMismatches_1 = require("./renderers/renderMismatches");
|
|
13
|
+
const renderSoftClipping_1 = require("./renderers/renderSoftClipping");
|
|
10
14
|
const util_2 = require("./util");
|
|
11
15
|
function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
12
16
|
const { stopToken, config, showSoftClip, colorBy, theme: configTheme, } = renderArgs;
|
|
@@ -22,8 +26,10 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
22
26
|
const { charWidth, charHeight } = (0, util_2.getCharWidthHeight)();
|
|
23
27
|
const drawSNPsMuted = (0, util_2.shouldDrawSNPsMuted)(colorBy === null || colorBy === void 0 ? void 0 : colorBy.type);
|
|
24
28
|
const drawIndels = (0, util_2.shouldDrawIndels)();
|
|
29
|
+
const coords = [];
|
|
30
|
+
const items = [];
|
|
25
31
|
(0, util_1.forEachWithStopTokenCheck)(layoutRecords, stopToken, feat => {
|
|
26
|
-
(0, renderAlignment_1.renderAlignment)({
|
|
32
|
+
const alignmentRet = (0, renderAlignment_1.renderAlignment)({
|
|
27
33
|
ctx,
|
|
28
34
|
feat,
|
|
29
35
|
renderArgs,
|
|
@@ -34,7 +40,13 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
34
40
|
charHeight,
|
|
35
41
|
canvasWidth,
|
|
36
42
|
});
|
|
37
|
-
(0,
|
|
43
|
+
for (let i = 0, l = alignmentRet.coords.length; i < l; i++) {
|
|
44
|
+
coords.push(alignmentRet.coords[i]);
|
|
45
|
+
}
|
|
46
|
+
for (let i = 0, l = alignmentRet.items.length; i < l; i++) {
|
|
47
|
+
items.push(alignmentRet.items[i]);
|
|
48
|
+
}
|
|
49
|
+
const ret = (0, renderMismatches_1.renderMismatches)({
|
|
38
50
|
ctx,
|
|
39
51
|
feat,
|
|
40
52
|
renderArgs,
|
|
@@ -50,6 +62,12 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
50
62
|
colorContrastMap,
|
|
51
63
|
canvasWidth,
|
|
52
64
|
});
|
|
65
|
+
for (let i = 0, l = ret.coords.length; i < l; i++) {
|
|
66
|
+
coords.push(ret.coords[i]);
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0, l = ret.items.length; i < l; i++) {
|
|
69
|
+
items.push(ret.items[i]);
|
|
70
|
+
}
|
|
53
71
|
if (showSoftClip) {
|
|
54
72
|
(0, renderSoftClipping_1.renderSoftClipping)({
|
|
55
73
|
ctx,
|
|
@@ -62,5 +80,18 @@ function makeImageData({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
|
|
|
62
80
|
});
|
|
63
81
|
}
|
|
64
82
|
});
|
|
65
|
-
|
|
83
|
+
const flatbush = new flatbush_1.default(Math.max(items.length, 1));
|
|
84
|
+
if (coords.length) {
|
|
85
|
+
for (let i = 0; i < coords.length; i += 4) {
|
|
86
|
+
flatbush.add(coords[i], coords[i + 1], coords[i + 2], coords[i + 3]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
flatbush.add(0, 0);
|
|
91
|
+
}
|
|
92
|
+
flatbush.finish();
|
|
93
|
+
return {
|
|
94
|
+
flatbush: flatbush.data,
|
|
95
|
+
items,
|
|
96
|
+
};
|
|
66
97
|
}
|