nmrium 0.22.0 → 0.23.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.
Files changed (42) hide show
  1. package/lib/component/1d/FooterBanner.js +1 -1
  2. package/lib/component/NMRium.d.ts +3 -6
  3. package/lib/component/NMRium.js +1 -7
  4. package/lib/component/modal/PredictSpectraModal.d.ts +0 -28
  5. package/lib/component/modal/PredictSpectraModal.js +2 -32
  6. package/lib/component/modal/setting/DisplayTabContent.js +4 -0
  7. package/lib/component/panels/MoleculesPanel/MoleculePanel.d.ts +10 -1
  8. package/lib/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  9. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.d.ts +9 -1
  10. package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  11. package/lib/component/panels/Panels.js +7 -0
  12. package/lib/component/panels/predictionPanel/PredictionOptions.d.ts +6 -0
  13. package/lib/component/panels/predictionPanel/PredictionOptions.js +88 -0
  14. package/lib/component/panels/predictionPanel/PredictionPanel.d.ts +2 -0
  15. package/lib/component/panels/predictionPanel/PredictionPanel.js +33 -0
  16. package/lib/component/reducer/actions/LoadActions.js +7 -0
  17. package/lib/component/reducer/actions/MoleculeActions.js +1 -1
  18. package/lib/component/reducer/preferencesReducer.js +3 -4
  19. package/lib/component/workspaces/basic.js +1 -0
  20. package/lib/component/workspaces/exercise1D.js +1 -0
  21. package/lib/component/workspaces/process1D.js +1 -0
  22. package/lib/data/PredictionManager.d.ts +35 -3
  23. package/lib/data/PredictionManager.js +45 -7
  24. package/lib/versionInfo.js +1 -1
  25. package/lib-cjs/component/1d/FooterBanner.js +1 -1
  26. package/lib-cjs/component/NMRium.js +1 -8
  27. package/lib-cjs/component/modal/PredictSpectraModal.js +3 -33
  28. package/lib-cjs/component/modal/setting/DisplayTabContent.js +4 -0
  29. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanel.js +27 -17
  30. package/lib-cjs/component/panels/MoleculesPanel/MoleculePanelHeader.js +2 -2
  31. package/lib-cjs/component/panels/Panels.js +7 -0
  32. package/lib-cjs/component/panels/predictionPanel/PredictionOptions.js +112 -0
  33. package/lib-cjs/component/panels/predictionPanel/PredictionPanel.js +39 -0
  34. package/lib-cjs/component/reducer/actions/LoadActions.js +7 -0
  35. package/lib-cjs/component/reducer/actions/MoleculeActions.js +1 -1
  36. package/lib-cjs/component/reducer/preferencesReducer.js +3 -4
  37. package/lib-cjs/component/workspaces/basic.js +1 -0
  38. package/lib-cjs/component/workspaces/exercise1D.js +1 -0
  39. package/lib-cjs/component/workspaces/process1D.js +1 -0
  40. package/lib-cjs/data/PredictionManager.js +46 -8
  41. package/lib-cjs/versionInfo.js +1 -1
  42. package/package.json +1 -1
@@ -23,6 +23,7 @@ exports.exercise1D = {
23
23
  hideSummaryPanel: true,
24
24
  hideMultipleSpectraAnalysisPanel: true,
25
25
  hideDatabasePanel: true,
26
+ hidePredictionPanel: false,
26
27
  },
