@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
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.SharedLinearPileupDisplayMixin = void 0;
|
|
30
|
+
const react_1 = require("react");
|
|
31
|
+
const mobx_1 = require("mobx");
|
|
32
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
33
|
+
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
34
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
35
|
+
const serializableFilterChain_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain"));
|
|
36
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
37
|
+
const util_1 = require("@jbrowse/core/util");
|
|
38
|
+
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
39
|
+
// icons
|
|
40
|
+
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
41
|
+
const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
42
|
+
const ClearAll_1 = __importDefault(require("@mui/icons-material/ClearAll"));
|
|
43
|
+
// locals
|
|
44
|
+
const LinearPileupDisplayBlurb_1 = __importDefault(require("./components/LinearPileupDisplayBlurb"));
|
|
45
|
+
const shared_1 = require("../shared");
|
|
46
|
+
const util_2 = require("../util");
|
|
47
|
+
const color_1 = require("../shared/color");
|
|
48
|
+
// async
|
|
49
|
+
const FilterByTagDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../shared/FilterByTag'))));
|
|
50
|
+
const ColorByTagDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ColorByTag'))));
|
|
51
|
+
const SetFeatureHeightDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetFeatureHeight'))));
|
|
52
|
+
const SetMaxHeightDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetMaxHeight'))));
|
|
53
|
+
// using a map because it preserves order
|
|
54
|
+
const rendererTypes = new Map([
|
|
55
|
+
['pileup', 'PileupRenderer'],
|
|
56
|
+
['svg', 'SvgFeatureRenderer'],
|
|
57
|
+
]);
|
|
58
|
+
/**
|
|
59
|
+
* #stateModel SharedLinearPileupDisplayMixin
|
|
60
|
+
* #category display
|
|
61
|
+
* extends `BaseLinearDisplay`
|
|
62
|
+
*/
|
|
63
|
+
function SharedLinearPileupDisplayMixin(configSchema) {
|
|
64
|
+
return mobx_state_tree_1.types
|
|
65
|
+
.compose(plugin_linear_genome_view_1.BaseLinearDisplay, mobx_state_tree_1.types.model({
|
|
66
|
+
/**
|
|
67
|
+
* #property
|
|
68
|
+
*/
|
|
69
|
+
configuration: (0, configuration_1.ConfigurationReference)(configSchema),
|
|
70
|
+
/**
|
|
71
|
+
* #property
|
|
72
|
+
*/
|
|
73
|
+
featureHeight: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
74
|
+
/**
|
|
75
|
+
* #property
|
|
76
|
+
*/
|
|
77
|
+
noSpacing: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
78
|
+
/**
|
|
79
|
+
* #property
|
|
80
|
+
*/
|
|
81
|
+
fadeLikelihood: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.boolean),
|
|
82
|
+
/**
|
|
83
|
+
* #property
|
|
84
|
+
*/
|
|
85
|
+
trackMaxHeight: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
86
|
+
/**
|
|
87
|
+
* #property
|
|
88
|
+
*/
|
|
89
|
+
colorBy: color_1.ColorByModel,
|
|
90
|
+
/**
|
|
91
|
+
* #property
|
|
92
|
+
*/
|
|
93
|
+
filterBy: mobx_state_tree_1.types.optional(shared_1.FilterModel, {}),
|
|
94
|
+
/**
|
|
95
|
+
* #property
|
|
96
|
+
*/
|
|
97
|
+
jexlFilters: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.array(mobx_state_tree_1.types.string), []),
|
|
98
|
+
}))
|
|
99
|
+
.volatile(() => ({
|
|
100
|
+
colorTagMap: mobx_1.observable.map({}),
|
|
101
|
+
featureUnderMouseVolatile: undefined,
|
|
102
|
+
tagsReady: false,
|
|
103
|
+
}))
|
|
104
|
+
.views(self => ({
|
|
105
|
+
get autorunReady() {
|
|
106
|
+
const view = (0, util_1.getContainingView)(self);
|
|
107
|
+
return (view.initialized &&
|
|
108
|
+
self.featureDensityStatsReady &&
|
|
109
|
+
!self.regionTooLarge);
|
|
110
|
+
},
|
|
111
|
+
}))
|
|
112
|
+
.actions(self => ({
|
|
113
|
+
/**
|
|
114
|
+
* #action
|
|
115
|
+
*/
|
|
116
|
+
setTagsReady(flag) {
|
|
117
|
+
self.tagsReady = flag;
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* #action
|
|
121
|
+
*/
|
|
122
|
+
setMaxHeight(n) {
|
|
123
|
+
self.trackMaxHeight = n;
|
|
124
|
+
},
|
|
125
|
+
/**
|
|
126
|
+
* #action
|
|
127
|
+
*/
|
|
128
|
+
setFeatureHeight(n) {
|
|
129
|
+
self.featureHeight = n;
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* #action
|
|
133
|
+
*/
|
|
134
|
+
setNoSpacing(flag) {
|
|
135
|
+
self.noSpacing = flag;
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* #action
|
|
139
|
+
*/
|
|
140
|
+
setColorScheme(colorScheme) {
|
|
141
|
+
self.colorTagMap = mobx_1.observable.map({}); // clear existing mapping
|
|
142
|
+
self.colorBy = (0, mobx_state_tree_1.cast)(colorScheme);
|
|
143
|
+
if (colorScheme.tag) {
|
|
144
|
+
self.tagsReady = false;
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
/**
|
|
148
|
+
* #action
|
|
149
|
+
*/
|
|
150
|
+
updateColorTagMap(uniqueTag) {
|
|
151
|
+
// pale color scheme
|
|
152
|
+
// https://cran.r-project.org/web/packages/khroma/vignettes/tol.html
|
|
153
|
+
// e.g. "tol_light"
|
|
154
|
+
const colorPalette = [
|
|
155
|
+
'#BBCCEE',
|
|
156
|
+
'pink',
|
|
157
|
+
'#CCDDAA',
|
|
158
|
+
'#EEEEBB',
|
|
159
|
+
'#FFCCCC',
|
|
160
|
+
'lightblue',
|
|
161
|
+
'lightgreen',
|
|
162
|
+
'tan',
|
|
163
|
+
'#CCEEFF',
|
|
164
|
+
'lightsalmon',
|
|
165
|
+
];
|
|
166
|
+
uniqueTag.forEach(value => {
|
|
167
|
+
if (!self.colorTagMap.has(value)) {
|
|
168
|
+
const totalKeys = [...self.colorTagMap.keys()].length;
|
|
169
|
+
self.colorTagMap.set(value, colorPalette[totalKeys]);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
/**
|
|
174
|
+
* #action
|
|
175
|
+
*/
|
|
176
|
+
setFeatureUnderMouse(feat) {
|
|
177
|
+
self.featureUnderMouseVolatile = feat;
|
|
178
|
+
},
|
|
179
|
+
/**
|
|
180
|
+
* #action
|
|
181
|
+
*/
|
|
182
|
+
selectFeature(feature) {
|
|
183
|
+
const session = (0, util_1.getSession)(self);
|
|
184
|
+
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
185
|
+
const featureWidget = session.addWidget('AlignmentsFeatureWidget', 'alignmentFeature', { featureData: feature.toJSON(), view: (0, util_1.getContainingView)(self) });
|
|
186
|
+
session.showWidget(featureWidget);
|
|
187
|
+
}
|
|
188
|
+
session.setSelection(feature);
|
|
189
|
+
},
|
|
190
|
+
/**
|
|
191
|
+
* #action
|
|
192
|
+
* uses copy-to-clipboard and generates notification
|
|
193
|
+
*/
|
|
194
|
+
copyFeatureToClipboard(feature) {
|
|
195
|
+
const { uniqueId, ...rest } = feature.toJSON();
|
|
196
|
+
const session = (0, util_1.getSession)(self);
|
|
197
|
+
(0, copy_to_clipboard_1.default)(JSON.stringify(rest, null, 4));
|
|
198
|
+
session.notify('Copied to clipboard', 'success');
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* #action
|
|
202
|
+
*/
|
|
203
|
+
setConfig(conf) {
|
|
204
|
+
self.configuration = conf;
|
|
205
|
+
},
|
|
206
|
+
/**
|
|
207
|
+
* #action
|
|
208
|
+
*/
|
|
209
|
+
setFilterBy(filter) {
|
|
210
|
+
self.filterBy = (0, mobx_state_tree_1.cast)(filter);
|
|
211
|
+
},
|
|
212
|
+
/**
|
|
213
|
+
* #action
|
|
214
|
+
*/
|
|
215
|
+
setJexlFilters(filters) {
|
|
216
|
+
self.jexlFilters = (0, mobx_state_tree_1.cast)(filters);
|
|
217
|
+
},
|
|
218
|
+
}))
|
|
219
|
+
.views(self => ({
|
|
220
|
+
/**
|
|
221
|
+
* #getter
|
|
222
|
+
*/
|
|
223
|
+
get rendererConfig() {
|
|
224
|
+
const { featureHeight, noSpacing, trackMaxHeight, rendererTypeName } = self;
|
|
225
|
+
const configBlob = (0, configuration_1.getConf)(self, ['renderers', rendererTypeName]) || {};
|
|
226
|
+
return self.rendererType.configSchema.create({
|
|
227
|
+
...configBlob,
|
|
228
|
+
...(featureHeight !== undefined ? { height: featureHeight } : {}),
|
|
229
|
+
...(noSpacing !== undefined ? { noSpacing } : {}),
|
|
230
|
+
...(trackMaxHeight !== undefined
|
|
231
|
+
? { maxHeight: trackMaxHeight }
|
|
232
|
+
: {}),
|
|
233
|
+
}, (0, util_1.getEnv)(self));
|
|
234
|
+
},
|
|
235
|
+
}))
|
|
236
|
+
.views(self => ({
|
|
237
|
+
/**
|
|
238
|
+
* #getter
|
|
239
|
+
*/
|
|
240
|
+
get maxHeight() {
|
|
241
|
+
return (0, configuration_1.readConfObject)(self.rendererConfig, 'maxHeight');
|
|
242
|
+
},
|
|
243
|
+
/**
|
|
244
|
+
* #getter
|
|
245
|
+
*/
|
|
246
|
+
get featureHeightSetting() {
|
|
247
|
+
return (0, configuration_1.readConfObject)(self.rendererConfig, 'height');
|
|
248
|
+
},
|
|
249
|
+
/**
|
|
250
|
+
* #getter
|
|
251
|
+
*/
|
|
252
|
+
get featureUnderMouse() {
|
|
253
|
+
return self.featureUnderMouseVolatile;
|
|
254
|
+
},
|
|
255
|
+
/**
|
|
256
|
+
* #getter
|
|
257
|
+
*/
|
|
258
|
+
renderReady() {
|
|
259
|
+
return self.tagsReady;
|
|
260
|
+
},
|
|
261
|
+
/**
|
|
262
|
+
* #getter
|
|
263
|
+
*/
|
|
264
|
+
get filters() {
|
|
265
|
+
return new serializableFilterChain_1.default({ filters: self.jexlFilters });
|
|
266
|
+
},
|
|
267
|
+
}))
|
|
268
|
+
.views(self => {
|
|
269
|
+
const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
|
|
270
|
+
return {
|
|
271
|
+
/**
|
|
272
|
+
* #getter
|
|
273
|
+
*/
|
|
274
|
+
get rendererTypeName() {
|
|
275
|
+
const viewName = (0, configuration_1.getConf)(self, 'defaultRendering');
|
|
276
|
+
const rendererType = rendererTypes.get(viewName);
|
|
277
|
+
if (!rendererType) {
|
|
278
|
+
throw new Error(`unknown alignments view name ${viewName}`);
|
|
279
|
+
}
|
|
280
|
+
return rendererType;
|
|
281
|
+
},
|
|
282
|
+
/**
|
|
283
|
+
* #method
|
|
284
|
+
*/
|
|
285
|
+
contextMenuItems() {
|
|
286
|
+
const feat = self.contextMenuFeature;
|
|
287
|
+
return feat
|
|
288
|
+
? [
|
|
289
|
+
{
|
|
290
|
+
label: 'Open feature details',
|
|
291
|
+
icon: MenuOpen_1.default,
|
|
292
|
+
onClick: () => {
|
|
293
|
+
self.clearFeatureSelection();
|
|
294
|
+
if (feat) {
|
|
295
|
+
self.selectFeature(feat);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
label: 'Copy info to clipboard',
|
|
301
|
+
icon: Icons_1.ContentCopy,
|
|
302
|
+
onClick: () => {
|
|
303
|
+
if (feat) {
|
|
304
|
+
self.copyFeatureToClipboard(feat);
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
]
|
|
309
|
+
: [];
|
|
310
|
+
},
|
|
311
|
+
/**
|
|
312
|
+
* #getter
|
|
313
|
+
*/
|
|
314
|
+
get DisplayBlurb() {
|
|
315
|
+
return LinearPileupDisplayBlurb_1.default;
|
|
316
|
+
},
|
|
317
|
+
/**
|
|
318
|
+
* #method
|
|
319
|
+
*/
|
|
320
|
+
renderPropsPre() {
|
|
321
|
+
const { colorTagMap, colorBy, filterBy, rpcDriverName } = self;
|
|
322
|
+
const superProps = superRenderProps();
|
|
323
|
+
return {
|
|
324
|
+
...superProps,
|
|
325
|
+
notReady: superProps.notReady || !self.renderReady(),
|
|
326
|
+
rpcDriverName,
|
|
327
|
+
displayModel: self,
|
|
328
|
+
colorBy: colorBy ? (0, mobx_state_tree_1.getSnapshot)(colorBy) : undefined,
|
|
329
|
+
filterBy: JSON.parse(JSON.stringify(filterBy)),
|
|
330
|
+
filters: self.filters,
|
|
331
|
+
colorTagMap: Object.fromEntries(colorTagMap.toJSON()),
|
|
332
|
+
config: self.rendererConfig,
|
|
333
|
+
async onFeatureClick(_, featureId) {
|
|
334
|
+
const session = (0, util_1.getSession)(self);
|
|
335
|
+
const { rpcManager } = session;
|
|
336
|
+
try {
|
|
337
|
+
const f = featureId || self.featureIdUnderMouse;
|
|
338
|
+
if (!f) {
|
|
339
|
+
self.clearFeatureSelection();
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
343
|
+
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
344
|
+
featureId: f,
|
|
345
|
+
sessionId,
|
|
346
|
+
layoutId: (0, util_1.getContainingView)(self).id,
|
|
347
|
+
rendererType: 'PileupRenderer',
|
|
348
|
+
}));
|
|
349
|
+
if (feature) {
|
|
350
|
+
self.selectFeature(new util_1.SimpleFeature(feature));
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
catch (e) {
|
|
355
|
+
console.error(e);
|
|
356
|
+
session.notify(`${e}`);
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
onClick() {
|
|
360
|
+
self.clearFeatureSelection();
|
|
361
|
+
},
|
|
362
|
+
// similar to click but opens a menu with further options
|
|
363
|
+
async onFeatureContextMenu(_, featureId) {
|
|
364
|
+
const session = (0, util_1.getSession)(self);
|
|
365
|
+
const { rpcManager } = session;
|
|
366
|
+
try {
|
|
367
|
+
const f = featureId || self.featureIdUnderMouse;
|
|
368
|
+
if (!f) {
|
|
369
|
+
self.clearFeatureSelection();
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
373
|
+
const { feature } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
374
|
+
featureId: f,
|
|
375
|
+
sessionId,
|
|
376
|
+
layoutId: (0, util_1.getContainingView)(self).id,
|
|
377
|
+
rendererType: 'PileupRenderer',
|
|
378
|
+
}));
|
|
379
|
+
if (feature) {
|
|
380
|
+
self.setContextMenuFeature(new util_1.SimpleFeature(feature));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
catch (e) {
|
|
385
|
+
console.error(e);
|
|
386
|
+
session.notify(`${e}`);
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
};
|
|
390
|
+
},
|
|
391
|
+
/**
|
|
392
|
+
* #method
|
|
393
|
+
*/
|
|
394
|
+
colorSchemeSubMenuItems() {
|
|
395
|
+
return [
|
|
396
|
+
{
|
|
397
|
+
label: 'Normal',
|
|
398
|
+
onClick: () => self.setColorScheme({ type: 'normal' }),
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
label: 'Mapping quality',
|
|
402
|
+
onClick: () => self.setColorScheme({ type: 'mappingQuality' }),
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
label: 'Strand',
|
|
406
|
+
onClick: () => self.setColorScheme({ type: 'strand' }),
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
label: 'Per-base quality',
|
|
410
|
+
onClick: () => self.setColorScheme({ type: 'perBaseQuality' }),
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
label: 'Per-base lettering',
|
|
414
|
+
onClick: () => self.setColorScheme({ type: 'perBaseLettering' }),
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
label: 'First-of-pair strand',
|
|
418
|
+
onClick: () => self.setColorScheme({ type: 'stranded' }),
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
label: 'Color by tag...',
|
|
422
|
+
onClick: () => {
|
|
423
|
+
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
424
|
+
ColorByTagDlg,
|
|
425
|
+
{ model: self, handleClose: doneCallback },
|
|
426
|
+
]);
|
|
427
|
+
},
|
|
428
|
+
},
|
|
429
|
+
];
|
|
430
|
+
},
|
|
431
|
+
/**
|
|
432
|
+
* #method
|
|
433
|
+
*/
|
|
434
|
+
trackMenuItems() {
|
|
435
|
+
return [
|
|
436
|
+
...superTrackMenuItems(),
|
|
437
|
+
{
|
|
438
|
+
label: 'Filter by',
|
|
439
|
+
icon: ClearAll_1.default,
|
|
440
|
+
onClick: () => {
|
|
441
|
+
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
442
|
+
FilterByTagDlg,
|
|
443
|
+
{ model: self, handleClose: doneCallback },
|
|
444
|
+
]);
|
|
445
|
+
},
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
label: 'Set feature height',
|
|
449
|
+
subMenu: [
|
|
450
|
+
{
|
|
451
|
+
label: 'Normal',
|
|
452
|
+
onClick: () => {
|
|
453
|
+
self.setFeatureHeight(7);
|
|
454
|
+
self.setNoSpacing(false);
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
label: 'Compact',
|
|
459
|
+
onClick: () => {
|
|
460
|
+
self.setFeatureHeight(2);
|
|
461
|
+
self.setNoSpacing(true);
|
|
462
|
+
},
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
label: 'Manually set height',
|
|
466
|
+
onClick: () => {
|
|
467
|
+
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
468
|
+
SetFeatureHeightDlg,
|
|
469
|
+
{ model: self, handleClose: doneCallback },
|
|
470
|
+
]);
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
],
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
label: 'Set max height...',
|
|
477
|
+
onClick: () => {
|
|
478
|
+
(0, util_1.getSession)(self).queueDialog(doneCallback => [
|
|
479
|
+
SetMaxHeightDlg,
|
|
480
|
+
{ model: self, handleClose: doneCallback },
|
|
481
|
+
]);
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
];
|
|
485
|
+
},
|
|
486
|
+
};
|
|
487
|
+
})
|
|
488
|
+
.views(self => ({
|
|
489
|
+
renderProps() {
|
|
490
|
+
return self.renderPropsPre();
|
|
491
|
+
},
|
|
492
|
+
}))
|
|
493
|
+
.actions(self => ({
|
|
494
|
+
afterAttach() {
|
|
495
|
+
(0, util_2.createAutorun)(self, async () => {
|
|
496
|
+
const view = (0, util_1.getContainingView)(self);
|
|
497
|
+
if (!self.autorunReady) {
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const { colorBy, tagsReady } = self;
|
|
501
|
+
const { staticBlocks } = view;
|
|
502
|
+
if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.tag) && !tagsReady) {
|
|
503
|
+
const vals = await (0, shared_1.getUniqueTagValues)(self, colorBy, staticBlocks);
|
|
504
|
+
self.updateColorTagMap(vals);
|
|
505
|
+
}
|
|
506
|
+
self.setTagsReady(true);
|
|
507
|
+
}, { delay: 1000 });
|
|
508
|
+
// autorun synchronizes featureUnderMouse with featureIdUnderMouse
|
|
509
|
+
// asynchronously. this is needed due to how we do not serialize all
|
|
510
|
+
// features from the BAM/CRAM over the rpc
|
|
511
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
512
|
+
var _a;
|
|
513
|
+
const session = (0, util_1.getSession)(self);
|
|
514
|
+
try {
|
|
515
|
+
const featureId = self.featureIdUnderMouse;
|
|
516
|
+
if (((_a = self.featureUnderMouse) === null || _a === void 0 ? void 0 : _a.id()) !== featureId) {
|
|
517
|
+
if (!featureId) {
|
|
518
|
+
self.setFeatureUnderMouse(undefined);
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
522
|
+
const view = (0, util_1.getContainingView)(self);
|
|
523
|
+
const { feature } = (await session.rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
|
|
524
|
+
featureId,
|
|
525
|
+
sessionId,
|
|
526
|
+
layoutId: view.id,
|
|
527
|
+
rendererType: 'PileupRenderer',
|
|
528
|
+
}));
|
|
529
|
+
// check featureIdUnderMouse is still the same as the
|
|
530
|
+
// feature.id that was returned e.g. that the user hasn't
|
|
531
|
+
// moused over to a new position during the async operation
|
|
532
|
+
// above
|
|
533
|
+
if (self.featureIdUnderMouse === feature.uniqueId) {
|
|
534
|
+
self.setFeatureUnderMouse(new util_1.SimpleFeature(feature));
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
catch (e) {
|
|
540
|
+
console.error(e);
|
|
541
|
+
session.notify(`${e}`, 'error');
|
|
542
|
+
}
|
|
543
|
+
}));
|
|
544
|
+
},
|
|
545
|
+
}));
|
|
546
|
+
}
|
|
547
|
+
exports.SharedLinearPileupDisplayMixin = SharedLinearPileupDisplayMixin;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ObservableMap } from 'mobx';
|
|
3
|
-
declare
|
|
3
|
+
declare const ColorByModificationsDialog: ({ model, handleClose, }: {
|
|
4
4
|
model: {
|
|
5
5
|
setColorScheme: (arg: {
|
|
6
6
|
type: string;
|
|
@@ -8,9 +8,8 @@ declare function ColorByTagDlg(props: {
|
|
|
8
8
|
modificationTagMap: ObservableMap<string, string>;
|
|
9
9
|
colorBy?: {
|
|
10
10
|
type: string;
|
|
11
|
-
};
|
|
11
|
+
} | undefined;
|
|
12
12
|
};
|
|
13
13
|
handleClose: () => void;
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
export default _default;
|
|
14
|
+
}) => React.JSX.Element;
|
|
15
|
+
export default ColorByModificationsDialog;
|
|
@@ -8,8 +8,7 @@ const mobx_react_1 = require("mobx-react");
|
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
9
|
const ui_1 = require("@jbrowse/core/ui");
|
|
10
10
|
const ModificationsTable_1 = __importDefault(require("./ModificationsTable"));
|
|
11
|
-
function
|
|
12
|
-
const { model, handleClose } = props;
|
|
11
|
+
const ColorByModificationsDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
|
|
13
12
|
const { colorBy, modificationTagMap } = model;
|
|
14
13
|
const modifications = [...modificationTagMap.entries()];
|
|
15
14
|
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Color by modifications" },
|
|
@@ -36,5 +35,5 @@ function ColorByTagDlg(props) {
|
|
|
36
35
|
handleClose();
|
|
37
36
|
} }, "Methylation"),
|
|
38
37
|
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
|
|
39
|
-
}
|
|
40
|
-
exports.default =
|
|
38
|
+
});
|
|
39
|
+
exports.default = ColorByModificationsDialog;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare
|
|
2
|
+
declare const ColorByTagDialog: ({ model, handleClose, }: {
|
|
3
3
|
model: {
|
|
4
|
-
setColorScheme:
|
|
4
|
+
setColorScheme: (arg: {
|
|
5
|
+
type: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
}) => void;
|
|
5
8
|
};
|
|
6
9
|
handleClose: () => void;
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export default _default;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default ColorByTagDialog;
|
|
@@ -27,22 +27,19 @@ const react_1 = __importStar(require("react"));
|
|
|
27
27
|
const mobx_react_1 = require("mobx-react");
|
|
28
28
|
const material_1 = require("@mui/material");
|
|
29
29
|
const ui_1 = require("@jbrowse/core/ui");
|
|
30
|
-
function
|
|
31
|
-
const { model, handleClose } = props;
|
|
30
|
+
const ColorByTagDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
|
|
32
31
|
const [tag, setTag] = (0, react_1.useState)('');
|
|
33
32
|
const validTag = tag.match(/^[A-Za-z][A-Za-z0-9]$/);
|
|
34
33
|
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Color by tag" },
|
|
35
34
|
react_1.default.createElement(material_1.DialogContent, { style: { overflowX: 'hidden' } },
|
|
36
35
|
react_1.default.createElement(material_1.Typography, null, "Enter tag to color by: "),
|
|
37
36
|
react_1.default.createElement(material_1.Typography, { color: "textSecondary" }, "Examples: XS or TS for RNA-seq inferred read strand, ts (lower-case) for minimap2 read strand, HP for haplotype, RG for read group, etc."),
|
|
38
|
-
react_1.default.createElement(material_1.TextField, { value: tag, onChange: event => setTag(event.target.value), placeholder: "Enter tag name", inputProps: {
|
|
39
|
-
maxLength: 2,
|
|
40
|
-
}, error: tag.length === 2 && !validTag, helperText: tag.length === 2 && !validTag ? 'Not a valid tag' : '', autoComplete: "off" }),
|
|
37
|
+
react_1.default.createElement(material_1.TextField, { value: tag, onChange: event => setTag(event.target.value), placeholder: "Enter tag name", inputProps: { maxLength: 2 }, error: tag.length === 2 && !validTag, helperText: tag.length === 2 && !validTag ? 'Not a valid tag' : '', autoComplete: "off" }),
|
|
41
38
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
42
39
|
react_1.default.createElement(material_1.Button, { variant: "contained", color: "primary", onClick: () => {
|
|
43
40
|
model.setColorScheme({ type: 'tag', tag });
|
|
44
41
|
handleClose();
|
|
45
42
|
}, disabled: !validTag }, "Submit"),
|
|
46
43
|
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: handleClose }, "Cancel")))));
|
|
47
|
-
}
|
|
48
|
-
exports.default =
|
|
44
|
+
});
|
|
45
|
+
exports.default = ColorByTagDialog;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
2
|
+
declare const LinearPileupDisplayBlurb: ({ model, }: {
|
|
3
3
|
model: {
|
|
4
4
|
sortedBy?: {
|
|
5
5
|
pos: number;
|
|
@@ -8,6 +8,5 @@ export interface LinearPileupDisplayBlurbProps {
|
|
|
8
8
|
tag?: string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default _default;
|
|
11
|
+
}) => React.JSX.Element | null;
|
|
12
|
+
export default LinearPileupDisplayBlurb;
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
7
|
const mobx_react_1 = require("mobx-react");
|
|
8
8
|
const material_1 = require("@mui/material");
|
|
9
|
-
|
|
9
|
+
const LinearPileupDisplayBlurb = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
10
10
|
var _a;
|
|
11
|
-
const { model } = props;
|
|
12
11
|
const { sortedBy } = model;
|
|
13
12
|
return sortedBy ? (react_1.default.createElement("div", { "data-testid": `blurb-${sortedBy}` },
|
|
14
13
|
react_1.default.createElement(material_1.Typography, { color: "secondary", variant: "caption" }, sortedBy
|
|
15
14
|
? `Sorted by ${(_a = sortedBy.tag) !== null && _a !== void 0 ? _a : sortedBy.type} at ${sortedBy.refName}:${sortedBy.pos}`
|
|
16
15
|
: null))) : null;
|
|
17
16
|
});
|
|
17
|
+
exports.default = LinearPileupDisplayBlurb;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare
|
|
2
|
+
declare const SetFeatureHeightDialog: (props: {
|
|
3
3
|
model: {
|
|
4
4
|
setFeatureHeight: (arg?: number) => void;
|
|
5
5
|
setNoSpacing: (arg?: boolean) => void;
|
|
6
6
|
featureHeightSetting: number;
|
|
7
|
-
noSpacing?: boolean;
|
|
7
|
+
noSpacing?: boolean | undefined;
|
|
8
8
|
};
|
|
9
9
|
handleClose: () => void;
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
export default _default;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default SetFeatureHeightDialog;
|