@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
|
@@ -1,30 +1,18 @@
|
|
|
1
|
-
import { lazy } from 'react';
|
|
2
1
|
import { ConfigurationReference, getConf } from '@jbrowse/core/configuration';
|
|
3
2
|
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes';
|
|
4
|
-
import { getSession } from '@jbrowse/core/util';
|
|
5
3
|
import { FeatureDensityMixin, TrackHeightMixin, } from '@jbrowse/plugin-linear-genome-view';
|
|
6
|
-
import FilterListIcon from '@mui/icons-material/ClearAll';
|
|
7
|
-
import PaletteIcon from '@mui/icons-material/Palette';
|
|
8
4
|
import { types } from 'mobx-state-tree';
|
|
9
|
-
|
|
5
|
+
import { LinearReadDisplayBaseMixin } from '../shared/LinearReadDisplayBaseMixin';
|
|
6
|
+
import { getColorSchemeMenuItem, getFilterByMenuItem, } from '../shared/menuItems';
|
|
10
7
|
function stateModelFactory(configSchema) {
|
|
11
8
|
return types
|
|
12
|
-
.compose('LinearReadArcsDisplay', BaseDisplay, TrackHeightMixin(), FeatureDensityMixin(), types.model({
|
|
9
|
+
.compose('LinearReadArcsDisplay', BaseDisplay, TrackHeightMixin(), FeatureDensityMixin(), LinearReadDisplayBaseMixin(), types.model({
|
|
13
10
|
type: types.literal('LinearReadArcsDisplay'),
|
|
14
11
|
configuration: ConfigurationReference(configSchema),
|
|
15
12
|
lineWidth: types.maybe(types.number),
|
|
16
13
|
jitter: types.maybe(types.number),
|
|
17
|
-
colorBySetting: types.frozen(),
|
|
18
|
-
filterBySetting: types.frozen(),
|
|
19
14
|
drawInter: true,
|
|
20
15
|
drawLongRange: true,
|
|
21
|
-
}))
|
|
22
|
-
.volatile(() => ({
|
|
23
|
-
loading: false,
|
|
24
|
-
chainData: undefined,
|
|
25
|
-
lastDrawnOffsetPx: undefined,
|
|
26
|
-
lastDrawnBpPerPx: 0,
|
|
27
|
-
ref: null,
|
|
28
16
|
}))
|
|
29
17
|
.views(self => ({
|
|
30
18
|
get colorBy() {
|
|
@@ -37,40 +25,15 @@ function stateModelFactory(configSchema) {
|
|
|
37
25
|
},
|
|
38
26
|
}))
|
|
39
27
|
.actions(self => ({
|
|
40
|
-
setLastDrawnOffsetPx(n) {
|
|
41
|
-
self.lastDrawnOffsetPx = n;
|
|
42
|
-
},
|
|
43
|
-
setLastDrawnBpPerPx(n) {
|
|
44
|
-
self.lastDrawnBpPerPx = n;
|
|
45
|
-
},
|
|
46
|
-
setLoading(f) {
|
|
47
|
-
self.loading = f;
|
|
48
|
-
},
|
|
49
28
|
reload() {
|
|
50
29
|
self.error = undefined;
|
|
51
30
|
},
|
|
52
|
-
setRef(ref) {
|
|
53
|
-
self.ref = ref;
|
|
54
|
-
},
|
|
55
|
-
setColorScheme(colorBy) {
|
|
56
|
-
self.colorBySetting = {
|
|
57
|
-
...colorBy,
|
|
58
|
-
};
|
|
59
|
-
},
|
|
60
|
-
setChainData(args) {
|
|
61
|
-
self.chainData = args;
|
|
62
|
-
},
|
|
63
31
|
setDrawInter(f) {
|
|
64
32
|
self.drawInter = f;
|
|
65
33
|
},
|
|
66
34
|
setDrawLongRange(f) {
|
|
67
35
|
self.drawLongRange = f;
|
|
68
36
|
},
|
|
69
|
-
setFilterBy(filter) {
|
|
70
|
-
self.filterBySetting = {
|
|
71
|
-
...filter,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
37
|
setLineWidth(n) {
|
|
75
38
|
self.lineWidth = n;
|
|
76
39
|
},
|
|
@@ -79,9 +42,6 @@ function stateModelFactory(configSchema) {
|
|
|
79
42
|
},
|
|
80
43
|
}))
|
|
81
44
|
.views(self => ({
|
|
82
|
-
get drawn() {
|
|
83
|
-
return self.lastDrawnOffsetPx !== undefined;
|
|
84
|
-
},
|
|
85
45
|
get lineWidthSetting() {
|
|
86
46
|
var _a;
|
|
87
47
|
return (_a = self.lineWidth) !== null && _a !== void 0 ? _a : getConf(self, 'lineWidth');
|
|
@@ -103,16 +63,7 @@ function stateModelFactory(configSchema) {
|
|
|
103
63
|
trackMenuItems() {
|
|
104
64
|
return [
|
|
105
65
|
...superTrackMenuItems(),
|
|
106
|
-
|
|
107
|
-
label: 'Filter by',
|
|
108
|
-
icon: FilterListIcon,
|
|
109
|
-
onClick: () => {
|
|
110
|
-
getSession(self).queueDialog(handleClose => [
|
|
111
|
-
FilterByTagDialog,
|
|
112
|
-
{ model: self, handleClose },
|
|
113
|
-
]);
|
|
114
|
-
},
|
|
115
|
-
},
|
|
66
|
+
getFilterByMenuItem(self),
|
|
116
67
|
{
|
|
117
68
|
label: 'Line width',
|
|
118
69
|
subMenu: [
|
|
@@ -181,36 +132,7 @@ function stateModelFactory(configSchema) {
|
|
|
181
132
|
self.setDrawLongRange(!self.drawLongRange);
|
|
182
133
|
},
|
|
183
134
|
},
|
|
184
|
-
|
|
185
|
-
label: 'Color scheme',
|
|
186
|
-
icon: PaletteIcon,
|
|
187
|
-
subMenu: [
|
|
188
|
-
{
|
|
189
|
-
label: 'Insert size ± 3σ and orientation',
|
|
190
|
-
onClick: () => {
|
|
191
|
-
self.setColorScheme({ type: 'insertSizeAndOrientation' });
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
label: 'Insert size ± 3σ',
|
|
196
|
-
onClick: () => {
|
|
197
|
-
self.setColorScheme({ type: 'insertSize' });
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
label: 'Orientation',
|
|
202
|
-
onClick: () => {
|
|
203
|
-
self.setColorScheme({ type: 'orientation' });
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
label: 'Insert size gradient',
|
|
208
|
-
onClick: () => {
|
|
209
|
-
self.setColorScheme({ type: 'gradient' });
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
},
|
|
135
|
+
getColorSchemeMenuItem(self),
|
|
214
136
|
];
|
|
215
137
|
},
|
|
216
138
|
};
|
|
@@ -1,16 +1,98 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
3
4
|
import { getContainingView } from '@jbrowse/core/util';
|
|
5
|
+
import Flatbush from '@jbrowse/core/util/flatbush';
|
|
4
6
|
import { observer } from 'mobx-react';
|
|
5
7
|
import BaseDisplayComponent from '../../shared/components/BaseDisplayComponent';
|
|
6
8
|
const Cloud = observer(function ({ model, }) {
|
|
7
9
|
const view = getContainingView(model);
|
|
8
10
|
const width = Math.round(view.dynamicBlocks.totalWidthPx);
|
|
9
|
-
const height = model.height;
|
|
11
|
+
const height = model.drawCloud ? model.height : model.layoutHeight;
|
|
12
|
+
const containerRef = useRef(null);
|
|
13
|
+
const [hoveredFeature, setHoveredFeature] = useState(null);
|
|
14
|
+
const [hoveredFeatureData, setHoveredFeatureData] = useState(null);
|
|
15
|
+
const [mousePosition, setMousePosition] = useState(null);
|
|
16
|
+
const flatbushIndex = useMemo(() => {
|
|
17
|
+
return model.featureLayout ? Flatbush.from(model.featureLayout.data) : null;
|
|
18
|
+
}, [model.featureLayout]);
|
|
10
19
|
const cb = useCallback((ref) => {
|
|
11
20
|
model.setRef(ref);
|
|
12
21
|
}, [model, width, height]);
|
|
13
|
-
|
|
22
|
+
const mouseoverCb = useCallback((ref) => {
|
|
23
|
+
model.setMouseoverRef(ref);
|
|
24
|
+
}, [model, width, height]);
|
|
25
|
+
const onMouseMove = useCallback((event) => {
|
|
26
|
+
if (!containerRef.current || !flatbushIndex) {
|
|
27
|
+
setHoveredFeature(null);
|
|
28
|
+
setHoveredFeatureData(null);
|
|
29
|
+
setMousePosition(null);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
33
|
+
const offsetX = event.clientX - rect.left;
|
|
34
|
+
const offsetY = event.clientY - rect.top;
|
|
35
|
+
setMousePosition({ x: event.clientX, y: event.clientY });
|
|
36
|
+
const results = flatbushIndex.search(offsetX, offsetY, offsetX + 1, offsetY + 1);
|
|
37
|
+
if (results.length > 0) {
|
|
38
|
+
const featureIndex = results[0];
|
|
39
|
+
const feature = model.featuresForFlatbush[featureIndex];
|
|
40
|
+
if (feature) {
|
|
41
|
+
setHoveredFeature({
|
|
42
|
+
x: feature.chainMinX,
|
|
43
|
+
y: feature.y1,
|
|
44
|
+
width: feature.chainMaxX - feature.chainMinX,
|
|
45
|
+
height: feature.y2 - feature.y1,
|
|
46
|
+
});
|
|
47
|
+
setHoveredFeatureData(feature.data);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setHoveredFeature(null);
|
|
51
|
+
setHoveredFeatureData(null);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
setHoveredFeature(null);
|
|
56
|
+
setHoveredFeatureData(null);
|
|
57
|
+
}
|
|
58
|
+
}, [flatbushIndex, model.featuresForFlatbush]);
|
|
59
|
+
const onMouseLeave = useCallback(() => {
|
|
60
|
+
setHoveredFeature(null);
|
|
61
|
+
setHoveredFeatureData(null);
|
|
62
|
+
setMousePosition(null);
|
|
63
|
+
}, []);
|
|
64
|
+
const onClick = useCallback((event) => {
|
|
65
|
+
if (!containerRef.current || !flatbushIndex) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
69
|
+
const offsetX = event.clientX - rect.left;
|
|
70
|
+
const offsetY = event.clientY - rect.top;
|
|
71
|
+
const results = flatbushIndex.search(offsetX, offsetY, offsetX + 1, offsetY + 1);
|
|
72
|
+
if (results.length > 0) {
|
|
73
|
+
const featureIndex = results[0];
|
|
74
|
+
const feature = model.featuresForFlatbush[featureIndex];
|
|
75
|
+
if (feature) {
|
|
76
|
+
model.selectFeature(feature.chain);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, [flatbushIndex, model]);
|
|
80
|
+
return (_jsxs("div", { ref: containerRef, style: { position: 'relative', width, height }, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, onClick: onClick, children: [_jsx("canvas", { "data-testid": model.drawCloud ? 'cloud-canvas' : 'stack-canvas', ref: cb, style: { width, height, position: 'absolute', left: 0, top: 0 }, width: width * 2, height: height * 2 }), _jsx("canvas", { "data-testid": "cloud-mouseover-canvas", ref: mouseoverCb, style: {
|
|
81
|
+
width,
|
|
82
|
+
height,
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
left: 0,
|
|
85
|
+
top: 0,
|
|
86
|
+
pointerEvents: 'none',
|
|
87
|
+
}, width: width * 2, height: height * 2 }), hoveredFeature ? (_jsx("div", { style: {
|
|
88
|
+
position: 'absolute',
|
|
89
|
+
left: hoveredFeature.x,
|
|
90
|
+
top: hoveredFeature.y,
|
|
91
|
+
width: hoveredFeature.width,
|
|
92
|
+
height: hoveredFeature.height,
|
|
93
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
|
94
|
+
pointerEvents: 'none',
|
|
95
|
+
} })) : null, hoveredFeatureData && mousePosition ? (_jsx(BaseTooltip, { clientPoint: { x: mousePosition.x, y: mousePosition.y + 20 }, placement: "bottom-start", children: _jsxs("div", { children: [_jsx("div", { children: _jsx("strong", { children: hoveredFeatureData.name }) }), _jsxs("div", { children: [hoveredFeatureData.refName, ":", hoveredFeatureData.start.toLocaleString(), "-", hoveredFeatureData.end.toLocaleString()] }), hoveredFeatureData.tlen !== 0 ? (_jsxs("div", { children: ["Template length: ", hoveredFeatureData.tlen] })) : null] }) })) : null] }));
|
|
14
96
|
});
|
|
15
97
|
const LinearReadCloudReactComponent = observer(function ({ model, }) {
|
|
16
98
|
return (_jsx(BaseDisplayComponent, { model: model, children: _jsx(Cloud, { model: model }) }));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const SetFeatureHeightDialog: (props: {
|
|
2
|
+
model: {
|
|
3
|
+
setFeatureHeight: (arg?: number) => void;
|
|
4
|
+
setNoSpacing: (arg?: boolean) => void;
|
|
5
|
+
featureHeightSetting: number;
|
|
6
|
+
noSpacing?: boolean;
|
|
7
|
+
};
|
|
8
|
+
handleClose: () => void;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default SetFeatureHeightDialog;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
+
import { Button, Checkbox, DialogActions, DialogContent, FormControlLabel, TextField, Typography, } from '@mui/material';
|
|
5
|
+
import { observer } from 'mobx-react';
|
|
6
|
+
const SetFeatureHeightDialog = observer(function (props) {
|
|
7
|
+
const { model, handleClose } = props;
|
|
8
|
+
const { featureHeightSetting, noSpacing: noSpacingSetting } = model;
|
|
9
|
+
const [height, setHeight] = useState(`${featureHeightSetting}`);
|
|
10
|
+
const [noSpacing, setNoSpacing] = useState(noSpacingSetting);
|
|
11
|
+
const ok = height !== '' && !Number.isNaN(+height);
|
|
12
|
+
return (_jsx(Dialog, { open: true, onClose: handleClose, title: "Set feature height", children: _jsxs(DialogContent, { children: [_jsx(Typography, { children: "Adjust the feature height and whether there is any spacing between features. Setting feature height to 1 and removing spacing makes the display very compact." }), _jsx(TextField, { value: height, helperText: "Feature height", onChange: event => {
|
|
13
|
+
setHeight(event.target.value);
|
|
14
|
+
} }), _jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: !!noSpacing, onChange: () => {
|
|
15
|
+
setNoSpacing(val => !val);
|
|
16
|
+
} }), label: "Remove spacing between features in y-direction?" }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !ok, onClick: () => {
|
|
17
|
+
model.setFeatureHeight(height !== '' && !Number.isNaN(+height) ? +height : undefined);
|
|
18
|
+
model.setNoSpacing(noSpacing);
|
|
19
|
+
handleClose();
|
|
20
|
+
}, children: "Submit" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
21
|
+
handleClose();
|
|
22
|
+
}, children: "Cancel" })] })] }) }));
|
|
23
|
+
});
|
|
24
|
+
export default SetFeatureHeightDialog;
|
|
@@ -15,6 +15,13 @@ declare function configSchemaF(pluginManager: PluginManager): import("@jbrowse/c
|
|
|
15
15
|
type: string;
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
+
filterBy: {
|
|
19
|
+
type: string;
|
|
20
|
+
defaultValue: {
|
|
21
|
+
flagInclude: number;
|
|
22
|
+
flagExclude: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
18
25
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
19
26
|
renderer: import("mobx-state-tree").IAnyModelType;
|
|
20
27
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { linearBasicDisplayConfigSchemaFactory } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
+
import { defaultFilterFlags } from '../shared/util';
|
|
3
4
|
function configSchemaF(pluginManager) {
|
|
4
5
|
return ConfigurationSchema('LinearReadCloudDisplay', {
|
|
5
6
|
maxFeatureScreenDensity: {
|
|
@@ -15,6 +16,10 @@ function configSchemaF(pluginManager) {
|
|
|
15
16
|
type: 'frozen',
|
|
16
17
|
defaultValue: { type: 'insertSizeAndOrientation' },
|
|
17
18
|
},
|
|
19
|
+
filterBy: {
|
|
20
|
+
type: 'frozen',
|
|
21
|
+
defaultValue: defaultFilterFlags,
|
|
22
|
+
},
|
|
18
23
|
}, {
|
|
19
24
|
baseConfiguration: linearBasicDisplayConfigSchemaFactory(pluginManager),
|
|
20
25
|
explicitlyTyped: true,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { max, min } from '@jbrowse/core/util';
|
|
2
|
+
import { drawFeatsCommon } from './drawFeatsCommon';
|
|
3
|
+
function calculateCloudYOffsets(computedChains, self, _view, _featureHeight) {
|
|
4
|
+
const distances = computedChains.map(c => c.distance).filter(d => d > 0);
|
|
5
|
+
if (distances.length === 0) {
|
|
6
|
+
return { chainYOffsets: new Map() };
|
|
7
|
+
}
|
|
8
|
+
const logOffset = 10;
|
|
9
|
+
const maxD = Math.log(max(distances) + logOffset);
|
|
10
|
+
const minD = Math.log(min(distances) + logOffset);
|
|
11
|
+
const scaler = (self.height - 20) / (maxD - minD || 1);
|
|
12
|
+
const chainYOffsets = new Map();
|
|
13
|
+
for (const { id, distance } of computedChains) {
|
|
14
|
+
const top = distance > 0 ? (Math.log(distance + logOffset) - minD) * scaler : 0;
|
|
15
|
+
chainYOffsets.set(id, top);
|
|
16
|
+
}
|
|
17
|
+
return { chainYOffsets };
|
|
18
|
+
}
|
|
19
|
+
export function drawFeats(self, ctx) {
|
|
20
|
+
drawFeatsCommon(self, ctx, calculateCloudYOffsets);
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { LinearReadCloudDisplayModel } from './model';
|
|
2
|
+
import type { ChainData, ReducedFeature } from '../shared/fetchChains';
|
|
3
|
+
import type { FlatbushEntry } from '../shared/flatbushType';
|
|
4
|
+
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
5
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
6
|
+
type LGV = LinearGenomeViewModel;
|
|
7
|
+
export interface ComputedChain {
|
|
8
|
+
distance: number;
|
|
9
|
+
minX: number;
|
|
10
|
+
maxX: number;
|
|
11
|
+
chain: ReducedFeature[];
|
|
12
|
+
id: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function filterChains(chains: ReducedFeature[][], drawSingletons: boolean, drawProperPairs: boolean, type: string, chainData: ChainData): ReducedFeature[][];
|
|
15
|
+
export declare function computeChainBounds(chains: ReducedFeature[][], view: LGV, asm: Assembly): ComputedChain[];
|
|
16
|
+
export declare function sortComputedChains(computedChains: ComputedChain[]): void;
|
|
17
|
+
export declare function buildFlatbushIndex(featuresForFlatbush: FlatbushEntry[], self: LinearReadCloudDisplayModel): void;
|
|
18
|
+
export declare function addChainMouseoverRects(computedChains: ComputedChain[], chainYOffsets: Map<string, number>, featureHeight: number, view: LGV, featuresForFlatbush: FlatbushEntry[]): void;
|
|
19
|
+
export declare function drawFeatsCommon(self: LinearReadCloudDisplayModel, ctx: CanvasRenderingContext2D, calculateYOffsets: (computedChains: ComputedChain[], self: LinearReadCloudDisplayModel, view: LGV, featureHeight: number) => {
|
|
20
|
+
chainYOffsets: Map<string, number>;
|
|
21
|
+
layoutHeight?: number;
|
|
22
|
+
}): void;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { getConf } from '@jbrowse/core/configuration';
|
|
2
|
+
import { getContainingView, getSession } from '@jbrowse/core/util';
|
|
3
|
+
import Flatbush from '@jbrowse/core/util/flatbush';
|
|
4
|
+
import { PairType, getPairedType } from '../shared/color';
|
|
5
|
+
import { drawLongReadChains } from '../shared/drawLongReadChains';
|
|
6
|
+
import { drawPairChains } from '../shared/drawPairChains';
|
|
7
|
+
import { shouldRenderChevrons } from '../shared/util';
|
|
8
|
+
export function filterChains(chains, drawSingletons, drawProperPairs, type, chainData) {
|
|
9
|
+
const filtered = [];
|
|
10
|
+
for (const chain_ of chains) {
|
|
11
|
+
const chain = chain_;
|
|
12
|
+
if (!drawSingletons && chain.length === 1) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
let isPairedEnd = false;
|
|
16
|
+
for (const element of chain) {
|
|
17
|
+
if (element.flags & 1) {
|
|
18
|
+
isPairedEnd = true;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!drawProperPairs && isPairedEnd) {
|
|
23
|
+
const nonSupplementary = [];
|
|
24
|
+
for (const element of chain) {
|
|
25
|
+
if (!(element.flags & 2048)) {
|
|
26
|
+
nonSupplementary.push(element);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (nonSupplementary.length === 2) {
|
|
30
|
+
const v0 = nonSupplementary[0];
|
|
31
|
+
const v1 = nonSupplementary[1];
|
|
32
|
+
const pairType = getPairedType({
|
|
33
|
+
type,
|
|
34
|
+
f1: v0,
|
|
35
|
+
f2: v1,
|
|
36
|
+
stats: chainData.stats,
|
|
37
|
+
});
|
|
38
|
+
if (pairType === PairType.PROPER_PAIR) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
filtered.push(chain);
|
|
44
|
+
}
|
|
45
|
+
return filtered;
|
|
46
|
+
}
|
|
47
|
+
export function computeChainBounds(chains, view, asm) {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const computedChains = [];
|
|
50
|
+
for (const chain_ of chains) {
|
|
51
|
+
const chain = chain_;
|
|
52
|
+
let minX = Number.MAX_VALUE;
|
|
53
|
+
let maxX = Number.MIN_VALUE;
|
|
54
|
+
let chainId = '';
|
|
55
|
+
let tlenDistance = 0;
|
|
56
|
+
const chainLength = chain.length;
|
|
57
|
+
for (let j = 0; j < chainLength; j++) {
|
|
58
|
+
const elt = chain[j];
|
|
59
|
+
const refName = asm.getCanonicalRefName(elt.refName) || elt.refName;
|
|
60
|
+
const rs = (_a = view.bpToPx({ refName, coord: elt.start })) === null || _a === void 0 ? void 0 : _a.offsetPx;
|
|
61
|
+
const re = (_b = view.bpToPx({ refName, coord: elt.end })) === null || _b === void 0 ? void 0 : _b.offsetPx;
|
|
62
|
+
if (rs !== undefined && re !== undefined) {
|
|
63
|
+
minX = Math.min(minX, rs);
|
|
64
|
+
maxX = Math.max(maxX, re);
|
|
65
|
+
}
|
|
66
|
+
if (!chainId) {
|
|
67
|
+
chainId = elt.id;
|
|
68
|
+
}
|
|
69
|
+
if (chainLength > 1 && tlenDistance === 0 && elt.tlen) {
|
|
70
|
+
tlenDistance = Math.abs(elt.tlen);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const distance = tlenDistance > 0 ? tlenDistance : Math.abs(maxX - minX);
|
|
74
|
+
computedChains.push({
|
|
75
|
+
distance,
|
|
76
|
+
minX,
|
|
77
|
+
maxX,
|
|
78
|
+
chain,
|
|
79
|
+
id: chainId,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
return computedChains;
|
|
83
|
+
}
|
|
84
|
+
export function sortComputedChains(computedChains) {
|
|
85
|
+
computedChains.sort((a, b) => {
|
|
86
|
+
const aIsSingleton = a.chain.length === 1 ? 1 : 0;
|
|
87
|
+
const bIsSingleton = b.chain.length === 1 ? 1 : 0;
|
|
88
|
+
if (bIsSingleton !== aIsSingleton) {
|
|
89
|
+
return bIsSingleton - aIsSingleton;
|
|
90
|
+
}
|
|
91
|
+
return a.distance - b.distance;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export function buildFlatbushIndex(featuresForFlatbush, self) {
|
|
95
|
+
const finalFlatbush = new Flatbush(Math.max(featuresForFlatbush.length, 1));
|
|
96
|
+
const length = featuresForFlatbush.length;
|
|
97
|
+
if (length) {
|
|
98
|
+
for (let i = 0; i < length; i++) {
|
|
99
|
+
const { x1, y1, x2, y2 } = featuresForFlatbush[i];
|
|
100
|
+
finalFlatbush.add(x1, y1, x2, y2);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
finalFlatbush.add(0, 0);
|
|
105
|
+
}
|
|
106
|
+
finalFlatbush.finish();
|
|
107
|
+
self.setFeatureLayout(finalFlatbush);
|
|
108
|
+
self.setFeaturesForFlatbush(featuresForFlatbush);
|
|
109
|
+
}
|
|
110
|
+
export function addChainMouseoverRects(computedChains, chainYOffsets, featureHeight, view, featuresForFlatbush) {
|
|
111
|
+
for (const computedChain of computedChains) {
|
|
112
|
+
const { id, chain, minX, maxX } = computedChain;
|
|
113
|
+
const chainY = chainYOffsets.get(id);
|
|
114
|
+
if (chainY === undefined) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
const chainMinXPx = minX - view.offsetPx;
|
|
118
|
+
const chainMaxXPx = maxX - view.offsetPx;
|
|
119
|
+
if (chain.length > 0) {
|
|
120
|
+
featuresForFlatbush.push({
|
|
121
|
+
x1: chainMinXPx,
|
|
122
|
+
y1: chainY,
|
|
123
|
+
x2: chainMaxXPx,
|
|
124
|
+
y2: chainY + featureHeight,
|
|
125
|
+
data: chain[0],
|
|
126
|
+
chainId: id,
|
|
127
|
+
chainMinX: chainMinXPx,
|
|
128
|
+
chainMaxX: chainMaxXPx,
|
|
129
|
+
chain,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export function drawFeatsCommon(self, ctx, calculateYOffsets) {
|
|
135
|
+
var _a, _b;
|
|
136
|
+
const { chainData } = self;
|
|
137
|
+
if (!chainData) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
const { assemblyManager } = getSession(self);
|
|
141
|
+
const view = getContainingView(self);
|
|
142
|
+
const assemblyName = view.assemblyNames[0];
|
|
143
|
+
const asm = assemblyManager.get(assemblyName);
|
|
144
|
+
if (!asm) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const featureHeight = (_a = self.featureHeight) !== null && _a !== void 0 ? _a : getConf(self, 'featureHeight');
|
|
148
|
+
const type = ((_b = self.colorBy) === null || _b === void 0 ? void 0 : _b.type) || 'insertSizeAndOrientation';
|
|
149
|
+
const drawSingletons = self.drawSingletons;
|
|
150
|
+
const drawProperPairs = self.drawProperPairs;
|
|
151
|
+
const { chains } = chainData;
|
|
152
|
+
const filteredChains = filterChains(chains, drawSingletons, drawProperPairs, type, chainData);
|
|
153
|
+
const computedChains = computeChainBounds(filteredChains, view, asm);
|
|
154
|
+
sortComputedChains(computedChains);
|
|
155
|
+
const { chainYOffsets, layoutHeight } = calculateYOffsets(computedChains, self, view, featureHeight);
|
|
156
|
+
const featuresForFlatbush = [];
|
|
157
|
+
const renderChevrons = shouldRenderChevrons(view.bpPerPx, featureHeight);
|
|
158
|
+
drawPairChains({
|
|
159
|
+
ctx,
|
|
160
|
+
type,
|
|
161
|
+
chainData,
|
|
162
|
+
view,
|
|
163
|
+
asm,
|
|
164
|
+
chainYOffsets,
|
|
165
|
+
renderChevrons,
|
|
166
|
+
featureHeight,
|
|
167
|
+
featuresForFlatbush,
|
|
168
|
+
computedChains,
|
|
169
|
+
});
|
|
170
|
+
drawLongReadChains({
|
|
171
|
+
ctx,
|
|
172
|
+
chainData,
|
|
173
|
+
view,
|
|
174
|
+
asm,
|
|
175
|
+
chainYOffsets,
|
|
176
|
+
renderChevrons,
|
|
177
|
+
featureHeight,
|
|
178
|
+
featuresForFlatbush,
|
|
179
|
+
computedChains,
|
|
180
|
+
flipStrandLongReadChains: self.flipStrandLongReadChains,
|
|
181
|
+
});
|
|
182
|
+
addChainMouseoverRects(computedChains, chainYOffsets, featureHeight, view, featuresForFlatbush);
|
|
183
|
+
buildFlatbushIndex(featuresForFlatbush, self);
|
|
184
|
+
if (layoutHeight !== undefined) {
|
|
185
|
+
self.setLayoutHeight(layoutHeight);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import GranularRectLayout from '@jbrowse/core/util/layouts/GranularRectLayout';
|
|
2
|
+
import { drawFeatsCommon } from './drawFeatsCommon';
|
|
3
|
+
function calculateStackYOffsets(computedChains, self, _view, featureHeight) {
|
|
4
|
+
var _a, _b;
|
|
5
|
+
const noSpacing = (_a = self.noSpacing) !== null && _a !== void 0 ? _a : false;
|
|
6
|
+
const maxHeight = (_b = self.trackMaxHeight) !== null && _b !== void 0 ? _b : 1200;
|
|
7
|
+
const layout = new GranularRectLayout({
|
|
8
|
+
pitchX: 1,
|
|
9
|
+
pitchY: 1,
|
|
10
|
+
maxHeight,
|
|
11
|
+
});
|
|
12
|
+
const layoutPadding = noSpacing ? 0 : 1;
|
|
13
|
+
for (const { id, minX, maxX, chain } of computedChains) {
|
|
14
|
+
layout.addRect(id, minX, maxX, featureHeight + layoutPadding, {
|
|
15
|
+
feat: chain[0],
|
|
16
|
+
fill: 'transparent',
|
|
17
|
+
stroke: 'transparent',
|
|
18
|
+
distance: maxX - minX,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const chainYOffsets = new Map();
|
|
22
|
+
for (const [id, rect] of layout.getRectangles()) {
|
|
23
|
+
const top = rect[1];
|
|
24
|
+
chainYOffsets.set(id, top);
|
|
25
|
+
}
|
|
26
|
+
return { chainYOffsets, layoutHeight: layout.getTotalHeight() };
|
|
27
|
+
}
|
|
28
|
+
export function drawFeats(self, ctx) {
|
|
29
|
+
drawFeatsCommon(self, ctx, calculateStackYOffsets);
|
|
30
|
+
}
|
|
@@ -7,7 +7,7 @@ export default function register(pluginManager) {
|
|
|
7
7
|
const configSchema = configSchemaF(pluginManager);
|
|
8
8
|
return new DisplayType({
|
|
9
9
|
name: 'LinearReadCloudDisplay',
|
|
10
|
-
displayName: '
|
|
10
|
+
displayName: 'Linked reads display',
|
|
11
11
|
configSchema,
|
|
12
12
|
stateModel: stateModelF(configSchema),
|
|
13
13
|
trackType: 'AlignmentsTrack',
|