@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
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { cast, types, addDisposer, getSnapshot, } from 'mobx-state-tree';
|
|
4
|
-
import copy from 'copy-to-clipboard';
|
|
2
|
+
import { types } from 'mobx-state-tree';
|
|
5
3
|
import { ConfigurationReference, readConfObject, getConf, } from '@jbrowse/core/configuration';
|
|
6
4
|
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
7
|
-
import { getEnv, getSession,
|
|
8
|
-
import {
|
|
5
|
+
import { getEnv, getSession, getContainingView } from '@jbrowse/core/util';
|
|
6
|
+
import { getUniqueModificationValues } from '../shared';
|
|
7
|
+
import { createAutorun, randomColor, modificationColors } from '../util';
|
|
9
8
|
// icons
|
|
10
9
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
11
|
-
import { ContentCopy as ContentCopyIcon } from '@jbrowse/core/ui/Icons';
|
|
12
|
-
import MenuOpenIcon from '@mui/icons-material/MenuOpen';
|
|
13
10
|
import SortIcon from '@mui/icons-material/Sort';
|
|
14
|
-
import PaletteIcon from '@mui/icons-material/Palette';
|
|
15
|
-
import FilterListIcon from '@mui/icons-material/ClearAll';
|
|
16
11
|
// locals
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import { createAutorun, modificationColors } from '../util';
|
|
20
|
-
import { randomColor } from '../util';
|
|
12
|
+
import { SharedLinearPileupDisplayMixin } from './SharedLinearPileupDisplayMixin';
|
|
13
|
+
import { observable } from 'mobx';
|
|
21
14
|
// async
|
|
22
|
-
const FilterByTagDlg = lazy(() => import('../shared/FilterByTag'));
|
|
23
|
-
const ColorByTagDlg = lazy(() => import('./components/ColorByTag'));
|
|
24
15
|
const SortByTagDlg = lazy(() => import('./components/SortByTag'));
|
|
25
|
-
const SetFeatureHeightDlg = lazy(() => import('./components/SetFeatureHeight'));
|
|
26
|
-
const SetMaxHeightDlg = lazy(() => import('./components/SetMaxHeight'));
|
|
27
16
|
const ModificationsDlg = lazy(() => import('./components/ColorByModifications'));
|
|
28
|
-
// using a map because it preserves order
|
|
29
|
-
const rendererTypes = new Map([
|
|
30
|
-
['pileup', 'PileupRenderer'],
|
|
31
|
-
['svg', 'SvgFeatureRenderer'],
|
|
32
|
-
]);
|
|
33
17
|
/**
|
|
34
18
|
* #stateModel LinearPileupDisplay
|
|
35
19
|
* #category display
|
|
@@ -37,7 +21,7 @@ const rendererTypes = new Map([
|
|
|
37
21
|
*/
|
|
38
22
|
function stateModelFactory(configSchema) {
|
|
39
23
|
return types
|
|
40
|
-
.compose('LinearPileupDisplay',
|
|
24
|
+
.compose('LinearPileupDisplay', SharedLinearPileupDisplayMixin(configSchema), types.model({
|
|
41
25
|
/**
|
|
42
26
|
* #property
|
|
43
27
|
*/
|
|
@@ -50,22 +34,6 @@ function stateModelFactory(configSchema) {
|
|
|
50
34
|
* #property
|
|
51
35
|
*/
|
|
52
36
|
showSoftClipping: false,
|
|
53
|
-
/**
|
|
54
|
-
* #property
|
|
55
|
-
*/
|
|
56
|
-
featureHeight: types.maybe(types.number),
|
|
57
|
-
/**
|
|
58
|
-
* #property
|
|
59
|
-
*/
|
|
60
|
-
noSpacing: types.maybe(types.boolean),
|
|
61
|
-
/**
|
|
62
|
-
* #property
|
|
63
|
-
*/
|
|
64
|
-
fadeLikelihood: types.maybe(types.boolean),
|
|
65
|
-
/**
|
|
66
|
-
* #property
|
|
67
|
-
*/
|
|
68
|
-
trackMaxHeight: types.maybe(types.number),
|
|
69
37
|
/**
|
|
70
38
|
* #property
|
|
71
39
|
*/
|
|
@@ -80,88 +48,20 @@ function stateModelFactory(configSchema) {
|
|
|
80
48
|
refName: types.string,
|
|
81
49
|
assemblyName: types.string,
|
|
82
50
|
})),
|
|
83
|
-
/**
|
|
84
|
-
* #property
|
|
85
|
-
*/
|
|
86
|
-
colorBy: types.maybe(types.model({
|
|
87
|
-
type: types.string,
|
|
88
|
-
tag: types.maybe(types.string),
|
|
89
|
-
extra: types.frozen(),
|
|
90
|
-
})),
|
|
91
|
-
/**
|
|
92
|
-
* #property
|
|
93
|
-
*/
|
|
94
|
-
filterBy: types.optional(FilterModel, {}),
|
|
95
51
|
}))
|
|
96
52
|
.volatile(() => ({
|
|
97
|
-
|
|
98
|
-
modificationTagMap: observable.map({}),
|
|
99
|
-
featureUnderMouseVolatile: undefined,
|
|
53
|
+
sortReady: false,
|
|
100
54
|
currSortBpPerPx: 0,
|
|
55
|
+
modificationTagMap: observable.map({}),
|
|
101
56
|
modificationsReady: false,
|
|
102
|
-
sortReady: false,
|
|
103
|
-
tagsReady: false,
|
|
104
|
-
}))
|
|
105
|
-
.views(self => ({
|
|
106
|
-
get autorunReady() {
|
|
107
|
-
const view = getContainingView(self);
|
|
108
|
-
return (view.initialized &&
|
|
109
|
-
self.featureDensityStatsReady &&
|
|
110
|
-
!self.regionTooLarge);
|
|
111
|
-
},
|
|
112
57
|
}))
|
|
113
58
|
.actions(self => ({
|
|
114
|
-
/**
|
|
115
|
-
* #action
|
|
116
|
-
*/
|
|
117
|
-
setModificationsReady(flag) {
|
|
118
|
-
self.modificationsReady = flag;
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* #action
|
|
122
|
-
*/
|
|
123
|
-
setTagsReady(flag) {
|
|
124
|
-
self.tagsReady = flag;
|
|
125
|
-
},
|
|
126
|
-
/**
|
|
127
|
-
* #action
|
|
128
|
-
*/
|
|
129
|
-
setSortReady(flag) {
|
|
130
|
-
self.sortReady = flag;
|
|
131
|
-
},
|
|
132
59
|
/**
|
|
133
60
|
* #action
|
|
134
61
|
*/
|
|
135
62
|
setCurrSortBpPerPx(n) {
|
|
136
63
|
self.currSortBpPerPx = n;
|
|
137
64
|
},
|
|
138
|
-
/**
|
|
139
|
-
* #action
|
|
140
|
-
*/
|
|
141
|
-
setMaxHeight(n) {
|
|
142
|
-
self.trackMaxHeight = n;
|
|
143
|
-
},
|
|
144
|
-
/**
|
|
145
|
-
* #action
|
|
146
|
-
*/
|
|
147
|
-
setFeatureHeight(n) {
|
|
148
|
-
self.featureHeight = n;
|
|
149
|
-
},
|
|
150
|
-
/**
|
|
151
|
-
* #action
|
|
152
|
-
*/
|
|
153
|
-
setNoSpacing(flag) {
|
|
154
|
-
self.noSpacing = flag;
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* #action
|
|
158
|
-
*/
|
|
159
|
-
setColorScheme(colorScheme) {
|
|
160
|
-
self.colorTagMap = observable.map({}); // clear existing mapping
|
|
161
|
-
self.colorBy = cast(colorScheme);
|
|
162
|
-
self.tagsReady = false;
|
|
163
|
-
self.modificationsReady = false;
|
|
164
|
-
},
|
|
165
65
|
/**
|
|
166
66
|
* #action
|
|
167
67
|
*/
|
|
@@ -175,45 +75,14 @@ function stateModelFactory(configSchema) {
|
|
|
175
75
|
/**
|
|
176
76
|
* #action
|
|
177
77
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// https://cran.r-project.org/web/packages/khroma/vignettes/tol.html
|
|
181
|
-
// e.g. "tol_light"
|
|
182
|
-
const colorPalette = [
|
|
183
|
-
'#BBCCEE',
|
|
184
|
-
'pink',
|
|
185
|
-
'#CCDDAA',
|
|
186
|
-
'#EEEEBB',
|
|
187
|
-
'#FFCCCC',
|
|
188
|
-
'lightblue',
|
|
189
|
-
'lightgreen',
|
|
190
|
-
'tan',
|
|
191
|
-
'#CCEEFF',
|
|
192
|
-
'lightsalmon',
|
|
193
|
-
];
|
|
194
|
-
uniqueTag.forEach(value => {
|
|
195
|
-
if (!self.colorTagMap.has(value)) {
|
|
196
|
-
const totalKeys = [...self.colorTagMap.keys()].length;
|
|
197
|
-
self.colorTagMap.set(value, colorPalette[totalKeys]);
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* #action
|
|
203
|
-
*/
|
|
204
|
-
setFeatureUnderMouse(feat) {
|
|
205
|
-
self.featureUnderMouseVolatile = feat;
|
|
78
|
+
setModificationsReady(flag) {
|
|
79
|
+
self.modificationsReady = flag;
|
|
206
80
|
},
|
|
207
81
|
/**
|
|
208
82
|
* #action
|
|
209
83
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (isSessionModelWithWidgets(session)) {
|
|
213
|
-
const featureWidget = session.addWidget('AlignmentsFeatureWidget', 'alignmentFeature', { featureData: feature.toJSON(), view: getContainingView(self) });
|
|
214
|
-
session.showWidget(featureWidget);
|
|
215
|
-
}
|
|
216
|
-
session.setSelection(feature);
|
|
84
|
+
setSortReady(flag) {
|
|
85
|
+
self.sortReady = flag;
|
|
217
86
|
},
|
|
218
87
|
/**
|
|
219
88
|
* #action
|
|
@@ -221,16 +90,6 @@ function stateModelFactory(configSchema) {
|
|
|
221
90
|
clearSelected() {
|
|
222
91
|
self.sortedBy = undefined;
|
|
223
92
|
},
|
|
224
|
-
/**
|
|
225
|
-
* #action
|
|
226
|
-
* uses copy-to-clipboard and generates notification
|
|
227
|
-
*/
|
|
228
|
-
copyFeatureToClipboard(feature) {
|
|
229
|
-
const { uniqueId, ...rest } = feature.toJSON();
|
|
230
|
-
const session = getSession(self);
|
|
231
|
-
copy(JSON.stringify(rest, null, 4));
|
|
232
|
-
session.notify('Copied to clipboard', 'success');
|
|
233
|
-
},
|
|
234
93
|
/**
|
|
235
94
|
* #action
|
|
236
95
|
*/
|
|
@@ -243,12 +102,6 @@ function stateModelFactory(configSchema) {
|
|
|
243
102
|
toggleMismatchAlpha() {
|
|
244
103
|
self.mismatchAlpha = !self.mismatchAlpha;
|
|
245
104
|
},
|
|
246
|
-
/**
|
|
247
|
-
* #action
|
|
248
|
-
*/
|
|
249
|
-
setConfig(conf) {
|
|
250
|
-
self.configuration = conf;
|
|
251
|
-
},
|
|
252
105
|
/**
|
|
253
106
|
* #action
|
|
254
107
|
*/
|
|
@@ -271,9 +124,6 @@ function stateModelFactory(configSchema) {
|
|
|
271
124
|
tag,
|
|
272
125
|
};
|
|
273
126
|
},
|
|
274
|
-
setFilterBy(filter) {
|
|
275
|
-
self.filterBy = cast(filter);
|
|
276
|
-
},
|
|
277
127
|
}))
|
|
278
128
|
.actions(self => {
|
|
279
129
|
// resets the sort object and refresh whole display on reload
|
|
@@ -305,178 +155,52 @@ function stateModelFactory(configSchema) {
|
|
|
305
155
|
: {}),
|
|
306
156
|
}, getEnv(self));
|
|
307
157
|
},
|
|
308
|
-
}))
|
|
309
|
-
.views(self => ({
|
|
310
|
-
/**
|
|
311
|
-
* #getter
|
|
312
|
-
*/
|
|
313
|
-
get maxHeight() {
|
|
314
|
-
return readConfObject(self.rendererConfig, 'maxHeight');
|
|
315
|
-
},
|
|
316
|
-
/**
|
|
317
|
-
* #getter
|
|
318
|
-
*/
|
|
319
|
-
get featureHeightSetting() {
|
|
320
|
-
return readConfObject(self.rendererConfig, 'height');
|
|
321
|
-
},
|
|
322
|
-
/**
|
|
323
|
-
* #getter
|
|
324
|
-
*/
|
|
325
|
-
get mismatchAlphaSetting() {
|
|
326
|
-
return readConfObject(self.rendererConfig, 'mismatchAlpha');
|
|
327
|
-
},
|
|
328
|
-
/**
|
|
329
|
-
* #getter
|
|
330
|
-
*/
|
|
331
|
-
get featureUnderMouse() {
|
|
332
|
-
return self.featureUnderMouseVolatile;
|
|
333
|
-
},
|
|
334
|
-
/**
|
|
335
|
-
* #getter
|
|
336
|
-
*/
|
|
337
|
-
get renderReady() {
|
|
338
|
-
const view = getContainingView(self);
|
|
339
|
-
return (self.modificationsReady &&
|
|
340
|
-
self.tagsReady &&
|
|
341
|
-
self.currSortBpPerPx === view.bpPerPx);
|
|
342
|
-
},
|
|
343
158
|
}))
|
|
344
159
|
.views(self => {
|
|
345
|
-
const {
|
|
160
|
+
const { renderReady: superRenderReady } = self;
|
|
346
161
|
return {
|
|
347
162
|
/**
|
|
348
163
|
* #getter
|
|
349
164
|
*/
|
|
350
|
-
get
|
|
351
|
-
|
|
352
|
-
const rendererType = rendererTypes.get(viewName);
|
|
353
|
-
if (!rendererType) {
|
|
354
|
-
throw new Error(`unknown alignments view name ${viewName}`);
|
|
355
|
-
}
|
|
356
|
-
return rendererType;
|
|
357
|
-
},
|
|
358
|
-
/**
|
|
359
|
-
* #method
|
|
360
|
-
*/
|
|
361
|
-
contextMenuItems() {
|
|
362
|
-
const feat = self.contextMenuFeature;
|
|
363
|
-
return feat
|
|
364
|
-
? [
|
|
365
|
-
{
|
|
366
|
-
label: 'Open feature details',
|
|
367
|
-
icon: MenuOpenIcon,
|
|
368
|
-
onClick: () => {
|
|
369
|
-
self.clearFeatureSelection();
|
|
370
|
-
if (feat) {
|
|
371
|
-
self.selectFeature(feat);
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
label: 'Copy info to clipboard',
|
|
377
|
-
icon: ContentCopyIcon,
|
|
378
|
-
onClick: () => {
|
|
379
|
-
if (feat) {
|
|
380
|
-
self.copyFeatureToClipboard(feat);
|
|
381
|
-
}
|
|
382
|
-
},
|
|
383
|
-
},
|
|
384
|
-
]
|
|
385
|
-
: [];
|
|
165
|
+
get mismatchAlphaSetting() {
|
|
166
|
+
return readConfObject(self.rendererConfig, 'mismatchAlpha');
|
|
386
167
|
},
|
|
387
168
|
/**
|
|
388
169
|
* #getter
|
|
389
170
|
*/
|
|
390
|
-
|
|
391
|
-
|
|
171
|
+
renderReady() {
|
|
172
|
+
const view = getContainingView(self);
|
|
173
|
+
return (self.modificationsReady &&
|
|
174
|
+
self.currSortBpPerPx === view.bpPerPx &&
|
|
175
|
+
superRenderReady());
|
|
392
176
|
},
|
|
177
|
+
};
|
|
178
|
+
})
|
|
179
|
+
.views(self => {
|
|
180
|
+
const { trackMenuItems: superTrackMenuItems, renderPropsPre: superRenderPropsPre, renderProps: superRenderProps, colorSchemeSubMenuItems: superColorSchemeSubMenuItems, } = self;
|
|
181
|
+
return {
|
|
393
182
|
/**
|
|
394
183
|
* #method
|
|
395
184
|
*/
|
|
396
185
|
renderPropsPre() {
|
|
397
|
-
const {
|
|
398
|
-
const superProps =
|
|
186
|
+
const { sortedBy, showSoftClipping, modificationTagMap } = self;
|
|
187
|
+
const superProps = superRenderPropsPre();
|
|
399
188
|
return {
|
|
400
189
|
...superProps,
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
displayModel: self,
|
|
404
|
-
sortedBy: sortedBy ? getSnapshot(sortedBy) : undefined,
|
|
405
|
-
colorBy: colorBy ? getSnapshot(colorBy) : undefined,
|
|
406
|
-
filterBy: JSON.parse(JSON.stringify(filterBy)),
|
|
407
|
-
colorTagMap: Object.fromEntries(colorTagMap.toJSON()),
|
|
190
|
+
showSoftClip: showSoftClipping,
|
|
191
|
+
sortedBy,
|
|
408
192
|
modificationTagMap: Object.fromEntries(modificationTagMap.toJSON()),
|
|
409
|
-
showSoftClip: self.showSoftClipping,
|
|
410
|
-
config: self.rendererConfig,
|
|
411
|
-
async onFeatureClick(_, featureId) {
|
|
412
|
-
const session = getSession(self);
|
|
413
|
-
const { rpcManager } = session;
|
|
414
|
-
try {
|
|
415
|
-
const f = featureId || self.featureIdUnderMouse;
|
|
416
|
-
if (!f) {
|
|
417
|
-
self.clearFeatureSelection();
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
const sessionId = getRpcSessionId(self);
|
|
421
|
-
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
422
|
-
featureId: f,
|
|
423
|
-
sessionId,
|
|
424
|
-
layoutId: getContainingView(self).id,
|
|
425
|
-
rendererType: 'PileupRenderer',
|
|
426
|
-
}));
|
|
427
|
-
if (feature) {
|
|
428
|
-
self.selectFeature(new SimpleFeature(feature));
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
catch (e) {
|
|
433
|
-
console.error(e);
|
|
434
|
-
session.notify(`${e}`);
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
onClick() {
|
|
438
|
-
self.clearFeatureSelection();
|
|
439
|
-
},
|
|
440
|
-
// similar to click but opens a menu with further options
|
|
441
|
-
async onFeatureContextMenu(_, featureId) {
|
|
442
|
-
const session = getSession(self);
|
|
443
|
-
const { rpcManager } = session;
|
|
444
|
-
try {
|
|
445
|
-
const f = featureId || self.featureIdUnderMouse;
|
|
446
|
-
if (!f) {
|
|
447
|
-
self.clearFeatureSelection();
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
const sessionId = getRpcSessionId(self);
|
|
451
|
-
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
452
|
-
featureId: f,
|
|
453
|
-
sessionId,
|
|
454
|
-
layoutId: getContainingView(self).id,
|
|
455
|
-
rendererType: 'PileupRenderer',
|
|
456
|
-
}));
|
|
457
|
-
if (feature) {
|
|
458
|
-
self.setContextMenuFeature(new SimpleFeature(feature));
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
catch (e) {
|
|
463
|
-
console.error(e);
|
|
464
|
-
session.notify(`${e}`);
|
|
465
|
-
}
|
|
466
|
-
},
|
|
467
193
|
};
|
|
468
194
|
},
|
|
469
|
-
// renderProps and renderPropsPre are separated due to sortReady
|
|
470
|
-
// causing a infinite loop in the sort autorun, since the sort autorun
|
|
471
|
-
// uses renderProps
|
|
472
195
|
/**
|
|
473
196
|
* #method
|
|
474
197
|
*/
|
|
475
198
|
renderProps() {
|
|
476
|
-
const
|
|
199
|
+
const { sortReady } = self;
|
|
200
|
+
const result = superRenderProps();
|
|
477
201
|
return {
|
|
478
|
-
...
|
|
479
|
-
notReady:
|
|
202
|
+
...result,
|
|
203
|
+
notReady: result.notReady || !sortReady,
|
|
480
204
|
};
|
|
481
205
|
},
|
|
482
206
|
/**
|
|
@@ -525,32 +249,11 @@ function stateModelFactory(configSchema) {
|
|
|
525
249
|
},
|
|
526
250
|
{
|
|
527
251
|
label: 'Color scheme',
|
|
528
|
-
icon: PaletteIcon,
|
|
529
252
|
subMenu: [
|
|
530
|
-
{
|
|
531
|
-
label: 'Normal',
|
|
532
|
-
onClick: () => self.setColorScheme({ type: 'normal' }),
|
|
533
|
-
},
|
|
534
|
-
{
|
|
535
|
-
label: 'Mapping quality',
|
|
536
|
-
onClick: () => self.setColorScheme({ type: 'mappingQuality' }),
|
|
537
|
-
},
|
|
538
|
-
{
|
|
539
|
-
label: 'Strand',
|
|
540
|
-
onClick: () => self.setColorScheme({ type: 'strand' }),
|
|
541
|
-
},
|
|
542
253
|
{
|
|
543
254
|
label: 'Pair orientation',
|
|
544
255
|
onClick: () => self.setColorScheme({ type: 'pairOrientation' }),
|
|
545
256
|
},
|
|
546
|
-
{
|
|
547
|
-
label: 'Per-base quality',
|
|
548
|
-
onClick: () => self.setColorScheme({ type: 'perBaseQuality' }),
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
label: 'Per-base lettering',
|
|
552
|
-
onClick: () => self.setColorScheme({ type: 'perBaseLettering' }),
|
|
553
|
-
},
|
|
554
257
|
{
|
|
555
258
|
label: 'Modifications or methylation',
|
|
556
259
|
onClick: () => {
|
|
@@ -564,68 +267,9 @@ function stateModelFactory(configSchema) {
|
|
|
564
267
|
label: 'Insert size',
|
|
565
268
|
onClick: () => self.setColorScheme({ type: 'insertSize' }),
|
|
566
269
|
},
|
|
567
|
-
|
|
568
|
-
label: 'First-of-pair strand',
|
|
569
|
-
onClick: () => self.setColorScheme({ type: 'stranded' }),
|
|
570
|
-
},
|
|
571
|
-
{
|
|
572
|
-
label: 'Color by tag...',
|
|
573
|
-
onClick: () => {
|
|
574
|
-
getSession(self).queueDialog(doneCallback => [
|
|
575
|
-
ColorByTagDlg,
|
|
576
|
-
{ model: self, handleClose: doneCallback },
|
|
577
|
-
]);
|
|
578
|
-
},
|
|
579
|
-
},
|
|
580
|
-
],
|
|
581
|
-
},
|
|
582
|
-
{
|
|
583
|
-
label: 'Filter by',
|
|
584
|
-
icon: FilterListIcon,
|
|
585
|
-
onClick: () => {
|
|
586
|
-
getSession(self).queueDialog(doneCallback => [
|
|
587
|
-
FilterByTagDlg,
|
|
588
|
-
{ model: self, handleClose: doneCallback },
|
|
589
|
-
]);
|
|
590
|
-
},
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
label: 'Set feature height',
|
|
594
|
-
subMenu: [
|
|
595
|
-
{
|
|
596
|
-
label: 'Normal',
|
|
597
|
-
onClick: () => {
|
|
598
|
-
self.setFeatureHeight(7);
|
|
599
|
-
self.setNoSpacing(false);
|
|
600
|
-
},
|
|
601
|
-
},
|
|
602
|
-
{
|
|
603
|
-
label: 'Compact',
|
|
604
|
-
onClick: () => {
|
|
605
|
-
self.setFeatureHeight(2);
|
|
606
|
-
self.setNoSpacing(true);
|
|
607
|
-
},
|
|
608
|
-
},
|
|
609
|
-
{
|
|
610
|
-
label: 'Manually set height',
|
|
611
|
-
onClick: () => {
|
|
612
|
-
getSession(self).queueDialog(doneCallback => [
|
|
613
|
-
SetFeatureHeightDlg,
|
|
614
|
-
{ model: self, handleClose: doneCallback },
|
|
615
|
-
]);
|
|
616
|
-
},
|
|
617
|
-
},
|
|
270
|
+
...superColorSchemeSubMenuItems(),
|
|
618
271
|
],
|
|
619
272
|
},
|
|
620
|
-
{
|
|
621
|
-
label: 'Set max height',
|
|
622
|
-
onClick: () => {
|
|
623
|
-
getSession(self).queueDialog(doneCallback => [
|
|
624
|
-
SetMaxHeightDlg,
|
|
625
|
-
{ model: self, handleClose: doneCallback },
|
|
626
|
-
]);
|
|
627
|
-
},
|
|
628
|
-
},
|
|
629
273
|
{
|
|
630
274
|
label: 'Fade mismatches by quality',
|
|
631
275
|
type: 'checkbox',
|
|
@@ -643,36 +287,19 @@ function stateModelFactory(configSchema) {
|
|
|
643
287
|
if (!self.autorunReady) {
|
|
644
288
|
return;
|
|
645
289
|
}
|
|
646
|
-
const {
|
|
647
|
-
|
|
648
|
-
if (colorBy === null || colorBy === void 0 ? void 0 : colorBy.tag) {
|
|
649
|
-
const vals = await getUniqueTagValues(self, colorBy, staticBlocks);
|
|
650
|
-
self.updateColorTagMap(vals);
|
|
651
|
-
}
|
|
652
|
-
self.setTagsReady(true);
|
|
290
|
+
const { bpPerPx } = view;
|
|
291
|
+
self.setCurrSortBpPerPx(bpPerPx);
|
|
653
292
|
}, { delay: 1000 });
|
|
654
|
-
createAutorun(self, async () => {
|
|
655
|
-
if (!self.autorunReady) {
|
|
656
|
-
return;
|
|
657
|
-
}
|
|
658
|
-
const { parentTrack, colorBy } = self;
|
|
659
|
-
const { staticBlocks } = getContainingView(self);
|
|
660
|
-
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
661
|
-
const adapter = getConf(parentTrack, ['adapter']);
|
|
662
|
-
const vals = await getUniqueModificationValues(self, adapter, colorBy, staticBlocks);
|
|
663
|
-
self.updateModificationColorMap(vals);
|
|
664
|
-
}
|
|
665
|
-
self.setModificationsReady(true);
|
|
666
|
-
});
|
|
667
293
|
createAutorun(self, async () => {
|
|
668
294
|
const { rpcManager } = getSession(self);
|
|
669
295
|
const view = getContainingView(self);
|
|
670
296
|
if (!self.autorunReady) {
|
|
671
297
|
return;
|
|
672
298
|
}
|
|
673
|
-
const { sortedBy, adapterConfig, rendererType } = self;
|
|
299
|
+
const { sortedBy, adapterConfig, rendererType, sortReady } = self;
|
|
674
300
|
const { bpPerPx } = view;
|
|
675
|
-
if (sortedBy
|
|
301
|
+
if (sortedBy &&
|
|
302
|
+
(!sortReady || self.currSortBpPerPx === view.bpPerPx)) {
|
|
676
303
|
const { pos, refName, assemblyName } = sortedBy;
|
|
677
304
|
// render just the sorted region first
|
|
678
305
|
// @ts-expect-error
|
|
@@ -697,42 +324,19 @@ function stateModelFactory(configSchema) {
|
|
|
697
324
|
self.setCurrSortBpPerPx(bpPerPx);
|
|
698
325
|
self.setSortReady(true);
|
|
699
326
|
}, { delay: 1000 });
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
addDisposer(self, autorun(async () => {
|
|
704
|
-
var _a;
|
|
705
|
-
const session = getSession(self);
|
|
706
|
-
try {
|
|
707
|
-
const featureId = self.featureIdUnderMouse;
|
|
708
|
-
if (((_a = self.featureUnderMouse) === null || _a === void 0 ? void 0 : _a.id()) !== featureId) {
|
|
709
|
-
if (!featureId) {
|
|
710
|
-
self.setFeatureUnderMouse(undefined);
|
|
711
|
-
}
|
|
712
|
-
else {
|
|
713
|
-
const sessionId = getRpcSessionId(self);
|
|
714
|
-
const view = getContainingView(self);
|
|
715
|
-
const { feature } = (await session.rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
716
|
-
featureId,
|
|
717
|
-
sessionId,
|
|
718
|
-
layoutId: view.id,
|
|
719
|
-
rendererType: 'PileupRenderer',
|
|
720
|
-
}));
|
|
721
|
-
// check featureIdUnderMouse is still the same as the
|
|
722
|
-
// feature.id that was returned e.g. that the user hasn't
|
|
723
|
-
// moused over to a new position during the async operation
|
|
724
|
-
// above
|
|
725
|
-
if (self.featureIdUnderMouse === feature.uniqueId) {
|
|
726
|
-
self.setFeatureUnderMouse(new SimpleFeature(feature));
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
327
|
+
createAutorun(self, async () => {
|
|
328
|
+
if (!self.autorunReady) {
|
|
329
|
+
return;
|
|
730
330
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
331
|
+
const { parentTrack, colorBy } = self;
|
|
332
|
+
const { staticBlocks } = getContainingView(self);
|
|
333
|
+
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.type) === 'modifications') {
|
|
334
|
+
const adapter = getConf(parentTrack, ['adapter']);
|
|
335
|
+
const vals = await getUniqueModificationValues(self, adapter, colorBy, staticBlocks);
|
|
336
|
+
self.updateModificationColorMap(vals);
|
|
734
337
|
}
|
|
735
|
-
|
|
338
|
+
self.setModificationsReady(true);
|
|
339
|
+
});
|
|
736
340
|
},
|
|
737
341
|
}));
|
|
738
342
|
}
|
|
@@ -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;
|
|
@@ -14,7 +14,8 @@ const Arcs = observer(function ({ model, }) {
|
|
|
14
14
|
// note: the position absolute below avoids scrollbar from appearing on track
|
|
15
15
|
return (React.createElement("canvas", { "data-testid": "arc-canvas", ref: cb, style: { width, height, position: 'absolute' }, width: width * 2, height: height * 2 }));
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
const LinearReadArcsReactComponent = observer(function ({ model, }) {
|
|
18
18
|
return (React.createElement(BaseDisplayComponent, { model: model },
|
|
19
19
|
React.createElement(Arcs, { model: model })));
|
|
20
20
|
});
|
|
21
|
+
export default LinearReadArcsReactComponent;
|