@complat/react-spectra-editor 1.7.1 → 1.8.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/CHANGELOG.md +28 -0
- package/LICENSE +21 -662
- package/README.md +5 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp.js +2329 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_2.js +2874 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_mz_chemstation.js +3242 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_chemstation.js +854 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_neg.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_tic_pos.js +1233 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis.js +48908 -0
- package/dist/__tests__/fixtures/lc_ms_jcamp_uvvis_chemstation.js +15424 -0
- package/dist/__tests__/units/components/cmd_bar/r05_submit_btn.test.js +158 -3
- package/dist/__tests__/units/components/d3_line_rect.test.js +85 -0
- package/dist/__tests__/units/components/d3_multi/multi_focus.test.js +43 -0
- package/dist/__tests__/units/components/hplc_viewer.test.js +123 -0
- package/dist/__tests__/units/components/panel/info.test.js +55 -15
- package/dist/__tests__/units/features/lc-ms/parsing/lcmsCategory.test.js +73 -0
- package/dist/__tests__/units/features/lc-ms/submit/peaks.test.js +310 -0
- package/dist/actions/curve.js +5 -2
- package/dist/actions/hplc_ms.js +66 -0
- package/dist/actions/integration.js +17 -2
- package/dist/actions/ui.js +39 -11
- package/dist/app.js +21 -8
- package/dist/components/cmd_bar/01_viewer.js +15 -11
- package/dist/components/cmd_bar/03_peak.js +25 -16
- package/dist/components/cmd_bar/04_integration.js +116 -17
- package/dist/components/cmd_bar/08_peak_group.js +83 -0
- package/dist/components/cmd_bar/collapsible_toolbar_group.js +101 -0
- package/dist/components/cmd_bar/common.js +4 -3
- package/dist/components/cmd_bar/index.js +76 -18
- package/dist/components/cmd_bar/r01_layout.js +6 -0
- package/dist/components/cmd_bar/r02_scan.js +15 -11
- package/dist/components/cmd_bar/r03_threshold.js +19 -3
- package/dist/components/cmd_bar/r04_submit.js +61 -6
- package/dist/components/cmd_bar/r05_submit_btn.js +60 -13
- package/dist/components/cmd_bar/r06_predict_btn.js +4 -4
- package/dist/components/cmd_bar/r07_wavelength_btn.js +10 -9
- package/dist/components/cmd_bar/r09_detector.js +2 -2
- package/dist/components/cmd_bar/tri_btn.js +4 -1
- package/dist/components/common/draw.js +6 -5
- package/dist/components/d3_line/index.js +70 -15
- package/dist/components/d3_line/line_focus.js +104 -67
- package/dist/components/d3_line_rect/index.js +836 -0
- package/dist/components/d3_line_rect/line_focus.js +526 -0
- package/dist/components/d3_line_rect/multi_focus.js +433 -0
- package/dist/components/d3_line_rect/rect_focus.js +247 -0
- package/dist/components/d3_multi/index.js +154 -163
- package/dist/components/d3_multi/multi_focus.js +117 -68
- package/dist/components/d3_rect/index.js +6 -0
- package/dist/components/d3_rect/rect_focus.js +17 -5
- package/dist/components/hplc_viewer.js +169 -0
- package/dist/components/lc_ms_uv_tools_bar.js +175 -0
- package/dist/components/multi_jcamps_viewer.js +17 -5
- package/dist/components/panel/compare.js +84 -62
- package/dist/components/panel/cyclic_voltamery_data.js +15 -14
- package/dist/components/panel/graph_selection.js +32 -30
- package/dist/components/panel/index.js +28 -22
- package/dist/components/panel/info.js +75 -26
- package/dist/constants/action_type.js +23 -2
- package/dist/constants/list_graph.js +16 -0
- package/dist/constants/list_layout.js +2 -1
- package/dist/constants/list_ui.js +5 -2
- package/dist/features/lc-ms/entities/extractEntityLCMS.js +187 -0
- package/dist/features/lc-ms/parsing/chemstation.js +108 -0
- package/dist/features/lc-ms/parsing/index.js +46 -0
- package/dist/features/lc-ms/parsing/lcmsCategory.js +44 -0
- package/dist/features/lc-ms/parsing/lcmsJcampInfo.js +18 -0
- package/dist/features/lc-ms/parsing/lcmsMsPage.js +241 -0
- package/dist/features/lc-ms/parsing/pageValue.js +27 -0
- package/dist/features/lc-ms/submit/index.js +24 -0
- package/dist/features/lc-ms/submit/peaks.js +66 -0
- package/dist/features/lc-ms/ui/wavelengthSelect.js +54 -0
- package/dist/fn.js +4 -1
- package/dist/helpers/brush.js +74 -19
- package/dist/helpers/calc.js +4 -2
- package/dist/helpers/cfg.js +5 -4
- package/dist/helpers/chem.js +449 -71
- package/dist/helpers/compass.js +181 -17
- package/dist/helpers/extractEntityLCMS.js +24 -0
- package/dist/helpers/extractParams.js +118 -33
- package/dist/helpers/extractPeaksEdit.js +29 -9
- package/dist/helpers/format.js +189 -4
- package/dist/helpers/init.js +25 -5
- package/dist/helpers/integration.js +130 -17
- package/dist/helpers/integration_draft.js +43 -0
- package/dist/helpers/integration_focus.js +155 -0
- package/dist/helpers/integration_jcamp.js +68 -0
- package/dist/helpers/integration_split.js +202 -0
- package/dist/helpers/mount.js +8 -1
- package/dist/helpers/sweep.js +39 -0
- package/dist/index.js +284 -26
- package/dist/layer_content.js +17 -3
- package/dist/layer_init.js +124 -14
- package/dist/layer_prism.js +31 -5
- package/dist/reducers/index.js +3 -1
- package/dist/reducers/reducer_curve.js +54 -36
- package/dist/reducers/reducer_hplc_ms/hydrate.js +289 -0
- package/dist/reducers/reducer_hplc_ms/index.js +122 -0
- package/dist/reducers/reducer_hplc_ms/persistence.js +74 -0
- package/dist/reducers/reducer_hplc_ms/tic.js +70 -0
- package/dist/reducers/reducer_hplc_ms/utils.js +70 -0
- package/dist/reducers/reducer_hplc_ms/uvvis.js +377 -0
- package/dist/reducers/reducer_integration.js +265 -7
- package/dist/reducers/reducer_layout.js +1 -1
- package/dist/reducers/reducer_submit.js +2 -1
- package/dist/reducers/reducer_ui.js +149 -13
- package/dist/reducers/undo_redo_config.js +2 -2
- package/dist/sagas/saga_lcms_ui.js +85 -0
- package/dist/sagas/saga_ui.js +177 -74
- package/dist/setupTests.js +5 -5
- package/package.json +10 -7
package/dist/helpers/compass.js
CHANGED
|
@@ -4,9 +4,18 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.TfRescale = exports.MouseMove = exports.MountCompass = exports.ClickCompass = void 0;
|
|
7
|
+
exports.getCurvePointFromEvent = exports.clearIntegrationPreview = exports.TfRescale = exports.MouseMove = exports.MountCompass = exports.ClickCompass = void 0;
|
|
8
8
|
var _format = _interopRequireDefault(require("./format"));
|
|
9
9
|
var _chem = require("./chem");
|
|
10
|
+
var _list_ui = require("../constants/list_ui");
|
|
11
|
+
var _cfg = _interopRequireDefault(require("./cfg"));
|
|
12
|
+
var _sweep = require("./sweep.js");
|
|
13
|
+
var _integration_draft = require("./integration_draft.js");
|
|
14
|
+
var _integration_split = require("./integration_split");
|
|
15
|
+
// eslint-disable-line import/extensions
|
|
16
|
+
|
|
17
|
+
// eslint-disable-line import/extensions
|
|
18
|
+
|
|
10
19
|
const d3 = require('d3');
|
|
11
20
|
const TfRescale = focus => {
|
|
12
21
|
const xt = focus.scales.x;
|
|
@@ -18,25 +27,16 @@ const TfRescale = focus => {
|
|
|
18
27
|
};
|
|
19
28
|
exports.TfRescale = TfRescale;
|
|
20
29
|
const fetchPt = (event, focus, xt) => {
|
|
21
|
-
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
22
|
-
// ? d3.event.offsetX
|
|
23
|
-
// : d3.mouse(focus.root.node())[0];
|
|
24
30
|
const rawMouseX = d3.pointer(event, focus.root.node())[0];
|
|
25
31
|
const mouseX = xt.invert(rawMouseX);
|
|
26
32
|
const bisectDate = d3.bisector(d => +d.x).left;
|
|
27
33
|
const dt = focus.data;
|
|
28
34
|
const ls = dt.length;
|
|
29
|
-
const sortData = ls > 0 && dt[0].x > dt[ls - 1].x ? dt.reverse() : dt;
|
|
35
|
+
const sortData = ls > 0 && dt[0].x > dt[ls - 1].x ? [...dt].reverse() : dt;
|
|
30
36
|
const idx = bisectDate(sortData, +mouseX);
|
|
31
|
-
return sortData[idx];
|
|
37
|
+
return sortData[Math.min(idx, ls - 1)];
|
|
32
38
|
};
|
|
33
39
|
const fetchFreePt = (event, focus, xt, yt) => {
|
|
34
|
-
// const rawMouseX = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
35
|
-
// ? d3.event.offsetX
|
|
36
|
-
// : d3.mouse(focus.root.node())[0];
|
|
37
|
-
// const rawMouseY = focus.isFirefox // WORKAROUND d3.mouse firefox compatibility
|
|
38
|
-
// ? d3.event.offsetY
|
|
39
|
-
// : d3.mouse(focus.root.node())[1];
|
|
40
40
|
const rawMouseX = d3.pointer(event, focus.root.node())[0];
|
|
41
41
|
const rawMouseY = d3.pointer(event, focus.root.node())[1];
|
|
42
42
|
const mouseX = xt.invert(rawMouseX);
|
|
@@ -58,6 +58,69 @@ const fetchFreePt = (event, focus, xt, yt) => {
|
|
|
58
58
|
});
|
|
59
59
|
return selectPoint;
|
|
60
60
|
};
|
|
61
|
+
const clearIntegrationPreview = focus => {
|
|
62
|
+
if (!focus || !focus.root) return;
|
|
63
|
+
focus.root.select('.integration-preview-line').remove();
|
|
64
|
+
};
|
|
65
|
+
exports.clearIntegrationPreview = clearIntegrationPreview;
|
|
66
|
+
const drawIntegrationPreview = (focus, firstPoint, nextPoint) => {
|
|
67
|
+
if (!firstPoint || !nextPoint) return;
|
|
68
|
+
const {
|
|
69
|
+
xt,
|
|
70
|
+
yt
|
|
71
|
+
} = TfRescale(focus);
|
|
72
|
+
const preview = focus.root.select('.integration-preview');
|
|
73
|
+
const line = preview.selectAll('.integration-preview-line').data([{
|
|
74
|
+
firstPoint,
|
|
75
|
+
nextPoint
|
|
76
|
+
}]);
|
|
77
|
+
line.enter().append('line').attr('class', 'integration-preview-line').attr('stroke', 'red').attr('stroke-width', 2).attr('stroke-dasharray', '4,3').style('pointer-events', 'none').merge(line).attr('x1', d => xt(d.firstPoint.x)).attr('y1', d => yt(d.firstPoint.y)).attr('x2', d => xt(d.nextPoint.x)).attr('y2', d => yt(d.nextPoint.y));
|
|
78
|
+
};
|
|
79
|
+
const getCurvePointFromEvent = (event, focus) => {
|
|
80
|
+
const {
|
|
81
|
+
xt,
|
|
82
|
+
yt
|
|
83
|
+
} = TfRescale(focus);
|
|
84
|
+
if (_format.default.isCyclicVoltaLayout(focus.layout)) {
|
|
85
|
+
return fetchFreePt(event, focus, xt, yt);
|
|
86
|
+
}
|
|
87
|
+
return fetchPt(event, focus, xt);
|
|
88
|
+
};
|
|
89
|
+
exports.getCurvePointFromEvent = getCurvePointFromEvent;
|
|
90
|
+
const cancelIntegrationDraft = focus => {
|
|
91
|
+
Object.assign(focus, {
|
|
92
|
+
firstIntegrationPoint: null
|
|
93
|
+
});
|
|
94
|
+
clearIntegrationPreview(focus);
|
|
95
|
+
(0, _integration_draft.forgetPendingIntegrationDraft)();
|
|
96
|
+
};
|
|
97
|
+
const updateIntegrationPreview = (event, focus) => {
|
|
98
|
+
if (!focus.isUiAddIntgSt || !focus.firstIntegrationPoint) return;
|
|
99
|
+
if (!_cfg.default.showIntegSplitTools(focus.layout)) return;
|
|
100
|
+
const pt = getCurvePointFromEvent(event, focus);
|
|
101
|
+
if (!pt) return;
|
|
102
|
+
drawIntegrationPreview(focus, focus.firstIntegrationPoint, pt);
|
|
103
|
+
};
|
|
104
|
+
const updateIntegrationSplitPreview = (event, focus) => {
|
|
105
|
+
if (!focus.isUiSplitIntgSt && !focus.isUiVisualSplitIntgSt) return;
|
|
106
|
+
const {
|
|
107
|
+
splitX,
|
|
108
|
+
target
|
|
109
|
+
} = (0, _integration_split.getIntegrationSplitTargetFromEvent)(event, focus);
|
|
110
|
+
if (!target) {
|
|
111
|
+
(0, _integration_split.clearIntegrationSplitPreview)(focus);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (focus.isUiVisualSplitIntgSt && (0, _integration_split.isAlreadyVisuallySplit)(target)) {
|
|
115
|
+
(0, _integration_split.clearIntegrationSplitPreview)(focus);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const {
|
|
119
|
+
shift = 0,
|
|
120
|
+
ignoreRef = false
|
|
121
|
+
} = focus.integrationSplitTargets || {};
|
|
122
|
+
(0, _integration_split.drawIntegrationSplitPreview)(focus, target, splitX, shift, ignoreRef);
|
|
123
|
+
};
|
|
61
124
|
const MouseMove = (event, focus) => {
|
|
62
125
|
const {
|
|
63
126
|
xt,
|
|
@@ -99,6 +162,13 @@ const MouseMove = (event, focus) => {
|
|
|
99
162
|
focus.root.select('.cursor-txt-hz').attr('transform', `translate(${tx},${ty - 30})`).text(`2Theta: ${pt.x.toExponential(2)}, d-value: ${dValue}`);
|
|
100
163
|
} else if (_format.default.isTGALayout(layout) || _format.default.isDSCLayout(layout)) {
|
|
101
164
|
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(`X: ${pt.x.toFixed(3)}, Y: ${pt.y.toFixed(3)}`);
|
|
165
|
+
} else if (_format.default.isMsLayout(layout)) {
|
|
166
|
+
const maxY = d3.max(focus.data, row => row.y) || 0;
|
|
167
|
+
const relPct = maxY > 0 ? 100 * pt.y / maxY : 0;
|
|
168
|
+
const rel = maxY > 0 ? parseInt(relPct, 10) : 0;
|
|
169
|
+
const xPrecision = _format.default.clampDecimalPlaces(focus.decimal);
|
|
170
|
+
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(`${pt.x.toFixed(xPrecision)} (${rel})`);
|
|
171
|
+
focus.root.select('.cursor-txt-hz').text('');
|
|
102
172
|
} else {
|
|
103
173
|
focus.root.select('.cursor-txt').attr('transform', `translate(${tx},${10})`).text(pt.x.toFixed(3));
|
|
104
174
|
if (freq) {
|
|
@@ -109,21 +179,111 @@ const MouseMove = (event, focus) => {
|
|
|
109
179
|
}
|
|
110
180
|
}
|
|
111
181
|
}
|
|
182
|
+
updateIntegrationPreview(event, focus);
|
|
183
|
+
updateIntegrationSplitPreview(event, focus);
|
|
112
184
|
};
|
|
113
185
|
exports.MouseMove = MouseMove;
|
|
186
|
+
const clickIntegrationPoint = (event, focus) => {
|
|
187
|
+
const pt = getCurvePointFromEvent(event, focus);
|
|
188
|
+
if (!pt) return;
|
|
189
|
+
const {
|
|
190
|
+
firstIntegrationPoint,
|
|
191
|
+
selectUiSweepAct
|
|
192
|
+
} = focus;
|
|
193
|
+
if (!firstIntegrationPoint) {
|
|
194
|
+
// Keep the draft local to D3; the second click emits the existing sweep payload.
|
|
195
|
+
const draftPoint = {
|
|
196
|
+
x: pt.x,
|
|
197
|
+
y: pt.y,
|
|
198
|
+
jcampIdx: focus.jcampIdx,
|
|
199
|
+
dataLength: focus.data.length
|
|
200
|
+
};
|
|
201
|
+
Object.assign(focus, {
|
|
202
|
+
firstIntegrationPoint: draftPoint
|
|
203
|
+
});
|
|
204
|
+
(0, _integration_draft.setPendingIntegrationDraft)({
|
|
205
|
+
jcampIdx: focus.jcampIdx,
|
|
206
|
+
dataLength: focus.data.length,
|
|
207
|
+
cancel: () => cancelIntegrationDraft(focus)
|
|
208
|
+
});
|
|
209
|
+
drawIntegrationPreview(focus, draftPoint, draftPoint);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
cancelIntegrationDraft(focus);
|
|
213
|
+
if (firstIntegrationPoint.x === pt.x) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
selectUiSweepAct((0, _sweep.buildSweepPayloadFromXBounds)(focus, firstIntegrationPoint.x, pt.x));
|
|
217
|
+
};
|
|
114
218
|
const ClickCompass = (event, focus) => {
|
|
115
219
|
event.stopPropagation();
|
|
116
220
|
event.preventDefault();
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
221
|
+
if (focus.isUiAddIntgSt && _cfg.default.showIntegSplitTools(focus.layout)) {
|
|
222
|
+
clickIntegrationPoint(event, focus);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (focus.isUiSplitIntgSt) {
|
|
226
|
+
const {
|
|
227
|
+
splitX,
|
|
228
|
+
target
|
|
229
|
+
} = (0, _integration_split.getIntegrationSplitTargetFromEvent)(event, focus);
|
|
230
|
+
if (!target) return;
|
|
231
|
+
(0, _integration_split.clearIntegrationSplitPreview)(focus);
|
|
232
|
+
focus.splitIntegrationAct({
|
|
233
|
+
curveIdx: focus.jcampIdx,
|
|
234
|
+
target,
|
|
235
|
+
splitX,
|
|
236
|
+
data: focus.data
|
|
237
|
+
});
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (focus.isUiVisualSplitIntgSt) {
|
|
241
|
+
const {
|
|
242
|
+
splitX,
|
|
243
|
+
target
|
|
244
|
+
} = (0, _integration_split.getIntegrationSplitTargetFromEvent)(event, focus);
|
|
245
|
+
if (!target) return;
|
|
246
|
+
const {
|
|
247
|
+
stack = [],
|
|
248
|
+
shift = 0
|
|
249
|
+
} = focus.integrationSplitTargets || {};
|
|
250
|
+
const existingSplitX = (0, _integration_split.getVisualSplitLineAtX)(focus, stack, splitX, shift);
|
|
251
|
+
(0, _integration_split.clearIntegrationSplitPreview)(focus);
|
|
252
|
+
if (Number.isFinite(existingSplitX)) {
|
|
253
|
+
if (typeof focus.removeVisualSplitLineAct !== 'function') return;
|
|
254
|
+
focus.removeVisualSplitLineAct({
|
|
255
|
+
curveIdx: focus.jcampIdx,
|
|
256
|
+
splitX: existingSplitX,
|
|
257
|
+
data: focus.data
|
|
258
|
+
});
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if ((0, _integration_split.isAlreadyVisuallySplit)(target)) return;
|
|
262
|
+
if (typeof focus.addVisualSplitLineAct !== 'function') return;
|
|
263
|
+
focus.addVisualSplitLineAct({
|
|
264
|
+
curveIdx: focus.jcampIdx,
|
|
265
|
+
target,
|
|
266
|
+
splitX,
|
|
267
|
+
data: focus.data
|
|
268
|
+
});
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
122
271
|
const {
|
|
123
272
|
layout,
|
|
124
273
|
cyclicvoltaSt,
|
|
125
274
|
jcampIdx
|
|
126
275
|
} = focus;
|
|
276
|
+
const isPeakGroupSelect = focus.uiSt?.sweepType === _list_ui.LIST_UI_SWEEP_TYPE.PEAK_GROUP_SELECT;
|
|
277
|
+
const isMsGraph = focus.graphIndex === 2;
|
|
278
|
+
const isUvvisGraph = focus.graphIndex === 0;
|
|
279
|
+
const isLcmsTicGraph = _format.default.isLCMsLayout(layout) && focus.graphIndex === 1;
|
|
280
|
+
if (isPeakGroupSelect && isMsGraph) return;
|
|
281
|
+
if (isPeakGroupSelect && _format.default.isLCMsLayout(layout) && isUvvisGraph) return;
|
|
282
|
+
const {
|
|
283
|
+
xt,
|
|
284
|
+
yt
|
|
285
|
+
} = TfRescale(focus);
|
|
286
|
+
let pt = fetchPt(event, focus, xt);
|
|
127
287
|
if (_format.default.isCyclicVoltaLayout(layout)) {
|
|
128
288
|
pt = fetchFreePt(event, focus, xt, yt);
|
|
129
289
|
const onPeak = false;
|
|
@@ -137,6 +297,8 @@ const ClickCompass = (event, focus) => {
|
|
|
137
297
|
} else {
|
|
138
298
|
focus.clickUiTargetAct(pt, onPeak);
|
|
139
299
|
}
|
|
300
|
+
} else if (isLcmsTicGraph) {
|
|
301
|
+
focus.clickUiTargetAct(pt, false, false, jcampIdx, false, 'lcms_tic');
|
|
140
302
|
} else {
|
|
141
303
|
focus.clickUiTargetAct(pt, false);
|
|
142
304
|
}
|
|
@@ -150,11 +312,13 @@ const MountCompass = focus => {
|
|
|
150
312
|
} = focus;
|
|
151
313
|
const compass = root.append('g').attr('class', 'compass');
|
|
152
314
|
const cursor = root.append('g').attr('class', 'cursor');
|
|
315
|
+
const preview = root.append('g').attr('class', 'integration-preview').attr('clip-path', 'url(#clip)');
|
|
153
316
|
const overlay = root.append('rect').attr('class', 'overlay-focus').attr('width', w).attr('height', h).attr('opacity', 0.0);
|
|
154
317
|
compass.append('line').attr('class', 'x-hover-line hover-line').attr('stroke', '#777').attr('stroke-width', 1).attr('stroke-dasharray', 2, 2);
|
|
155
318
|
compass.append('circle').attr('r', 4).attr('fill', 'none').attr('stroke', '#777').attr('stroke-width', 2);
|
|
156
319
|
cursor.append('text').attr('class', 'cursor-txt').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle');
|
|
157
320
|
cursor.append('text').attr('class', 'cursor-txt-hz').attr('font-family', 'Helvetica').style('font-size', '12px').style('text-anchor', 'middle').style('fill', '#D68910');
|
|
321
|
+
preview.selectAll('*').remove();
|
|
158
322
|
overlay.on('mousemove', event => MouseMove(event, focus)).on('click', event => ClickCompass(event, focus));
|
|
159
323
|
};
|
|
160
324
|
exports.MountCompass = MountCompass;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "getLcMsInfo", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _extractEntityLCMS.getLcMsInfo;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "isLcMsGroup", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _extractEntityLCMS.isLcMsGroup;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "splitAndReindexEntities", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _extractEntityLCMS.splitAndReindexEntities;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
var _extractEntityLCMS = require("../features/lc-ms/entities/extractEntityLCMS");
|
|
@@ -6,35 +6,33 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.extractParams = void 0;
|
|
8
8
|
var _format = _interopRequireDefault(require("./format"));
|
|
9
|
-
|
|
9
|
+
var _extractEntityLCMS = require("./extractEntityLCMS");
|
|
10
|
+
const getScanIdx = (entity, scanState) => {
|
|
10
11
|
const {
|
|
11
12
|
target,
|
|
12
13
|
isAuto
|
|
13
|
-
} =
|
|
14
|
+
} = scanState || {};
|
|
14
15
|
const {
|
|
15
|
-
features,
|
|
16
|
-
spectra
|
|
17
|
-
} = entity;
|
|
18
|
-
const
|
|
19
|
-
const hasEdit = !!
|
|
20
|
-
const defaultIdx = isAuto || !hasEdit ?
|
|
16
|
+
features = {},
|
|
17
|
+
spectra = []
|
|
18
|
+
} = entity || {};
|
|
19
|
+
const defaultFeature = features.editPeak || features.autoPeak || features[0] || {};
|
|
20
|
+
const hasEdit = !!defaultFeature?.scanEditTarget;
|
|
21
|
+
const defaultIdx = isAuto || !hasEdit ? defaultFeature?.scanAutoTarget : defaultFeature?.scanEditTarget;
|
|
21
22
|
const defaultCount = +spectra.length;
|
|
22
23
|
let idx = +(target || defaultIdx || 0);
|
|
23
|
-
if (idx > defaultCount)
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
return idx - 1;
|
|
24
|
+
if (idx > defaultCount) idx = defaultCount;
|
|
25
|
+
return Math.max(idx - 1, 0);
|
|
27
26
|
};
|
|
28
|
-
const
|
|
27
|
+
const extractSharedParams = (entity, thresholdState, scanIdx = 0) => {
|
|
29
28
|
const {
|
|
30
|
-
spectra,
|
|
31
|
-
features
|
|
32
|
-
} = entity;
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const feature = hasEdit && thresSt.isEdit ? editPeak : autoPeak;
|
|
29
|
+
spectra = [],
|
|
30
|
+
features = {}
|
|
31
|
+
} = entity || {};
|
|
32
|
+
const autoPeak = features.autoPeak || features[scanIdx] || features[0] || {};
|
|
33
|
+
const editPeak = features.editPeak || features[scanIdx] || features[0] || {};
|
|
34
|
+
const hasEdit = !!editPeak?.data?.[0]?.x?.length;
|
|
35
|
+
const feature = hasEdit && thresholdState?.isEdit ? editPeak : autoPeak;
|
|
38
36
|
const {
|
|
39
37
|
integration,
|
|
40
38
|
multiplicity
|
|
@@ -47,21 +45,99 @@ const extrShare = (entity, thresSt, scanIdx = 0) => {
|
|
|
47
45
|
multiplicity
|
|
48
46
|
};
|
|
49
47
|
};
|
|
50
|
-
const
|
|
51
|
-
const
|
|
48
|
+
const extractLcmsParams = entity => {
|
|
49
|
+
const {
|
|
50
|
+
features,
|
|
51
|
+
layout
|
|
52
|
+
} = entity;
|
|
53
|
+
let topicX = [];
|
|
54
|
+
let topicY = [];
|
|
55
|
+
const entityInfo = (0, _extractEntityLCMS.getLcMsInfo)(entity);
|
|
56
|
+
let featuresArray = [];
|
|
57
|
+
if (Array.isArray(features)) {
|
|
58
|
+
featuresArray = features;
|
|
59
|
+
} else if (features && typeof features === 'object') {
|
|
60
|
+
featuresArray = Object.values(features);
|
|
61
|
+
}
|
|
62
|
+
if (entityInfo.kind === 'tic') {
|
|
63
|
+
const ticFeature = featuresArray.find(spectrum => spectrum?.data?.[0]?.x?.length > 0);
|
|
64
|
+
if (ticFeature?.data?.[0]) {
|
|
65
|
+
const {
|
|
66
|
+
x,
|
|
67
|
+
y
|
|
68
|
+
} = ticFeature.data[0];
|
|
69
|
+
topicX = x;
|
|
70
|
+
topicY = y;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
featuresArray.forEach(spectrum => {
|
|
74
|
+
if (!spectrum?.data?.[0]) return;
|
|
75
|
+
const {
|
|
76
|
+
y
|
|
77
|
+
} = spectrum.data[0];
|
|
78
|
+
const {
|
|
79
|
+
pageValue
|
|
80
|
+
} = spectrum;
|
|
81
|
+
topicX.push(pageValue);
|
|
82
|
+
topicY.push(Math.max(...y));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
topic: {
|
|
87
|
+
x: topicX,
|
|
88
|
+
y: topicY
|
|
89
|
+
},
|
|
90
|
+
feature: {
|
|
91
|
+
maxY: topicY.length ? Math.max(...topicY) : 0,
|
|
92
|
+
operation: {
|
|
93
|
+
layout
|
|
94
|
+
},
|
|
95
|
+
data: [{
|
|
96
|
+
x: topicX,
|
|
97
|
+
y: topicY
|
|
98
|
+
}],
|
|
99
|
+
isPeaktable: false
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
const extractMsParams = (entity, thresholdState, scanState, forceLcms = false) => {
|
|
104
|
+
const {
|
|
105
|
+
layout
|
|
106
|
+
} = entity;
|
|
107
|
+
if (_format.default.isMsLayout(layout) && !forceLcms) {
|
|
108
|
+
const scanIdx = getScanIdx(entity, scanState);
|
|
109
|
+
const {
|
|
110
|
+
spectra,
|
|
111
|
+
feature,
|
|
112
|
+
hasEdit
|
|
113
|
+
} = extractSharedParams(entity, thresholdState, scanIdx);
|
|
114
|
+
const topic = spectra?.[scanIdx]?.data?.[0] || {
|
|
115
|
+
x: [],
|
|
116
|
+
y: []
|
|
117
|
+
};
|
|
118
|
+
return {
|
|
119
|
+
topic,
|
|
120
|
+
feature,
|
|
121
|
+
hasEdit
|
|
122
|
+
};
|
|
123
|
+
}
|
|
52
124
|
const {
|
|
53
125
|
spectra,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
126
|
+
features
|
|
127
|
+
} = entity;
|
|
128
|
+
const {
|
|
129
|
+
topic,
|
|
130
|
+
feature
|
|
131
|
+
} = extractLcmsParams(entity);
|
|
58
132
|
return {
|
|
133
|
+
entity,
|
|
134
|
+
spectra,
|
|
135
|
+
features,
|
|
59
136
|
topic,
|
|
60
|
-
feature
|
|
61
|
-
hasEdit
|
|
137
|
+
feature
|
|
62
138
|
};
|
|
63
139
|
};
|
|
64
|
-
const
|
|
140
|
+
const extractNonMsParams = (entity, thresholdState) => {
|
|
65
141
|
const scanIdx = 0;
|
|
66
142
|
const {
|
|
67
143
|
spectra,
|
|
@@ -69,8 +145,11 @@ const extrNi = (entity, thresSt) => {
|
|
|
69
145
|
hasEdit,
|
|
70
146
|
integration,
|
|
71
147
|
multiplicity
|
|
72
|
-
} =
|
|
73
|
-
const topic = spectra[0]
|
|
148
|
+
} = extractSharedParams(entity, thresholdState, scanIdx);
|
|
149
|
+
const topic = spectra?.[0]?.data?.[0] || {
|
|
150
|
+
x: [],
|
|
151
|
+
y: []
|
|
152
|
+
};
|
|
74
153
|
return {
|
|
75
154
|
topic,
|
|
76
155
|
feature,
|
|
@@ -79,7 +158,13 @@ const extrNi = (entity, thresSt) => {
|
|
|
79
158
|
multiplicity
|
|
80
159
|
};
|
|
81
160
|
};
|
|
82
|
-
const extractParams = (entity,
|
|
161
|
+
const extractParams = (entity, thresholdState, scanState, options = {}) => {
|
|
162
|
+
const {
|
|
163
|
+
forceLcms = false
|
|
164
|
+
} = options;
|
|
165
|
+
const shouldUseLcmsPath = forceLcms || _format.default.isLCMsLayout(entity.layout);
|
|
166
|
+
return _format.default.isMsLayout(entity.layout) || shouldUseLcmsPath ? extractMsParams(entity, thresholdState, scanState, shouldUseLcmsPath) : extractNonMsParams(entity, thresholdState);
|
|
167
|
+
};
|
|
83
168
|
|
|
84
169
|
// eslint-disable-line
|
|
85
170
|
exports.extractParams = extractParams;
|
|
@@ -5,11 +5,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.extractPeaksEdit = exports.extractAutoPeaks = exports.extractAreaUnderCurve = void 0;
|
|
8
|
-
|
|
8
|
+
Object.defineProperty(exports, "formatLcmsIntegralsForBackend", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _submit.formatLcmsIntegralsForBackend;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "formatLcmsPeaksForBackend", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _submit.formatLcmsPeaksForBackend;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "getLcmsMzPageData", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _submit.getLcmsMzPageData;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
9
26
|
var _chem = require("./chem");
|
|
27
|
+
var _converter = require("./converter");
|
|
10
28
|
var _shift = require("./shift");
|
|
11
29
|
var _format = _interopRequireDefault(require("./format"));
|
|
12
30
|
var _integration = require("./integration");
|
|
31
|
+
var _submit = require("../features/lc-ms/submit");
|
|
32
|
+
/* eslint-disable max-len */
|
|
33
|
+
|
|
13
34
|
const niOffset = (shiftSt, atIndex = 0) => {
|
|
14
35
|
const {
|
|
15
36
|
shifts
|
|
@@ -26,19 +47,18 @@ const niOffset = (shiftSt, atIndex = 0) => {
|
|
|
26
47
|
return offset;
|
|
27
48
|
};
|
|
28
49
|
const msOffset = () => 0;
|
|
29
|
-
const extractPeaksEdit = (feature, editPeakSt, thresSt, shiftSt, layoutSt, atIndex = 0) => {
|
|
30
|
-
const offset = _format.default.isMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt, atIndex);
|
|
31
|
-
const peaks = (0, _chem.Convert2Peak)(feature, thresSt.value, offset);
|
|
32
|
-
const peaksEdit = (0, _converter.PksEdit)(peaks, editPeakSt);
|
|
33
|
-
return peaksEdit;
|
|
34
|
-
};
|
|
35
|
-
exports.extractPeaksEdit = extractPeaksEdit;
|
|
36
50
|
const extractAutoPeaks = (feature, thresSt, shiftSt, layoutSt, atIndex = 0) => {
|
|
37
|
-
const offset = _format.default.isMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt, atIndex);
|
|
51
|
+
const offset = _format.default.isMsLayout(layoutSt) || _format.default.isLCMsLayout(layoutSt) ? msOffset() : niOffset(shiftSt, atIndex);
|
|
38
52
|
const peaks = (0, _chem.Convert2Peak)(feature, thresSt.value, offset);
|
|
39
53
|
return peaks;
|
|
40
54
|
};
|
|
41
55
|
exports.extractAutoPeaks = extractAutoPeaks;
|
|
56
|
+
const extractPeaksEdit = (feature, editPeakSt, thresSt, shiftSt, layoutSt, atIndex = 0) => {
|
|
57
|
+
if (_format.default.isLCMsLayout(layoutSt)) return [];
|
|
58
|
+
const peaks = extractAutoPeaks(feature, thresSt, shiftSt, layoutSt, atIndex);
|
|
59
|
+
return (0, _converter.PksEdit)(peaks, editPeakSt);
|
|
60
|
+
};
|
|
61
|
+
exports.extractPeaksEdit = extractPeaksEdit;
|
|
42
62
|
const getAUCValue = (integrationSt, layoutSt) => {
|
|
43
63
|
const {
|
|
44
64
|
refArea,
|