nmrium 0.53.0 → 0.54.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/lib/component/1d/Viewer1D.js +48 -17
- package/lib/component/1d/ranges/Range.js +14 -6
- package/lib/component/1d/tool/XLabelPointer.js +4 -12
- package/lib/component/2d/tools/XYLabelPointer.js +3 -9
- package/lib/component/context/LoggerContext.js +11 -4
- package/lib/component/elements/CloseButton.d.ts +1 -1
- package/lib/component/elements/CustomToolTip.d.ts +8 -0
- package/lib/component/elements/CustomToolTip.js +107 -0
- package/lib/component/elements/EditableColumn.js +3 -2
- package/lib/component/elements/SaveButton.d.ts +1 -1
- package/lib/component/elements/formik/FormikError.js +2 -4
- package/lib/component/elements/formik/FormikInput.js +2 -2
- package/lib/component/header/Header.js +1 -1
- package/lib/component/header/PhaseCorrectionTwoDimensionsPanel.js +41 -10
- package/lib/component/main/NMRiumStateProvider.js +11 -1
- package/lib/component/modal/AboutPredictionModal.js +1 -1
- package/lib/component/modal/AboutSpectrumSimulationModal.js +1 -1
- package/lib/component/modal/CopyClipboardModal.js +1 -1
- package/lib/component/modal/EditPeakShapeModal.js +1 -1
- package/lib/component/modal/ImportPublicationStringModal.js +11 -5
- package/lib/component/modal/PredictSpectraModal.js +1 -1
- package/lib/component/modal/aboutUs/AboutUsModal.js +1 -1
- package/lib/component/modal/changeSum/ChangeSumModal.js +1 -1
- package/lib/component/modal/editRange/EditRangeModal.js +1 -1
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalJCouplingsTable.js +1 -1
- package/lib/component/modal/editRange/forms/components/signal-tabs/SignalPeaksTable.js +1 -1
- package/lib/component/modal/editZone/EditZoneModal.js +1 -1
- package/lib/component/modal/setting/GeneralSettings.js +12 -19
- package/lib/component/panels/AutomaticAssignment/AutomaticAssignment.js +2 -2
- package/lib/component/panels/IntegralsPanel/IntegralPanel.js +2 -2
- package/lib/component/panels/MatrixGenerationPanel/MatrixGenerationPanel.js +2 -2
- package/lib/component/panels/MoleculesPanel/MoleculePanelHeader.js +1 -1
- package/lib/component/panels/PeaksPanel/PeaksPanel.js +5 -5
- package/lib/component/panels/RangesPanel/RangesHeader.js +11 -11
- package/lib/component/panels/RangesPanel/RangesPreferences.js +16 -16
- package/lib/component/panels/RangesPanel/RangesTable.js +1 -1
- package/lib/component/panels/RangesPanel/RangesTableRow.js +2 -2
- package/lib/component/panels/SpectraPanel/SpectraPanelHeader.js +22 -8
- package/lib/component/panels/SummaryPanel/CorrelationTable/editLink/EditLinkModal.js +1 -1
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.d.ts +5 -5
- package/lib/component/panels/SummaryPanel/SetMolecularFormulaModal.js +79 -89
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.d.ts +5 -4
- package/lib/component/panels/SummaryPanel/SetShiftTolerancesModal.js +66 -98
- package/lib/component/panels/SummaryPanel/SummaryPanel.js +13 -32
- package/lib/component/panels/ZonesPanel/ZonesPanel.js +4 -4
- package/lib/component/panels/databasePanel/DatabaseSearchOptions.js +2 -2
- package/lib/component/panels/header/DefaultPanelHeader.js +2 -2
- package/lib/component/panels/header/PreferencesHeader.js +1 -1
- package/lib/component/panels/header/SpectraAutomaticPickingButton.js +1 -1
- package/lib/component/panels/multipleAnalysisPanel/MultipleSpectraAnalysisPanel.js +4 -4
- package/lib/component/reducer/Reducer.js +2 -0
- package/lib/component/reducer/actions/FiltersActions.d.ts +3 -2
- package/lib/component/reducer/actions/FiltersActions.js +27 -1
- package/lib/component/reducer/actions/MoleculeActions.js +1 -1
- package/lib/component/reducer/actions/RangesActions.d.ts +2 -3
- package/lib/component/reducer/actions/RangesActions.js +16 -20
- package/lib/component/reducer/actions/SpectraActions.d.ts +5 -4
- package/lib/component/reducer/actions/SpectraActions.js +5 -1
- package/lib/component/reducer/preferences/actions/setWorkspace.js +4 -3
- package/lib/component/toolbar/ToolBar.js +111 -25
- package/lib/component/workspaces/workspaceDefaultProperties.js +7 -12
- package/lib/data/data1d/Spectrum1D/get1DColor.d.ts +10 -3
- package/lib/data/data1d/Spectrum1D/get1DColor.js +28 -2
- package/lib/data/data1d/Spectrum1D/index.d.ts +2 -2
- package/lib/data/data1d/Spectrum1D/index.js +2 -2
- package/lib/data/data1d/Spectrum1D/ranges/createRange.d.ts +50 -0
- package/lib/data/data1d/Spectrum1D/ranges/createRange.js +51 -0
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.d.ts +2 -1
- package/lib/data/data1d/Spectrum1D/ranges/detectSignals.js +4 -2
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.d.ts +52 -0
- package/lib/data/data1d/Spectrum1D/ranges/resizeRange.js +28 -0
- package/lib/data/data2d/Spectrum2D/get2DColor.d.ts +11 -3
- package/lib/data/data2d/Spectrum2D/get2DColor.js +20 -4
- package/lib/data/data2d/Spectrum2D/getSlice.js +1 -1
- package/lib/data/data2d/Spectrum2D/zones/detectZonesManual.d.ts +1 -0
- package/lib/data/data2d/Spectrum2D/zones/initiateZones.d.ts +1 -0
- package/lib/data/utilities/generateColor.d.ts +7 -3
- package/lib/data/utilities/generateColor.js +5 -17
- package/lib/versionInfo.js +1 -1
- package/package.json +20 -20
- package/lib/component/elements/MolecularFormulaInput.d.ts +0 -6
- package/lib/component/elements/MolecularFormulaInput.js +0 -63
- package/lib/data/data1d/Spectrum1D/ranges/addRange.d.ts +0 -7
- package/lib/data/data1d/Spectrum1D/ranges/addRange.js +0 -31
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.d.ts +0 -3
- package/lib/data/data1d/Spectrum1D/ranges/changeRange.js +0 -32
|
@@ -1,15 +1,41 @@
|
|
|
1
1
|
import { generateColor } from '../../utilities/generateColor';
|
|
2
2
|
import { getCustomColor } from '../../utilities/getCustomColor';
|
|
3
|
+
function isRandomColorGeneration(options) {
|
|
4
|
+
return 'random' in options;
|
|
5
|
+
}
|
|
6
|
+
export const COLORS = [
|
|
7
|
+
'#C10020',
|
|
8
|
+
'#007D34',
|
|
9
|
+
'#803E75',
|
|
10
|
+
'#FF6800',
|
|
11
|
+
'#B32851',
|
|
12
|
+
'#7F180D',
|
|
13
|
+
'#232C16',
|
|
14
|
+
'#A6BDD7',
|
|
15
|
+
'#CEA262',
|
|
16
|
+
'#817066',
|
|
17
|
+
'#FF8E00',
|
|
18
|
+
'#F6768E',
|
|
19
|
+
'#00538A',
|
|
20
|
+
'#FF7A5C',
|
|
21
|
+
'#53377A',
|
|
22
|
+
'#FFB300',
|
|
23
|
+
'#F4C800',
|
|
24
|
+
'#93AA00',
|
|
25
|
+
'#593315',
|
|
26
|
+
'#F13A13',
|
|
27
|
+
];
|
|
3
28
|
export function get1DColor(spectrum, options) {
|
|
4
29
|
const { regenerate = false, usedColors = {}, colors } = options;
|
|
5
30
|
let color = 'black';
|
|
6
31
|
if (!spectrum?.display?.color || regenerate) {
|
|
7
32
|
const customColor = getCustomColor(spectrum, colors);
|
|
8
|
-
|
|
33
|
+
const isRandom = isRandomColorGeneration(options) && options.random;
|
|
34
|
+
if (customColor && !isRandom) {
|
|
9
35
|
color = customColor;
|
|
10
36
|
}
|
|
11
37
|
else {
|
|
12
|
-
color = generateColor(
|
|
38
|
+
color = generateColor({ usedColors: usedColors?.['1d'] || [] });
|
|
13
39
|
}
|
|
14
40
|
}
|
|
15
41
|
else {
|
|
@@ -5,8 +5,8 @@ export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
|
|
|
5
5
|
export { isSpectrum1D } from './isSpectrum1D';
|
|
6
6
|
export { autoPeakPicking } from './peaks/autoPeakPicking';
|
|
7
7
|
export { optimizePeaks } from './peaks/optimizePeaks';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { createRange } from './ranges/createRange';
|
|
9
|
+
export { resizeRange } from './ranges/resizeRange';
|
|
10
10
|
export { changeRangeRelativeValue } from './ranges/changeRangeRelativeValue';
|
|
11
11
|
export { changeRangeSignal } from './ranges/changeRangeSignal';
|
|
12
12
|
export { checkRangeKind } from './ranges/checkRangeKind';
|
|
@@ -5,8 +5,8 @@ export { changeIntegralsRelative } from './integrals/changeIntegralsRelative';
|
|
|
5
5
|
export { isSpectrum1D } from './isSpectrum1D';
|
|
6
6
|
export { autoPeakPicking } from './peaks/autoPeakPicking';
|
|
7
7
|
export { optimizePeaks } from './peaks/optimizePeaks';
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
8
|
+
export { createRange } from './ranges/createRange';
|
|
9
|
+
export { resizeRange } from './ranges/resizeRange';
|
|
10
10
|
export { changeRangeRelativeValue } from './ranges/changeRangeRelativeValue';
|
|
11
11
|
export { changeRangeSignal } from './ranges/changeRangeSignal';
|
|
12
12
|
export { checkRangeKind } from './ranges/checkRangeKind';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Logger } from 'cheminfo-types';
|
|
2
|
+
import { Spectrum1D } from 'nmr-load-save';
|
|
3
|
+
import { Range } from 'nmr-processing';
|
|
4
|
+
export declare function cutRange(spectrum: Spectrum1D, x: number): Record<string, Range[]>;
|
|
5
|
+
export declare function createRange(spectrum: Spectrum1D, options: Pick<Range, 'from' | 'to'> & {
|
|
6
|
+
logger?: Logger;
|
|
7
|
+
}): {
|
|
8
|
+
absolute: number;
|
|
9
|
+
signals: {
|
|
10
|
+
originalDelta: number | undefined;
|
|
11
|
+
delta: number;
|
|
12
|
+
multiplicity: string;
|
|
13
|
+
js: import("nmr-processing").Jcoupling[];
|
|
14
|
+
atoms?: number[] | undefined;
|
|
15
|
+
assignment?: string | undefined;
|
|
16
|
+
diaIDs?: string[] | undefined;
|
|
17
|
+
nbAtoms?: number | undefined;
|
|
18
|
+
integration?: number | undefined;
|
|
19
|
+
statistic?: {
|
|
20
|
+
mean: number;
|
|
21
|
+
sd: number;
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
nb: number;
|
|
25
|
+
} | undefined;
|
|
26
|
+
kind: string;
|
|
27
|
+
id: string;
|
|
28
|
+
peaks: {
|
|
29
|
+
originalX: number;
|
|
30
|
+
x: number;
|
|
31
|
+
id: string;
|
|
32
|
+
kind?: string | undefined;
|
|
33
|
+
shape?: import("ml-peak-shape-generator").Shape1D | undefined;
|
|
34
|
+
y: number;
|
|
35
|
+
width: number;
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
38
|
+
originalFrom: number | undefined;
|
|
39
|
+
originalTo: number | undefined;
|
|
40
|
+
from: number;
|
|
41
|
+
to: number;
|
|
42
|
+
id: string;
|
|
43
|
+
kind: string;
|
|
44
|
+
integration: number;
|
|
45
|
+
nbAtoms?: number | undefined;
|
|
46
|
+
multiplicity?: string | undefined;
|
|
47
|
+
assignment?: string | undefined;
|
|
48
|
+
diaIDs?: string[] | undefined;
|
|
49
|
+
pubIntegral?: number | undefined;
|
|
50
|
+
} | undefined;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { xyIntegration } from 'ml-spectra-processing';
|
|
2
|
+
import { mapRanges } from 'nmr-processing';
|
|
3
|
+
import detectSignals from './detectSignals';
|
|
4
|
+
export function cutRange(spectrum, x) {
|
|
5
|
+
const cutRanges = {};
|
|
6
|
+
for (const range of spectrum?.ranges?.values || []) {
|
|
7
|
+
const { to, from, id } = range;
|
|
8
|
+
if (x > from && x < to) {
|
|
9
|
+
const leftRange = createRange(spectrum, { from, to: x });
|
|
10
|
+
const rightRange = createRange(spectrum, {
|
|
11
|
+
from: x,
|
|
12
|
+
to,
|
|
13
|
+
});
|
|
14
|
+
cutRanges[id] = [];
|
|
15
|
+
if (leftRange) {
|
|
16
|
+
cutRanges[id].push(leftRange);
|
|
17
|
+
}
|
|
18
|
+
if (rightRange) {
|
|
19
|
+
cutRanges[id].push(rightRange);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return cutRanges;
|
|
24
|
+
}
|
|
25
|
+
export function createRange(spectrum, options) {
|
|
26
|
+
const { from, to, logger } = options;
|
|
27
|
+
const { x, re: y } = spectrum.data;
|
|
28
|
+
const { nucleus, originFrequency: frequency } = spectrum.info;
|
|
29
|
+
const absolute = xyIntegration({ x, y }, { from, to });
|
|
30
|
+
const signals = detectSignals({ x, y }, {
|
|
31
|
+
logger,
|
|
32
|
+
from,
|
|
33
|
+
to,
|
|
34
|
+
nucleus,
|
|
35
|
+
frequency,
|
|
36
|
+
}) || [];
|
|
37
|
+
const range = {
|
|
38
|
+
from,
|
|
39
|
+
to,
|
|
40
|
+
absolute,
|
|
41
|
+
signals: signals,
|
|
42
|
+
};
|
|
43
|
+
try {
|
|
44
|
+
const [newRange] = mapRanges([range], spectrum);
|
|
45
|
+
return newRange;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
reportError(error);
|
|
49
|
+
logger?.error('Could not calculate the multiplicity');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DataXY } from 'cheminfo-types';
|
|
1
|
+
import { DataXY, Logger } from 'cheminfo-types';
|
|
2
2
|
export default function detectSignals(data: DataXY<Float64Array>, options: {
|
|
3
3
|
from: number;
|
|
4
4
|
to: number;
|
|
5
|
+
logger?: Logger;
|
|
5
6
|
nucleus: string;
|
|
6
7
|
frequency: number;
|
|
7
8
|
}): {
|
|
@@ -3,10 +3,12 @@ import { xyAutoRangesPicking } from 'nmr-processing';
|
|
|
3
3
|
import { detectSignalsByMultipletAnalysis } from './detectSignalsByMultipletAnalysis';
|
|
4
4
|
const MAX_LENGTH = 4092;
|
|
5
5
|
export default function detectSignals(data, options) {
|
|
6
|
-
const { from, to, frequency, nucleus } = options;
|
|
6
|
+
const { from, to, frequency, nucleus, logger } = options;
|
|
7
7
|
const { fromIndex, toIndex } = xGetFromToIndex(data.x, { from, to });
|
|
8
|
-
|
|
8
|
+
const size = toIndex - fromIndex;
|
|
9
|
+
if (size <= 16 || size >= MAX_LENGTH) {
|
|
9
10
|
const ranges = xyAutoRangesPicking(data, {
|
|
11
|
+
logger,
|
|
10
12
|
peakPicking: {
|
|
11
13
|
sgOptions: {
|
|
12
14
|
windowSize: 7,
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Logger } from 'cheminfo-types';
|
|
2
|
+
import { Spectrum1D } from 'nmr-load-save';
|
|
3
|
+
import { Range } from 'nmr-processing';
|
|
4
|
+
export declare function resizeRange(spectrum: Spectrum1D, options: {
|
|
5
|
+
range: Range;
|
|
6
|
+
from: number;
|
|
7
|
+
to: number;
|
|
8
|
+
logger?: Logger;
|
|
9
|
+
}): {
|
|
10
|
+
absolute: number;
|
|
11
|
+
signals: {
|
|
12
|
+
originalDelta: number | undefined;
|
|
13
|
+
delta: number;
|
|
14
|
+
multiplicity: string;
|
|
15
|
+
js: import("nmr-processing").Jcoupling[];
|
|
16
|
+
atoms?: number[] | undefined;
|
|
17
|
+
assignment?: string | undefined;
|
|
18
|
+
diaIDs?: string[] | undefined;
|
|
19
|
+
nbAtoms?: number | undefined;
|
|
20
|
+
integration?: number | undefined;
|
|
21
|
+
statistic?: {
|
|
22
|
+
mean: number;
|
|
23
|
+
sd: number;
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
nb: number;
|
|
27
|
+
} | undefined;
|
|
28
|
+
kind: string;
|
|
29
|
+
id: string;
|
|
30
|
+
peaks: {
|
|
31
|
+
originalX: number;
|
|
32
|
+
x: number;
|
|
33
|
+
id: string;
|
|
34
|
+
kind?: string | undefined;
|
|
35
|
+
shape?: import("ml-peak-shape-generator").Shape1D | undefined;
|
|
36
|
+
y: number;
|
|
37
|
+
width: number;
|
|
38
|
+
}[];
|
|
39
|
+
}[];
|
|
40
|
+
originalFrom: number | undefined;
|
|
41
|
+
originalTo: number | undefined;
|
|
42
|
+
from: number;
|
|
43
|
+
to: number;
|
|
44
|
+
id: string;
|
|
45
|
+
kind: string;
|
|
46
|
+
integration: number;
|
|
47
|
+
nbAtoms?: number | undefined;
|
|
48
|
+
multiplicity?: string | undefined;
|
|
49
|
+
assignment?: string | undefined;
|
|
50
|
+
diaIDs?: string[] | undefined;
|
|
51
|
+
pubIntegral?: number | undefined;
|
|
52
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { xyIntegration } from 'ml-spectra-processing';
|
|
2
|
+
import { mapRanges } from 'nmr-processing';
|
|
3
|
+
import detectSignals from './detectSignals';
|
|
4
|
+
export function resizeRange(spectrum, options) {
|
|
5
|
+
const { range, from, to, logger } = options;
|
|
6
|
+
const { x, re: y } = spectrum.data;
|
|
7
|
+
const { originFrequency: frequency, nucleus } = spectrum.info;
|
|
8
|
+
const absolute = xyIntegration({ x, y }, { from, to });
|
|
9
|
+
const signals = detectSignals({ x, y }, {
|
|
10
|
+
from,
|
|
11
|
+
to,
|
|
12
|
+
nucleus,
|
|
13
|
+
frequency,
|
|
14
|
+
logger,
|
|
15
|
+
});
|
|
16
|
+
const [newRange] = mapRanges([
|
|
17
|
+
{
|
|
18
|
+
...range,
|
|
19
|
+
originalFrom: from,
|
|
20
|
+
originalTo: to,
|
|
21
|
+
from,
|
|
22
|
+
to,
|
|
23
|
+
absolute,
|
|
24
|
+
signals,
|
|
25
|
+
},
|
|
26
|
+
], spectrum);
|
|
27
|
+
return newRange;
|
|
28
|
+
}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { Color2D, SpectrumTwoDimensionsColor } from 'nmr-load-save';
|
|
2
2
|
import { UsedColors } from '../../../types/UsedColors';
|
|
3
|
-
interface
|
|
3
|
+
interface BaseColorOptions {
|
|
4
4
|
usedColors?: UsedColors;
|
|
5
5
|
colors?: SpectrumTwoDimensionsColor[];
|
|
6
|
-
regenerate?: boolean;
|
|
7
6
|
}
|
|
8
|
-
|
|
7
|
+
interface ColorOptions extends BaseColorOptions {
|
|
8
|
+
regenerate?: false;
|
|
9
|
+
}
|
|
10
|
+
interface RandomColorOptions extends BaseColorOptions {
|
|
11
|
+
regenerate: true;
|
|
12
|
+
random?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function get2DColor(spectrum: any, options: ColorOptions | RandomColorOptions): Color2D;
|
|
15
|
+
type ExperimentType = 'cosy' | 'roesy' | 'noesy' | 'tocsy' | 'hsqc' | 'hmbc';
|
|
16
|
+
export declare const color2D: Readonly<Record<ExperimentType, Color2D>>;
|
|
9
17
|
export {};
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { adjustAlpha, generateColor } from '../../utilities/generateColor';
|
|
2
2
|
import { getCustomColor } from '../../utilities/getCustomColor';
|
|
3
|
+
function isRandomColorGeneration(options) {
|
|
4
|
+
return 'random' in options;
|
|
5
|
+
}
|
|
3
6
|
export function get2DColor(spectrum, options) {
|
|
4
7
|
const { regenerate = false, usedColors = {}, colors } = options;
|
|
5
8
|
let color = {};
|
|
6
9
|
if (spectrum?.display?.negativeColor === undefined ||
|
|
7
10
|
spectrum?.display?.positiveColor === undefined ||
|
|
8
11
|
regenerate) {
|
|
9
|
-
const
|
|
10
|
-
|
|
12
|
+
const isRandom = isRandomColorGeneration(options) && options.random;
|
|
13
|
+
const customColor = getCustomColor(spectrum, colors) || color2D?.[spectrum.info.experiment];
|
|
14
|
+
if (customColor && !isRandom) {
|
|
11
15
|
color = customColor;
|
|
12
16
|
}
|
|
13
17
|
else {
|
|
14
|
-
|
|
18
|
+
const positiveColor = generateColor({
|
|
19
|
+
usedColors: usedColors?.['2d'] || [],
|
|
20
|
+
});
|
|
21
|
+
const negativeColor = adjustAlpha(positiveColor, 50);
|
|
22
|
+
color = { positiveColor, negativeColor };
|
|
15
23
|
}
|
|
16
24
|
}
|
|
17
25
|
else {
|
|
@@ -23,3 +31,11 @@ export function get2DColor(spectrum, options) {
|
|
|
23
31
|
}
|
|
24
32
|
return color;
|
|
25
33
|
}
|
|
34
|
+
export const color2D = {
|
|
35
|
+
cosy: { positiveColor: 'darkblue', negativeColor: 'blue' },
|
|
36
|
+
roesy: { positiveColor: 'pink', negativeColor: 'yellow' },
|
|
37
|
+
noesy: { positiveColor: 'pink', negativeColor: 'yellow' },
|
|
38
|
+
tocsy: { positiveColor: 'green', negativeColor: 'yellow' },
|
|
39
|
+
hsqc: { positiveColor: 'black', negativeColor: 'yellow' },
|
|
40
|
+
hmbc: { positiveColor: 'darkviolet', negativeColor: 'yellow' },
|
|
41
|
+
};
|
|
@@ -50,8 +50,8 @@ export function getSlice(spectrum, position, options = {}) {
|
|
|
50
50
|
});
|
|
51
51
|
if (imaginaryVerticalData) {
|
|
52
52
|
infoY.isComplex = true;
|
|
53
|
+
dataY.im = new Float64Array(yLength);
|
|
53
54
|
for (let i = 0; i < yLength; i++) {
|
|
54
|
-
dataY.im = new Float64Array(yLength);
|
|
55
55
|
dataY.im[i] += imaginaryVerticalData.z[i][xIndex];
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { Color2D } from 'nmr-load-save';
|
|
2
1
|
export declare const COLORS: string[];
|
|
3
|
-
export declare function generate2DColor(experiment: string, colors?: never[]): Color2D;
|
|
4
2
|
export declare function adjustAlpha(color: string, factor: number): string;
|
|
5
|
-
|
|
3
|
+
interface Options {
|
|
4
|
+
isRandom?: boolean;
|
|
5
|
+
usedColors?: string[];
|
|
6
|
+
opacity?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function generateColor(options: Options): string;
|
|
9
|
+
export {};
|
|
@@ -20,22 +20,6 @@ export const COLORS = [
|
|
|
20
20
|
'#593315',
|
|
21
21
|
'#F13A13',
|
|
22
22
|
];
|
|
23
|
-
const color2D = {
|
|
24
|
-
cosy: { positiveColor: 'darkblue', negativeColor: 'blue' },
|
|
25
|
-
roesy: { positiveColor: '#e75480', negativeColor: 'yellow' },
|
|
26
|
-
noesy: { positiveColor: '#e75480', negativeColor: 'yellow' },
|
|
27
|
-
tocsy: { positiveColor: 'green', negativeColor: 'yellow' },
|
|
28
|
-
hsqc: { positiveColor: 'black', negativeColor: 'yellow' },
|
|
29
|
-
hmbc: { positiveColor: 'darkviolet', negativeColor: 'yellow' },
|
|
30
|
-
};
|
|
31
|
-
export function generate2DColor(experiment, colors = []) {
|
|
32
|
-
if (!color2D[experiment]) {
|
|
33
|
-
const positiveColor = generateColor(false, colors);
|
|
34
|
-
const negativeColor = adjustAlpha(positiveColor, 50);
|
|
35
|
-
return { positiveColor, negativeColor };
|
|
36
|
-
}
|
|
37
|
-
return color2D[experiment];
|
|
38
|
-
}
|
|
39
23
|
function percentToHex(p) {
|
|
40
24
|
const percent = Math.max(0, Math.min(100, p));
|
|
41
25
|
const intValue = Math.round((percent / 100) * 255);
|
|
@@ -45,7 +29,11 @@ function percentToHex(p) {
|
|
|
45
29
|
export function adjustAlpha(color, factor) {
|
|
46
30
|
return color + percentToHex(factor);
|
|
47
31
|
}
|
|
48
|
-
export function generateColor(
|
|
32
|
+
export function generateColor(options) {
|
|
33
|
+
const { isRandom = false, usedColors = [], opacity = 100 } = options;
|
|
34
|
+
if (opacity > 100 || opacity < 0) {
|
|
35
|
+
throw new Error(`Opacity value must be within the range of 0 to 100`);
|
|
36
|
+
}
|
|
49
37
|
const resetColors = COLORS.filter((c) => !usedColors.includes(c));
|
|
50
38
|
if (resetColors.length > 0 && !isRandom) {
|
|
51
39
|
return resetColors[0] + percentToHex(opacity);
|
package/lib/versionInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default { version: 'v0.
|
|
1
|
+
export default { version: 'v0.54.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.
|
|
4
|
+
"version": "0.54.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "lib/component/main/index.js",
|
|
7
7
|
"types": "lib/component/main/index.d.ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@blueprintjs/icons": "^5.9.0",
|
|
62
62
|
"@blueprintjs/select": "^5.1.3",
|
|
63
63
|
"@emotion/react": "^11.11.4",
|
|
64
|
-
"@emotion/styled": "^11.11.
|
|
64
|
+
"@emotion/styled": "^11.11.5",
|
|
65
65
|
"@lukeed/uuid": "^2.0.1",
|
|
66
66
|
"cheminfo-font": "^1.13.0",
|
|
67
67
|
"cheminfo-types": "^1.7.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"convert-to-jcamp": "^5.4.10",
|
|
70
70
|
"d3": "^7.9.0",
|
|
71
71
|
"eventemitter3": "^5.0.1",
|
|
72
|
-
"fifo-logger": "^0.
|
|
72
|
+
"fifo-logger": "^1.0.0",
|
|
73
73
|
"file-saver": "^2.0.5",
|
|
74
74
|
"filelist-utils": "^1.11.0",
|
|
75
75
|
"formik": "^2.4.5",
|
|
@@ -85,30 +85,30 @@
|
|
|
85
85
|
"ml-gsd": "^12.1.6",
|
|
86
86
|
"ml-matrix": "^6.11.0",
|
|
87
87
|
"ml-signal-processing": "^1.0.4",
|
|
88
|
-
"ml-spectra-processing": "^14.
|
|
88
|
+
"ml-spectra-processing": "^14.3.0",
|
|
89
89
|
"ml-stat": "^1.3.3",
|
|
90
90
|
"ml-tree-similarity": "^2.2.0",
|
|
91
91
|
"multiplet-analysis": "^2.1.2",
|
|
92
92
|
"nmr-correlation": "^2.3.3",
|
|
93
|
-
"nmr-load-save": "^0.29.
|
|
94
|
-
"nmr-processing": "^12.0
|
|
93
|
+
"nmr-load-save": "^0.29.3",
|
|
94
|
+
"nmr-processing": "^12.2.0",
|
|
95
95
|
"nmredata": "^0.9.9",
|
|
96
96
|
"numeral": "^2.0.6",
|
|
97
97
|
"openchemlib": "^8.9.0",
|
|
98
|
-
"openchemlib-utils": "^5.
|
|
98
|
+
"openchemlib-utils": "^5.15.0",
|
|
99
99
|
"papaparse": "^5.4.1",
|
|
100
100
|
"re-resizable": "6.9.11",
|
|
101
101
|
"react-d3-utils": "^1.0.0",
|
|
102
102
|
"react-dropzone": "^14.2.3",
|
|
103
103
|
"react-error-boundary": "^4.0.13",
|
|
104
|
-
"react-icons": "^5.0
|
|
104
|
+
"react-icons": "^5.1.0",
|
|
105
105
|
"react-inspector": "^6.0.2",
|
|
106
106
|
"react-mf": "^2.0.2",
|
|
107
107
|
"react-ocl": "^6.1.0",
|
|
108
108
|
"react-ocl-nmr": "^3.0.1",
|
|
109
109
|
"react-plot": "^1.4.2",
|
|
110
110
|
"react-rnd": "^10.4.1",
|
|
111
|
-
"react-science": "^1.0
|
|
111
|
+
"react-science": "^3.1.0",
|
|
112
112
|
"react-slider": "^2.0.6",
|
|
113
113
|
"react-table": "^7.8.0",
|
|
114
114
|
"react-transition-group": "^4.4.5",
|
|
@@ -120,22 +120,22 @@
|
|
|
120
120
|
"@babel/plugin-transform-modules-commonjs": "^7.24.1",
|
|
121
121
|
"@babel/preset-react": "^7.24.1",
|
|
122
122
|
"@babel/preset-typescript": "^7.24.1",
|
|
123
|
-
"@playwright/test": "^1.
|
|
123
|
+
"@playwright/test": "^1.43.1",
|
|
124
124
|
"@simbathesailor/use-what-changed": "^2.0.0",
|
|
125
125
|
"@types/d3": "^7.4.3",
|
|
126
126
|
"@types/lodash": "^4.17.0",
|
|
127
|
-
"@types/node": "^20.
|
|
127
|
+
"@types/node": "^20.12.7",
|
|
128
128
|
"@types/papaparse": "^5.3.14",
|
|
129
|
-
"@types/react": "^18.2.
|
|
130
|
-
"@types/react-dom": "^18.2.
|
|
129
|
+
"@types/react": "^18.2.79",
|
|
130
|
+
"@types/react-dom": "^18.2.25",
|
|
131
131
|
"@types/react-table": "^7.7.20",
|
|
132
132
|
"@vitejs/plugin-react-swc": "^3.6.0",
|
|
133
|
-
"@vitest/coverage-v8": "^1.
|
|
133
|
+
"@vitest/coverage-v8": "^1.5.0",
|
|
134
134
|
"cross-env": "^7.0.3",
|
|
135
|
-
"cspell": "^8.
|
|
135
|
+
"cspell": "^8.7.0",
|
|
136
136
|
"eslint": "^8.57.0",
|
|
137
137
|
"eslint-config-cheminfo-react": "^11.0.1",
|
|
138
|
-
"eslint-config-cheminfo-typescript": "^12.
|
|
138
|
+
"eslint-config-cheminfo-typescript": "^12.3.0",
|
|
139
139
|
"modern-normalize": "^2.0.0",
|
|
140
140
|
"postcss-styled-syntax": "^0.6.4",
|
|
141
141
|
"prettier": "^3.2.5",
|
|
@@ -146,10 +146,10 @@
|
|
|
146
146
|
"rimraf": "^5.0.5",
|
|
147
147
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
148
148
|
"serve": "^14.2.1",
|
|
149
|
-
"stylelint": "^16.
|
|
149
|
+
"stylelint": "^16.3.1",
|
|
150
150
|
"stylelint-config-standard": "^36.0.0",
|
|
151
|
-
"typescript": "^5.4.
|
|
152
|
-
"vite": "^5.2.
|
|
153
|
-
"vitest": "^1.
|
|
151
|
+
"typescript": "^5.4.5",
|
|
152
|
+
"vite": "^5.2.9",
|
|
153
|
+
"vitest": "^1.5.0"
|
|
154
154
|
}
|
|
155
155
|
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
|
-
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import { css } from '@emotion/react';
|
|
4
|
-
import { useCallback, useState } from 'react';
|
|
5
|
-
import getAtomsFromMF from '../../data/utilities/getAtomsFromMF';
|
|
6
|
-
const inputStyle = css `
|
|
7
|
-
text-align: center;
|
|
8
|
-
|
|
9
|
-
input {
|
|
10
|
-
height: 100%;
|
|
11
|
-
width: 200px;
|
|
12
|
-
border-radius: 5px;
|
|
13
|
-
border: 0.55px solid #c7c7c7;
|
|
14
|
-
margin: 0 5px;
|
|
15
|
-
text-align: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
button {
|
|
19
|
-
flex: 2;
|
|
20
|
-
padding: 5px;
|
|
21
|
-
border: 1px solid gray;
|
|
22
|
-
border-radius: 5px;
|
|
23
|
-
height: 36px;
|
|
24
|
-
margin: 0 auto;
|
|
25
|
-
margin-top: 15px;
|
|
26
|
-
display: block;
|
|
27
|
-
width: 20%;
|
|
28
|
-
color: white;
|
|
29
|
-
background-color: gray;
|
|
30
|
-
}
|
|
31
|
-
`;
|
|
32
|
-
function isValidMf(mf) {
|
|
33
|
-
if (mf.trim().length === 0) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
getAtomsFromMF(mf);
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export default function MolecularFormulaInput({ onSave = () => null, previousMF, }) {
|
|
45
|
-
const [mf, setMF] = useState('');
|
|
46
|
-
const [isValidMF, setIsValidMF] = useState(true);
|
|
47
|
-
const [hasChanged, setHasChanged] = useState(false);
|
|
48
|
-
const onChangeHandler = useCallback((e) => {
|
|
49
|
-
setHasChanged(true);
|
|
50
|
-
if (isValidMf(e.target.value)) {
|
|
51
|
-
setIsValidMF(true);
|
|
52
|
-
setMF(e.target.value);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
setIsValidMF(false);
|
|
56
|
-
setMF('');
|
|
57
|
-
}
|
|
58
|
-
}, []);
|
|
59
|
-
const onSaveHandler = useCallback(() => {
|
|
60
|
-
onSave(hasChanged ? mf.trim() : previousMF);
|
|
61
|
-
}, [hasChanged, mf, onSave, previousMF]);
|
|
62
|
-
return (_jsxs("div", { css: inputStyle, children: [_jsx("input", { type: "text", onChange: onChangeHandler, defaultValue: previousMF }), _jsx("button", { type: "button", onClick: onSaveHandler, disabled: !isValidMF, children: isValidMF ? 'Set' : 'Invalid' })] }));
|
|
63
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { xyIntegration } from 'ml-spectra-processing';
|
|
2
|
-
import { mapRanges } from 'nmr-processing';
|
|
3
|
-
import detectSignals from './detectSignals';
|
|
4
|
-
export function addRange(spectrum, options) {
|
|
5
|
-
const { from, to } = options;
|
|
6
|
-
const { x, re: y } = spectrum.data;
|
|
7
|
-
const { nucleus, originFrequency: frequency } = spectrum.info;
|
|
8
|
-
const absolute = xyIntegration({ x, y }, { from, to });
|
|
9
|
-
const signals = detectSignals({ x, y }, {
|
|
10
|
-
from,
|
|
11
|
-
to,
|
|
12
|
-
nucleus,
|
|
13
|
-
frequency,
|
|
14
|
-
}) || [];
|
|
15
|
-
const range = {
|
|
16
|
-
from,
|
|
17
|
-
to,
|
|
18
|
-
absolute,
|
|
19
|
-
signals,
|
|
20
|
-
};
|
|
21
|
-
try {
|
|
22
|
-
spectrum.ranges.values = spectrum.ranges.values.concat(
|
|
23
|
-
// TODO: Check this error.
|
|
24
|
-
// @ts-expect-error To be checked
|
|
25
|
-
mapRanges([range], spectrum));
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
reportError(error);
|
|
29
|
-
throw new Error('Could not calculate the multiplicity');
|
|
30
|
-
}
|
|
31
|
-
}
|