@jbrowse/plugin-alignments 2.6.2 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +2 -1
- package/dist/AlignmentsFeatureDetail/util.d.ts +1 -3
- package/dist/BamAdapter/BamAdapter.d.ts +2 -9
- package/dist/CramAdapter/CramAdapter.d.ts +3 -11
- package/dist/CramAdapter/CramAdapter.js +2 -1
- package/dist/CramAdapter/util.js +3 -6
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +3 -4
- package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +3 -3
- package/dist/LinearAlignmentsDisplay/models/model.d.ts +5 -9
- package/dist/LinearAlignmentsDisplay/models/model.js +1 -0
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +514 -0
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +547 -0
- package/dist/LinearPileupDisplay/components/ColorByModifications.d.ts +4 -5
- package/dist/LinearPileupDisplay/components/ColorByModifications.js +3 -4
- package/dist/LinearPileupDisplay/components/ColorByTag.d.ts +7 -5
- package/dist/LinearPileupDisplay/components/ColorByTag.js +4 -7
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +2 -2
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.d.ts +4 -5
- package/dist/LinearPileupDisplay/components/SetFeatureHeight.js +3 -3
- package/dist/LinearPileupDisplay/components/SetMaxHeight.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/SetMaxHeight.js +3 -3
- package/dist/LinearPileupDisplay/components/SortByTag.d.ts +3 -4
- package/dist/LinearPileupDisplay/components/SortByTag.js +3 -3
- package/dist/LinearPileupDisplay/index.d.ts +1 -0
- package/dist/LinearPileupDisplay/index.js +3 -1
- package/dist/LinearPileupDisplay/model.d.ts +142 -234
- package/dist/LinearPileupDisplay/model.js +50 -446
- package/dist/LinearReadArcsDisplay/components/ReactComponent.d.ts +2 -2
- package/dist/LinearReadArcsDisplay/components/ReactComponent.js +2 -1
- package/dist/LinearReadArcsDisplay/model.d.ts +9 -14
- package/dist/LinearReadCloudDisplay/components/ReactComponent.d.ts +2 -2
- package/dist/LinearReadCloudDisplay/components/ReactComponent.js +2 -1
- package/dist/LinearReadCloudDisplay/drawPairChains.js +1 -2
- package/dist/LinearReadCloudDisplay/model.d.ts +13 -15
- package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +18 -423
- package/dist/LinearSNPCoverageDisplay/models/model.js +18 -0
- package/dist/MismatchParser/index.js +6 -8
- package/dist/PileupRenderer/PileupRenderer.js +0 -25
- package/dist/PileupRenderer/colorBy.js +1 -1
- package/dist/PileupRenderer/components/PileupRendering.d.ts +9 -10
- package/dist/PileupRenderer/components/PileupRendering.js +3 -5
- package/dist/PileupRenderer/getAlignmentShapeColor.js +1 -1
- package/dist/PileupRenderer/layoutFeature.js +1 -2
- package/dist/PileupRenderer/makeImageData.d.ts +1 -3
- package/dist/PileupRenderer/renderMethylation.js +5 -10
- package/dist/PileupRenderer/renderMismatches.d.ts +2 -6
- package/dist/PileupRenderer/renderMismatches.js +8 -11
- package/dist/PileupRenderer/renderModifications.js +4 -8
- package/dist/PileupRenderer/renderSoftClipping.js +26 -25
- package/dist/PileupRenderer/sortUtil.js +2 -2
- package/dist/SNPCoverageAdapter/util.d.ts +9 -13
- package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +6 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/shared/BaseDisplayComponent.d.ts +2 -2
- package/dist/shared/BaseDisplayComponent.js +2 -1
- package/dist/shared/FilterByTag.d.ts +6 -15
- package/dist/shared/FilterByTag.js +4 -6
- package/dist/shared/color.d.ts +10 -0
- package/dist/shared/color.js +7 -1
- package/dist/shared/fetchChains.js +1 -0
- package/dist/shared/index.d.ts +9 -0
- package/dist/util.d.ts +3 -9
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +2 -1
- package/esm/AlignmentsFeatureDetail/util.d.ts +1 -3
- package/esm/BamAdapter/BamAdapter.d.ts +2 -9
- package/esm/CramAdapter/CramAdapter.d.ts +3 -11
- package/esm/CramAdapter/CramAdapter.js +2 -1
- package/esm/CramAdapter/util.js +3 -6
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +3 -4
- package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.js +3 -3
- package/esm/LinearAlignmentsDisplay/models/model.d.ts +5 -9
- package/esm/LinearAlignmentsDisplay/models/model.js +1 -0
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +514 -0
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +517 -0
- package/esm/LinearPileupDisplay/components/ColorByModifications.d.ts +4 -5
- package/esm/LinearPileupDisplay/components/ColorByModifications.js +3 -4
- package/esm/LinearPileupDisplay/components/ColorByTag.d.ts +7 -5
- package/esm/LinearPileupDisplay/components/ColorByTag.js +4 -7
- package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +2 -2
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.d.ts +4 -5
- package/esm/LinearPileupDisplay/components/SetFeatureHeight.js +3 -3
- package/esm/LinearPileupDisplay/components/SetMaxHeight.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/SetMaxHeight.js +3 -3
- package/esm/LinearPileupDisplay/components/SortByTag.d.ts +3 -4
- package/esm/LinearPileupDisplay/components/SortByTag.js +3 -3
- package/esm/LinearPileupDisplay/index.d.ts +1 -0
- package/esm/LinearPileupDisplay/index.js +1 -0
- package/esm/LinearPileupDisplay/model.d.ts +142 -234
- package/esm/LinearPileupDisplay/model.js +51 -447
- package/esm/LinearReadArcsDisplay/components/ReactComponent.d.ts +2 -2
- package/esm/LinearReadArcsDisplay/components/ReactComponent.js +2 -1
- package/esm/LinearReadArcsDisplay/model.d.ts +9 -14
- package/esm/LinearReadCloudDisplay/components/ReactComponent.d.ts +2 -2
- package/esm/LinearReadCloudDisplay/components/ReactComponent.js +2 -1
- package/esm/LinearReadCloudDisplay/drawPairChains.js +1 -2
- package/esm/LinearReadCloudDisplay/model.d.ts +13 -15
- package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +18 -423
- package/esm/LinearSNPCoverageDisplay/models/model.js +18 -0
- package/esm/MismatchParser/index.js +6 -8
- package/esm/PileupRenderer/PileupRenderer.js +0 -2
- package/esm/PileupRenderer/colorBy.js +1 -1
- package/esm/PileupRenderer/components/PileupRendering.d.ts +9 -10
- package/esm/PileupRenderer/components/PileupRendering.js +3 -5
- package/esm/PileupRenderer/getAlignmentShapeColor.js +1 -1
- package/esm/PileupRenderer/layoutFeature.js +1 -2
- package/esm/PileupRenderer/makeImageData.d.ts +1 -3
- package/esm/PileupRenderer/renderMethylation.js +5 -10
- package/esm/PileupRenderer/renderMismatches.d.ts +2 -6
- package/esm/PileupRenderer/renderMismatches.js +8 -11
- package/esm/PileupRenderer/renderModifications.js +4 -8
- package/esm/PileupRenderer/renderSoftClipping.js +26 -25
- package/esm/PileupRenderer/sortUtil.js +2 -2
- package/esm/SNPCoverageAdapter/util.d.ts +9 -13
- package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +6 -12
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/shared/BaseDisplayComponent.d.ts +2 -2
- package/esm/shared/BaseDisplayComponent.js +3 -2
- package/esm/shared/FilterByTag.d.ts +6 -15
- package/esm/shared/FilterByTag.js +4 -6
- package/esm/shared/color.d.ts +10 -0
- package/esm/shared/color.js +6 -0
- package/esm/shared/fetchChains.js +1 -0
- package/esm/shared/index.d.ts +9 -0
- package/esm/util.d.ts +3 -9
- package/package.json +3 -4
|
@@ -27,37 +27,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = require("react");
|
|
30
|
-
const mobx_1 = require("mobx");
|
|
31
30
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
32
|
-
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
33
31
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
34
32
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
35
33
|
const util_1 = require("@jbrowse/core/util");
|
|
36
|
-
const
|
|
34
|
+
const shared_1 = require("../shared");
|
|
35
|
+
const util_2 = require("../util");
|
|
37
36
|
// icons
|
|
38
37
|
const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
39
|
-
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
40
|
-
const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
41
38
|
const Sort_1 = __importDefault(require("@mui/icons-material/Sort"));
|
|
42
|
-
const Palette_1 = __importDefault(require("@mui/icons-material/Palette"));
|
|
43
|
-
const ClearAll_1 = __importDefault(require("@mui/icons-material/ClearAll"));
|
|
44
39
|
// locals
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const util_2 = require("../util");
|
|
48
|
-
const util_3 = require("../util");
|
|
40
|
+
const SharedLinearPileupDisplayMixin_1 = require("./SharedLinearPileupDisplayMixin");
|
|
41
|
+
const mobx_1 = require("mobx");
|
|
49
42
|
// async
|
|
50
|
-
const FilterByTagDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../shared/FilterByTag'))));
|
|
51
|
-
const ColorByTagDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ColorByTag'))));
|
|
52
43
|
const SortByTagDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SortByTag'))));
|
|
53
|
-
const SetFeatureHeightDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetFeatureHeight'))));
|
|
54
|
-
const SetMaxHeightDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetMaxHeight'))));
|
|
55
44
|
const ModificationsDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ColorByModifications'))));
|
|
56
|
-
// using a map because it preserves order
|
|
57
|
-
const rendererTypes = new Map([
|
|
58
|
-
['pileup', 'PileupRenderer'],
|
|
59
|
-
['svg', 'SvgFeatureRenderer'],
|
|
60
|
-
]);
|
|
61
45
|
/**
|
|
62
46
|
* #stateModel LinearPileupDisplay
|
|
63
47
|
* #category display
|
|
@@ -65,7 +49,7 @@ const rendererTypes = new Map([
|
|
|
65
49
|
*/
|
|
66
50
|
function stateModelFactory(configSchema) {
|
|
67
51
|
return mobx_state_tree_1.types
|
|
68
|
-
.compose('LinearPileupDisplay',
|
|
52
|
+
.compose('LinearPileupDisplay', (0, SharedLinearPileupDisplayMixin_1.SharedLinearPileupDisplayMixin)(configSchema), mobx_state_tree_1.types.model({
|
|
69
53
|
/**
|
|
70
54
|
* #property
|
|
71
55
|
*/
|
|
@@ -78,22 +62,6 @@ function stateModelFactory(configSchema) {
|
|
|
78
62
|
* #property
|
|
79
63
|
*/
|
|
80
64
|
showSoftClipping: false,
|
|
81
|
-
/**
|
|
82
|
-
* #property
|
|
83
|
-
*/
|
|
84
|
-
featureHeight: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
85
|
-
/**
|
|
86
|
-
* #property
|
|
87
|
-
*/
|
|
88
|
-
noSpacing: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
89
|
-
/**
|
|
90
|
-
* #property
|
|
91
|
-
*/
|
|
92
|
-
fadeLikelihood: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
93
|
-
/**
|
|
94
|
-
* #property
|
|
95
|
-
*/
|
|
96
|
-
trackMaxHeight: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
97
65
|
/**
|
|
98
66
|
* #property
|
|
99
67
|
*/
|
|
@@ -108,140 +76,41 @@ function stateModelFactory(configSchema) {
|
|
|
108
76
|
refName: mobx_state_tree_1.types.string,
|
|
109
77
|
assemblyName: mobx_state_tree_1.types.string,
|
|
110
78
|
})),
|
|
111
|
-
/**
|
|
112
|
-
* #property
|
|
113
|
-
*/
|
|
114
|
-
colorBy: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.model({
|
|
115
|
-
type: mobx_state_tree_1.types.string,
|
|
116
|
-
tag: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
117
|
-
extra: mobx_state_tree_1.types.frozen(),
|
|
118
|
-
})),
|
|
119
|
-
/**
|
|
120
|
-
* #property
|
|
121
|
-
*/
|
|
122
|
-
filterBy: mobx_state_tree_1.types.optional(shared_1.FilterModel, {}),
|
|
123
79
|
}))
|
|
124
80
|
.volatile(() => ({
|
|
125
|
-
|
|
126
|
-
modificationTagMap: mobx_1.observable.map({}),
|
|
127
|
-
featureUnderMouseVolatile: undefined,
|
|
81
|
+
sortReady: false,
|
|
128
82
|
currSortBpPerPx: 0,
|
|
83
|
+
modificationTagMap: mobx_1.observable.map({}),
|
|
129
84
|
modificationsReady: false,
|
|
130
|
-
sortReady: false,
|
|
131
|
-
tagsReady: false,
|
|
132
|
-
}))
|
|
133
|
-
.views(self => ({
|
|
134
|
-
get autorunReady() {
|
|
135
|
-
const view = (0, util_1.getContainingView)(self);
|
|
136
|
-
return (view.initialized &&
|
|
137
|
-
self.featureDensityStatsReady &&
|
|
138
|
-
!self.regionTooLarge);
|
|
139
|
-
},
|
|
140
85
|
}))
|
|
141
86
|
.actions(self => ({
|
|
142
|
-
/**
|
|
143
|
-
* #action
|
|
144
|
-
*/
|
|
145
|
-
setModificationsReady(flag) {
|
|
146
|
-
self.modificationsReady = flag;
|
|
147
|
-
},
|
|
148
|
-
/**
|
|
149
|
-
* #action
|
|
150
|
-
*/
|
|
151
|
-
setTagsReady(flag) {
|
|
152
|
-
self.tagsReady = flag;
|
|
153
|
-
},
|
|
154
|
-
/**
|
|
155
|
-
* #action
|
|
156
|
-
*/
|
|
157
|
-
setSortReady(flag) {
|
|
158
|
-
self.sortReady = flag;
|
|
159
|
-
},
|
|
160
87
|
/**
|
|
161
88
|
* #action
|
|
162
89
|
*/
|
|
163
90
|
setCurrSortBpPerPx(n) {
|
|
164
91
|
self.currSortBpPerPx = n;
|
|
165
92
|
},
|
|
166
|
-
/**
|
|
167
|
-
* #action
|
|
168
|
-
*/
|
|
169
|
-
setMaxHeight(n) {
|
|
170
|
-
self.trackMaxHeight = n;
|
|
171
|
-
},
|
|
172
|
-
/**
|
|
173
|
-
* #action
|
|
174
|
-
*/
|
|
175
|
-
setFeatureHeight(n) {
|
|
176
|
-
self.featureHeight = n;
|
|
177
|
-
},
|
|
178
|
-
/**
|
|
179
|
-
* #action
|
|
180
|
-
*/
|
|
181
|
-
setNoSpacing(flag) {
|
|
182
|
-
self.noSpacing = flag;
|
|
183
|
-
},
|
|
184
|
-
/**
|
|
185
|
-
* #action
|
|
186
|
-
*/
|
|
187
|
-
setColorScheme(colorScheme) {
|
|
188
|
-
self.colorTagMap = mobx_1.observable.map({}); // clear existing mapping
|
|
189
|
-
self.colorBy = (0, mobx_state_tree_1.cast)(colorScheme);
|
|
190
|
-
self.tagsReady = false;
|
|
191
|
-
self.modificationsReady = false;
|
|
192
|
-
},
|
|
193
93
|
/**
|
|
194
94
|
* #action
|
|
195
95
|
*/
|
|
196
96
|
updateModificationColorMap(uniqueModifications) {
|
|
197
97
|
uniqueModifications.forEach(value => {
|
|
198
98
|
if (!self.modificationTagMap.has(value)) {
|
|
199
|
-
self.modificationTagMap.set(value, util_2.modificationColors[value] || (0,
|
|
99
|
+
self.modificationTagMap.set(value, util_2.modificationColors[value] || (0, util_2.randomColor)());
|
|
200
100
|
}
|
|
201
101
|
});
|
|
202
102
|
},
|
|
203
103
|
/**
|
|
204
104
|
* #action
|
|
205
105
|
*/
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// https://cran.r-project.org/web/packages/khroma/vignettes/tol.html
|
|
209
|
-
// e.g. "tol_light"
|
|
210
|
-
const colorPalette = [
|
|
211
|
-
'#BBCCEE',
|
|
212
|
-
'pink',
|
|
213
|
-
'#CCDDAA',
|
|
214
|
-
'#EEEEBB',
|
|
215
|
-
'#FFCCCC',
|
|
216
|
-
'lightblue',
|
|
217
|
-
'lightgreen',
|
|
218
|
-
'tan',
|
|
219
|
-
'#CCEEFF',
|
|
220
|
-
'lightsalmon',
|
|
221
|
-
];
|
|
222
|
-
uniqueTag.forEach(value => {
|
|
223
|
-
if (!self.colorTagMap.has(value)) {
|
|
224
|
-
const totalKeys = [...self.colorTagMap.keys()].length;
|
|
225
|
-
self.colorTagMap.set(value, colorPalette[totalKeys]);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
/**
|
|
230
|
-
* #action
|
|
231
|
-
*/
|
|
232
|
-
setFeatureUnderMouse(feat) {
|
|
233
|
-
self.featureUnderMouseVolatile = feat;
|
|
106
|
+
setModificationsReady(flag) {
|
|
107
|
+
self.modificationsReady = flag;
|
|
234
108
|
},
|
|
235
109
|
/**
|
|
236
110
|
* #action
|
|
237
111
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
241
|
-
const featureWidget = session.addWidget('AlignmentsFeatureWidget', 'alignmentFeature', { featureData: feature.toJSON(), view: (0, util_1.getContainingView)(self) });
|
|
242
|
-
session.showWidget(featureWidget);
|
|
243
|
-
}
|
|
244
|
-
session.setSelection(feature);
|
|
112
|
+
setSortReady(flag) {
|
|
113
|
+
self.sortReady = flag;
|
|
245
114
|
},
|
|
246
115
|
/**
|
|
247
116
|
* #action
|
|
@@ -249,16 +118,6 @@ function stateModelFactory(configSchema) {
|
|
|
249
118
|
clearSelected() {
|
|
250
119
|
self.sortedBy = undefined;
|
|
251
120
|
},
|
|
252
|
-
/**
|
|
253
|
-
* #action
|
|
254
|
-
* uses copy-to-clipboard and generates notification
|
|
255
|
-
*/
|
|
256
|
-
copyFeatureToClipboard(feature) {
|
|
257
|
-
const { uniqueId, ...rest } = feature.toJSON();
|
|
258
|
-
const session = (0, util_1.getSession)(self);
|
|
259
|
-
(0, copy_to_clipboard_1.default)(JSON.stringify(rest, null, 4));
|
|
260
|
-
session.notify('Copied to clipboard', 'success');
|
|
261
|
-
},
|
|
262
121
|
/**
|
|
263
122
|
* #action
|
|
264
123
|
*/
|
|
@@ -271,12 +130,6 @@ function stateModelFactory(configSchema) {
|
|
|
271
130
|
toggleMismatchAlpha() {
|
|
272
131
|
self.mismatchAlpha = !self.mismatchAlpha;
|
|
273
132
|
},
|
|
274
|
-
/**
|
|
275
|
-
* #action
|
|
276
|
-
*/
|
|
277
|
-
setConfig(conf) {
|
|
278
|
-
self.configuration = conf;
|
|
279
|
-
},
|
|
280
133
|
/**
|
|
281
134
|
* #action
|
|
282
135
|
*/
|
|
@@ -299,9 +152,6 @@ function stateModelFactory(configSchema) {
|
|
|
299
152
|
tag,
|
|
300
153
|
};
|
|
301
154
|
},
|
|
302
|
-
setFilterBy(filter) {
|
|
303
|
-
self.filterBy = (0, mobx_state_tree_1.cast)(filter);
|
|
304
|
-
},
|
|
305
155
|
}))
|
|
306
156
|
.actions(self => {
|
|
307
157
|
// resets the sort object and refresh whole display on reload
|
|
@@ -333,178 +183,52 @@ function stateModelFactory(configSchema) {
|
|
|
333
183
|
: {}),
|
|
334
184
|
}, (0, util_1.getEnv)(self));
|
|
335
185
|
},
|
|
336
|
-
}))
|
|
337
|
-
.views(self => ({
|
|
338
|
-
/**
|
|
339
|
-
* #getter
|
|
340
|
-
*/
|
|
341
|
-
get maxHeight() {
|
|
342
|
-
return (0, configuration_1.readConfObject)(self.rendererConfig, 'maxHeight');
|
|
343
|
-
},
|
|
344
|
-
/**
|
|
345
|
-
* #getter
|
|
346
|
-
*/
|
|
347
|
-
get featureHeightSetting() {
|
|
348
|
-
return (0, configuration_1.readConfObject)(self.rendererConfig, 'height');
|
|
349
|
-
},
|
|
350
|
-
/**
|
|
351
|
-
* #getter
|
|
352
|
-
*/
|
|
353
|
-
get mismatchAlphaSetting() {
|
|
354
|
-
return (0, configuration_1.readConfObject)(self.rendererConfig, 'mismatchAlpha');
|
|
355
|
-
},
|
|
356
|
-
/**
|
|
357
|
-
* #getter
|
|
358
|
-
*/
|
|
359
|
-
get featureUnderMouse() {
|
|
360
|
-
return self.featureUnderMouseVolatile;
|
|
361
|
-
},
|
|
362
|
-
/**
|
|
363
|
-
* #getter
|
|
364
|
-
*/
|
|
365
|
-
get renderReady() {
|
|
366
|
-
const view = (0, util_1.getContainingView)(self);
|
|
367
|
-
return (self.modificationsReady &&
|
|
368
|
-
self.tagsReady &&
|
|
369
|
-
self.currSortBpPerPx === view.bpPerPx);
|
|
370
|
-
},
|
|
371
186
|
}))
|
|
372
187
|
.views(self => {
|
|
373
|
-
const {
|
|
188
|
+
const { renderReady: superRenderReady } = self;
|
|
374
189
|
return {
|
|
375
190
|
/**
|
|
376
191
|
* #getter
|
|
377
192
|
*/
|
|
378
|
-
get
|
|
379
|
-
|
|
380
|
-
const rendererType = rendererTypes.get(viewName);
|
|
381
|
-
if (!rendererType) {
|
|
382
|
-
throw new Error(`unknown alignments view name ${viewName}`);
|
|
383
|
-
}
|
|
384
|
-
return rendererType;
|
|
385
|
-
},
|
|
386
|
-
/**
|
|
387
|
-
* #method
|
|
388
|
-
*/
|
|
389
|
-
contextMenuItems() {
|
|
390
|
-
const feat = self.contextMenuFeature;
|
|
391
|
-
return feat
|
|
392
|
-
? [
|
|
393
|
-
{
|
|
394
|
-
label: 'Open feature details',
|
|
395
|
-
icon: MenuOpen_1.default,
|
|
396
|
-
onClick: () => {
|
|
397
|
-
self.clearFeatureSelection();
|
|
398
|
-
if (feat) {
|
|
399
|
-
self.selectFeature(feat);
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
label: 'Copy info to clipboard',
|
|
405
|
-
icon: Icons_1.ContentCopy,
|
|
406
|
-
onClick: () => {
|
|
407
|
-
if (feat) {
|
|
408
|
-
self.copyFeatureToClipboard(feat);
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
},
|
|
412
|
-
]
|
|
413
|
-
: [];
|
|
193
|
+
get mismatchAlphaSetting() {
|
|
194
|
+
return (0, configuration_1.readConfObject)(self.rendererConfig, 'mismatchAlpha');
|
|
414
195
|
},
|
|
415
196
|
/**
|
|
416
197
|
* #getter
|
|
417
198
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
199
|
+
renderReady() {
|
|
200
|
+
const view = (0, util_1.getContainingView)(self);
|
|
201
|
+
return (self.modificationsReady &&
|
|
202
|
+
self.currSortBpPerPx === view.bpPerPx &&
|
|
203
|
+
superRenderReady());
|
|
420
204
|
},
|
|
205
|
+
};
|
|
206
|
+
})
|
|
207
|
+
.views(self => {
|
|
208
|
+
const { trackMenuItems: superTrackMenuItems, renderPropsPre: superRenderPropsPre, renderProps: superRenderProps, colorSchemeSubMenuItems: superColorSchemeSubMenuItems, } = self;
|
|
209
|
+
return {
|
|
421
210
|
/**
|
|
422
211
|
* #method
|
|
423
212
|
*/
|
|
424
213
|
renderPropsPre() {
|
|
425
|
-
const {
|
|
426
|
-
const superProps =
|
|
214
|
+
const { sortedBy, showSoftClipping, modificationTagMap } = self;
|
|
215
|
+
const superProps = superRenderPropsPre();
|
|
427
216
|
return {
|
|
428
217
|
...superProps,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
displayModel: self,
|
|
432
|
-
sortedBy: sortedBy ? (0, mobx_state_tree_1.getSnapshot)(sortedBy) : undefined,
|
|
433
|
-
colorBy: colorBy ? (0, mobx_state_tree_1.getSnapshot)(colorBy) : undefined,
|
|
434
|
-
filterBy: JSON.parse(JSON.stringify(filterBy)),
|
|
435
|
-
colorTagMap: Object.fromEntries(colorTagMap.toJSON()),
|
|
218
|
+
showSoftClip: showSoftClipping,
|
|
219
|
+
sortedBy,
|
|
436
220
|
modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),
|
|
437
|
-
showSoftClip: self.showSoftClipping,
|
|
438
|
-
config: self.rendererConfig,
|
|
439
|
-
async onFeatureClick(_, featureId) {
|
|
440
|
-
const session = (0, util_1.getSession)(self);
|
|
441
|
-
const { rpcManager } = session;
|
|
442
|
-
try {
|
|
443
|
-
const f = featureId || self.featureIdUnderMouse;
|
|
444
|
-
if (!f) {
|
|
445
|
-
self.clearFeatureSelection();
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
449
|
-
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
450
|
-
featureId: f,
|
|
451
|
-
sessionId,
|
|
452
|
-
layoutId: (0, util_1.getContainingView)(self).id,
|
|
453
|
-
rendererType: 'PileupRenderer',
|
|
454
|
-
}));
|
|
455
|
-
if (feature) {
|
|
456
|
-
self.selectFeature(new util_1.SimpleFeature(feature));
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
catch (e) {
|
|
461
|
-
console.error(e);
|
|
462
|
-
session.notify(`${e}`);
|
|
463
|
-
}
|
|
464
|
-
},
|
|
465
|
-
onClick() {
|
|
466
|
-
self.clearFeatureSelection();
|
|
467
|
-
},
|
|
468
|
-
// similar to click but opens a menu with further options
|
|
469
|
-
async onFeatureContextMenu(_, featureId) {
|
|
470
|
-
const session = (0, util_1.getSession)(self);
|
|
471
|
-
const { rpcManager } = session;
|
|
472
|
-
try {
|
|
473
|
-
const f = featureId || self.featureIdUnderMouse;
|
|
474
|
-
if (!f) {
|
|
475
|
-
self.clearFeatureSelection();
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
479
|
-
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
480
|
-
featureId: f,
|
|
481
|
-
sessionId,
|
|
482
|
-
layoutId: (0, util_1.getContainingView)(self).id,
|
|
483
|
-
rendererType: 'PileupRenderer',
|
|
484
|
-
}));
|
|
485
|
-
if (feature) {
|
|
486
|
-
self.setContextMenuFeature(new util_1.SimpleFeature(feature));
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
catch (e) {
|
|
491
|
-
console.error(e);
|
|
492
|
-
session.notify(`${e}`);
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
221
|
};
|
|
496
222
|
},
|
|
497
|
-
// renderProps and renderPropsPre are separated due to sortReady
|
|
498
|
-
// causing a infinite loop in the sort autorun, since the sort autorun
|
|
499
|
-
// uses renderProps
|
|
500
223
|
/**
|
|
501
224
|
* #method
|
|
502
225
|
*/
|
|
503
226
|
renderProps() {
|
|
504
|
-
const
|
|
227
|
+
const { sortReady } = self;
|
|
228
|
+
const result = superRenderProps();
|
|
505
229
|
return {
|
|
506
|
-
...
|
|
507
|
-
notReady:
|
|
230
|
+
...result,
|
|
231
|
+
notReady: result.notReady || !sortReady,
|
|
508
232
|
};
|
|
509
233
|
},
|
|
510
234
|
/**
|
|
@@ -553,32 +277,11 @@ function stateModelFactory(configSchema) {
|
|
|
553
277
|
},
|
|
554
278
|
{
|
|
555
279
|
label: 'Color scheme',
|
|
556
|
-
icon: Palette_1.default,
|
|
557
280
|
subMenu: [
|
|
558
|
-
{
|
|
559
|
-
label: 'Normal',
|
|
560
|
-
onClick: () => self.setColorScheme({ type: 'normal' }),
|
|
561
|
-
},
|
|
562
|
-
{
|
|
563
|
-
label: 'Mapping quality',
|
|
564
|
-
onClick: () => self.setColorScheme({ type: 'mappingQuality' }),
|
|
565
|
-
},
|
|
566
|
-
{
|
|
567
|
-
label: 'Strand',
|
|
568
|
-
onClick: () => self.setColorScheme({ type: 'strand' }),
|
|
569
|
-
},
|
|
570
281
|
{
|
|
571
282
|
label: 'Pair orientation',
|
|
572
283
|
onClick: () => self.setColorScheme({ type: 'pairOrientation' }),
|
|
573
284
|
},
|
|
574
|
-
{
|
|
575
|
-
label: 'Per-base quality',
|
|
576
|
-
onClick: () => self.setColorScheme({ type: 'perBaseQuality' }),
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
label: 'Per-base lettering',
|
|
580
|
-
onClick: () => self.setColorScheme({ type: 'perBaseLettering' }),
|
|
581
|
-
},
|
|
582
285
|
{
|
|
583
286
|
label: 'Modifications or methylation',
|
|
584
287
|
onClick: () => {
|
|
@@ -592,68 +295,9 @@ function stateModelFactory(configSchema) {
|
|
|
592
295
|
label: 'Insert size',
|
|
593
296
|
onClick: () => self.setColorScheme({ type: 'insertSize' }),
|
|
594
297
|
},
|
|
595
|
-
|
|
596
|
-
label: 'First-of-pair strand',
|
|
597
|
-
onClick: () => self.setColorScheme({ type: 'stranded' }),
|
|
598
|
-
},
|
|
599
|
-
{
|
|
600
|
-
label: 'Color by tag...',
|
|
601
|
-
onClick: () => {
|
|
602
|
-
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
603
|
-
ColorByTagDlg,
|
|
604
|
-
{ model: self, handleClose: doneCallback },
|
|
605
|
-
]);
|
|
606
|
-
},
|
|
607
|
-
},
|
|
298
|
+
...superColorSchemeSubMenuItems(),
|
|
608
299
|
],
|
|
609
300
|
},
|
|
610
|
-
{
|
|
611
|
-
label: 'Filter by',
|
|
612
|
-
icon: ClearAll_1.default,
|
|
613
|
-
onClick: () => {
|
|
614
|
-
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
615
|
-
FilterByTagDlg,
|
|
616
|
-
{ model: self, handleClose: doneCallback },
|
|
617
|
-
]);
|
|
618
|
-
},
|
|
619
|
-
},
|
|
620
|
-
{
|
|
621
|
-
label: 'Set feature height',
|
|
622
|
-
subMenu: [
|
|
623
|
-
{
|
|
624
|
-
label: 'Normal',
|
|
625
|
-
onClick: () => {
|
|
626
|
-
self.setFeatureHeight(7);
|
|
627
|
-
self.setNoSpacing(false);
|
|
628
|
-
},
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
label: 'Compact',
|
|
632
|
-
onClick: () => {
|
|
633
|
-
self.setFeatureHeight(2);
|
|
634
|
-
self.setNoSpacing(true);
|
|
635
|
-
},
|
|
636
|
-
},
|
|
637
|
-
{
|
|
638
|
-
label: 'Manually set height',
|
|
639
|
-
onClick: () => {
|
|
640
|
-
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
641
|
-
SetFeatureHeightDlg,
|
|
642
|
-
{ model: self, handleClose: doneCallback },
|
|
643
|
-
]);
|
|
644
|
-
},
|
|
645
|
-
},
|
|
646
|
-
],
|
|
647
|
-
},
|
|
648
|
-
{
|
|
649
|
-
label: 'Set max height',
|
|
650
|
-
onClick: () => {
|
|
651
|
-
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
652
|
-
SetMaxHeightDlg,
|
|
653
|
-
{ model: self, handleClose: doneCallback },
|
|
654
|
-
]);
|
|
655
|
-
},
|
|
656
|
-
},
|
|
657
301
|
{
|
|
658
302
|
label: 'Fade mismatches by quality',
|
|
659
303
|
type: 'checkbox',
|
|
@@ -671,36 +315,19 @@ function stateModelFactory(configSchema) {
|
|
|
671
315
|
if (!self.autorunReady) {
|
|
672
316
|
return;
|
|
673
317
|
}
|
|
674
|
-
const {
|
|
675
|
-
|
|
676
|
-
if (colorBy === null || colorBy === void 0 ? void 0 : colorBy.tag) {
|
|
677
|
-
const vals = await (0, shared_1.getUniqueTagValues)(self, colorBy, staticBlocks);
|
|
678
|
-
self.updateColorTagMap(vals);
|
|
679
|
-
}
|
|
680
|
-
self.setTagsReady(true);
|
|
318
|
+
const { bpPerPx } = view;
|
|
319
|
+
self.setCurrSortBpPerPx(bpPerPx);
|
|
681
320
|
}, { delay: 1000 });
|
|
682
|
-
(0, util_2.createAutorun)(self, async () => {
|
|
683
|
-
if (!self.autorunReady) {
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
const { parentTrack, colorBy } = self;
|
|
687
|
-
const { staticBlocks } = (0, util_1.getContainingView)(self);
|
|
688
|
-
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
689
|
-
const adapter = (0, configuration_1.getConf)(parentTrack, ['adapter']);
|
|
690
|
-
const vals = await (0, shared_1.getUniqueModificationValues)(self, adapter, colorBy, staticBlocks);
|
|
691
|
-
self.updateModificationColorMap(vals);
|
|
692
|
-
}
|
|
693
|
-
self.setModificationsReady(true);
|
|
694
|
-
});
|
|
695
321
|
(0, util_2.createAutorun)(self, async () => {
|
|
696
322
|
const { rpcManager } = (0, util_1.getSession)(self);
|
|
697
323
|
const view = (0, util_1.getContainingView)(self);
|
|
698
324
|
if (!self.autorunReady) {
|
|
699
325
|
return;
|
|
700
326
|
}
|
|
701
|
-
const { sortedBy, adapterConfig, rendererType } = self;
|
|
327
|
+
const { sortedBy, adapterConfig, rendererType, sortReady } = self;
|
|
702
328
|
const { bpPerPx } = view;
|
|
703
|
-
if (sortedBy
|
|
329
|
+
if (sortedBy &&
|
|
330
|
+
(!sortReady || self.currSortBpPerPx === view.bpPerPx)) {
|
|
704
331
|
const { pos, refName, assemblyName } = sortedBy;
|
|
705
332
|
// render just the sorted region first
|
|
706
333
|
// @ts-expect-error
|
|
@@ -725,42 +352,19 @@ function stateModelFactory(configSchema) {
|
|
|
725
352
|
self.setCurrSortBpPerPx(bpPerPx);
|
|
726
353
|
self.setSortReady(true);
|
|
727
354
|
}, { delay: 1000 });
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
732
|
-
var _a;
|
|
733
|
-
const session = (0, util_1.getSession)(self);
|
|
734
|
-
try {
|
|
735
|
-
const featureId = self.featureIdUnderMouse;
|
|
736
|
-
if (((_a = self.featureUnderMouse) === null || _a === void 0 ? void 0 : _a.id()) !== featureId) {
|
|
737
|
-
if (!featureId) {
|
|
738
|
-
self.setFeatureUnderMouse(undefined);
|
|
739
|
-
}
|
|
740
|
-
else {
|
|
741
|
-
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
742
|
-
const view = (0, util_1.getContainingView)(self);
|
|
743
|
-
const { feature } = (await session.rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
744
|
-
featureId,
|
|
745
|
-
sessionId,
|
|
746
|
-
layoutId: view.id,
|
|
747
|
-
rendererType: 'PileupRenderer',
|
|
748
|
-
}));
|
|
749
|
-
// check featureIdUnderMouse is still the same as the
|
|
750
|
-
// feature.id that was returned e.g. that the user hasn't
|
|
751
|
-
// moused over to a new position during the async operation
|
|
752
|
-
// above
|
|
753
|
-
if (self.featureIdUnderMouse === feature.uniqueId) {
|
|
754
|
-
self.setFeatureUnderMouse(new util_1.SimpleFeature(feature));
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
355
|
+
(0, util_2.createAutorun)(self, async () => {
|
|
356
|
+
if (!self.autorunReady) {
|
|
357
|
+
return;
|
|
758
358
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
359
|
+
const { parentTrack, colorBy } = self;
|
|
360
|
+
const { staticBlocks } = (0, util_1.getContainingView)(self);
|
|
361
|
+
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
362
|
+
const adapter = (0, configuration_1.getConf)(parentTrack, ['adapter']);
|
|
363
|
+
const vals = await (0, shared_1.getUniqueModificationValues)(self, adapter, colorBy, staticBlocks);
|
|
364
|
+
self.updateModificationColorMap(vals);
|
|
762
365
|
}
|
|
763
|
-
|
|
366
|
+
self.setModificationsReady(true);
|
|
367
|
+
});
|
|
764
368
|
},
|
|
765
369
|
}));
|
|
766
370
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearReadArcsDisplayModel } from '../model';
|
|
3
|
-
declare const
|
|
3
|
+
declare const LinearReadArcsReactComponent: ({ model, }: {
|
|
4
4
|
model: LinearReadArcsDisplayModel;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
|
-
export default
|
|
6
|
+
export default LinearReadArcsReactComponent;
|
|
@@ -42,7 +42,8 @@ const Arcs = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
|
42
42
|
// note: the position absolute below avoids scrollbar from appearing on track
|
|
43
43
|
return (react_1.default.createElement("canvas", { "data-testid": "arc-canvas", ref: cb, style: { width, height, position: 'absolute' }, width: width * 2, height: height * 2 }));
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
const LinearReadArcsReactComponent = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
46
46
|
return (react_1.default.createElement(BaseDisplayComponent_1.default, { model: model },
|
|
47
47
|
react_1.default.createElement(Arcs, { model: model })));
|
|
48
48
|
});
|
|
49
|
+
exports.default = LinearReadArcsReactComponent;
|