27
28
  toolBarButtons: {
28
29
  hideZoomTool: false,
@@ -23,6 +23,7 @@ exports.process1D = {
23
23
  hideSummaryPanel: true,
24
24
  hideMultipleSpectraAnalysisPanel: true,
25
25
  hideDatabasePanel: false,
26
+ hidePredictionPanel: false,
26
27
  },
27
28
  toolBarButtons: {
28
29
  hideZoomTool: false,
@@ -3,13 +3,44 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateSpectra = exports.predictSpectra = void 0;
6
+ exports.generateSpectra = exports.predictSpectra = exports.FREQUENCIES = exports.defaultPredictionOptions = void 0;
7
7
  const nmr_processing_1 = require("nmr-processing");
8
8
  const full_1 = __importDefault(require("openchemlib/full"));
9
9
  const SignalsKinds_1 = require("./constants/SignalsKinds");
10
10
  const Spectrum1D_1 = require("./data1d/Spectrum1D");
11
11
  const Spectrum2D_1 = require("./data2d/Spectrum2D");
12
12
  const generateID_1 = __importDefault(require("./utilities/generateID"));
13
+ exports.defaultPredictionOptions = {
14
+ frequency: 400,
15
+ '1d': {
16
+ '1H': { from: -1, to: 12 },
17
+ '13C': { from: -5, to: 220 },
18
+ nbPoints: 2 ** 17,
19
+ lineWidth: 1,
20
+ },
21
+ '2d': {
22
+ nbPoints: { x: 1024, y: 1024 },
23
+ },
24
+ spectra: {
25
+ proton: true,
26
+ carbon: true,
27
+ cosy: true,
28
+ hsqc: true,
29
+ hmbc: true,
30
+ },
31
+ };
32
+ exports.FREQUENCIES = [
33
+ { key: 1, value: 60, label: '60 MHz' },
34
+ { key: 2, value: 100, label: '100 MHz' },
35
+ { key: 3, value: 200, label: '200 MHz' },
36
+ { key: 4, value: 300, label: '300 MHz' },
37
+ { key: 5, value: 400, label: '400 MHz' },
38
+ { key: 6, value: 500, label: '500 MHz' },
39
+ { key: 7, value: 600, label: '600 MHz' },
40
+ { key: 8, value: 800, label: '800 MHz' },
41
+ { key: 9, value: 1000, label: '1000 MHz' },
42
+ { key: 10, value: 1200, label: '1200 MHz' },
43
+ ];
13
44
  const baseURL = 'https://nmr-prediction.service.zakodium.com';
14
45
  async function predictSpectra(molfile) {
15
46
  const molecule = full_1.default.Molecule.fromMolfile(molfile);
@@ -22,8 +53,9 @@ async function predictSpectra(molfile) {
22
53
  });
23
54
  }
24
55
  exports.predictSpectra = predictSpectra;
25
- function generateSpectra(data, inputOptions, usedColors) {
56
+ function generateSpectra(data, inputOptions) {
26
57
  const spectra = [];
58
+ const color = '#593315';
27
59
  for (const experiment in data) {
28
60
  if (inputOptions.spectra[experiment]) {
29
61
  const spectrum = data[experiment];
@@ -34,7 +66,7 @@ function generateSpectra(data, inputOptions, usedColors) {
34
66
  spectrum,
35
67
  inputOptions,
36
68
  experiment,
37
- usedColors,
69
+ color,
38
70
  });
39
71
  spectra.push(datum);
40
72
  break;
@@ -46,7 +78,7 @@ function generateSpectra(data, inputOptions, usedColors) {
46
78
  spectrum,
47
79
  inputOptions,
48
80
  experiment,
49
- usedColors,
81
+ color,
50
82
  });
51
83
  spectra.push(datum);
52
84
  break;
@@ -60,7 +92,7 @@ function generateSpectra(data, inputOptions, usedColors) {
60
92
  }
61
93
  exports.generateSpectra = generateSpectra;
62
94
  function generated1DSpectrum(params) {
63
- const { spectrum, inputOptions, experiment, usedColors } = params;
95
+ const { spectrum, inputOptions, experiment, color } = params;
64
96
  const { signals, ranges, nucleus } = spectrum;
65
97
  const { '1d': { nbPoints }, frequency: freq, } = inputOptions;
66
98
  const frequency = getFrequency(nucleus, freq);
@@ -71,6 +103,9 @@ function generated1DSpectrum(params) {
71
103
  });
72
104
  const datum = (0, Spectrum1D_1.initiateDatum1D)({
73
105
  data: { x, im: null, re: y },
106
+ display: {
107
+ color,
108
+ },
74
109
  info: {
75
110
  nucleus,
76
111
  originFrequency: frequency,
@@ -80,7 +115,7 @@ function generated1DSpectrum(params) {
80
115
  experiment,
81
116
  isFt: true,
82
117
  },
83
- }, usedColors);
118
+ }, []);
84
119
  datum.ranges.values = (0, Spectrum1D_1.mapRanges)(ranges, datum);
85
120
  (0, Spectrum1D_1.updateIntegralsRelativeValues)(datum);
86
121
  return datum;
@@ -109,7 +144,7 @@ function mapZones(zones) {
109
144
  }, []);
110
145
  }
111
146
  function generated2DSpectrum(params) {
112
- const { spectrum, inputOptions, experiment, usedColors } = params;
147
+ const { spectrum, inputOptions, experiment, color } = params;
113
148
  const { signals, zones, nuclei } = spectrum;
114
149
  const xOption = inputOptions['1d'][nuclei[0]];
115
150
  const yOption = inputOptions['1d'][nuclei[1]];
@@ -126,6 +161,9 @@ function generated2DSpectrum(params) {
126
161
  });
127
162
  const datum = (0, Spectrum2D_1.initiateDatum2D)({
128
163
  data: { ...spectrumData, noise: 0.01 },
164
+ display: {
165
+ positiveColor: experiment === 'hmbc' ? '#e68337' : color,
166
+ },
129
167
  info: {
130
168
  nucleus: nuclei,
131
169
  originFrequency: frequency,
@@ -133,7 +171,7 @@ function generated2DSpectrum(params) {
133
171
  pulseSequence: experiment,
134
172
  experiment: '2d',
135
173
  },
136
- }, usedColors);
174
+ }, []);
137
175
  datum.zones.values = mapZones(zones);
138
176
  return datum;
139
177
  }
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = { version: 'v0.22.0' };
3
+ exports.default = { version: 'v0.23.0' };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nmrium",
3
3
  "description": "React component to display and process nuclear magnetic resonance (NMR) spectra.",
4
- "version": "0.22.0",
4
+ "version": "0.23.0",
5
5
  "license": "MIT",
6
6
  "main": "lib-cjs/component/NMRium.js",
7
7
  "module": "lib/component/NMRium.js",