nmr-processing 22.23.0 → 22.23.1

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.
@@ -95,10 +95,14 @@ import type { Shift2DXFilterOptions } from '@zakodium/nmr-types';
95
95
  import type { Shift2DYFilterOptions } from '@zakodium/nmr-types';
96
96
  import type { ShiftXFilterOptions } from '@zakodium/nmr-types';
97
97
  import type { ShiftXOptions } from '@zakodium/nmr-types';
98
+ import type { Signal1D } from '@zakodium/nmr-types';
98
99
  import type { Signal2D } from '@zakodium/nmr-types';
99
100
  import type { SignalKind } from '@zakodium/nmr-types';
100
101
  import type { SignalProcessingFilter } from '@zakodium/nmr-types';
101
102
  import type { SineBellOptions } from '@zakodium/nmr-types';
103
+ import type { Spectra } from '@zakodium/nmr-types';
104
+ import type { Spectrum } from '@zakodium/nmrium-core';
105
+ import type { Spectrum2D } from '@zakodium/nmr-types';
102
106
  import type { SymmetrizeCosyLikeOptions } from '@zakodium/nmr-types';
103
107
  import type { TopicMolecule } from 'openchemlib-utils';
104
108
  import type { TrafOptions } from '@zakodium/nmr-types';
@@ -113,6 +117,14 @@ import type { ZeroFillingOptions } from '@zakodium/nmr-types';
113
117
  import type { Zone } from '@zakodium/nmr-types';
114
118
  import type { Zones } from '@zakodium/nmr-types';
115
119
 
120
+ /**
121
+ * Adds a link to a correlation.
122
+ *
123
+ * @param correlation
124
+ * @param link
125
+ */
126
+ declare function addLink(correlation: Correlation, link: CorrelationLink): Correlation;
127
+
116
128
  declare type Apodization1D = FilterFactory<Entry1D, Apodization1DOptions> & Pick<Apodization1DFilterOptions, 'name'>;
117
129
 
118
130
  declare type ApodizationDimension1 = FilterFactory<Entry2D, Apodization2D1Options> & Pick<ApodizationDimension1Options, 'name'>;
@@ -299,6 +311,43 @@ declare interface BondOutput {
299
311
  atoms: [ID, ID];
300
312
  }
301
313
 
314
+ /**
315
+ * Builds a correlation object with some existing default values.
316
+ *
317
+ * @param {CorrelationOptions} options
318
+ */
319
+ declare function buildCorrelation(options: CorrelationOptions): Correlation;
320
+
321
+ /**
322
+ * Builds the correlation data from spectra data and some options.
323
+ *
324
+ * @param spectra
325
+ * @param options
326
+ */
327
+ declare function buildCorrelationData(spectra: Spectrum[], options: CorrelationBuildOptions): CorrelationData;
328
+
329
+ /**
330
+ * Builds a link object with some existing default values.
331
+ *
332
+ * @param options
333
+ */
334
+ declare function buildLink(options: LinkOptions): CorrelationLink;
335
+
336
+ /**
337
+ * Builds a state from current values and an optional molecular formula.
338
+ *
339
+ * @param {CorrelationValues} values
340
+ * @param {string} mf
341
+ */
342
+ declare function buildState(values: CorrelationValues, mf: string): CorrelationState;
343
+
344
+ /**
345
+ * Builds the correlation data values from given input spectra and options.
346
+ * @param spectra
347
+ * @param options
348
+ */
349
+ declare function buildValues(spectra: Spectra, options: CorrelationBuildOptions): CorrelationValues;
350
+
302
351
  declare type CacheResult = EmptyValue | PredictionBase1D | Promise<EmptyValue | PredictionBase1D>;
303
352
 
304
353
  export declare interface CalculateDiffussionCoefficientOptions {
@@ -353,10 +402,114 @@ export declare const carbonImpurities: DatabaseNMREntry[];
353
402
  */
354
403
  export declare function checkIntegralKind(integral: Integral): boolean;
355
404
 
405
+ /**
406
+ * Checks for a numeric match within a certain tolerance.
407
+ *
408
+ * @param {number} value1
409
+ * @param {number} value2
410
+ * @param {number} tolerance
411
+ */
412
+ declare function checkMatch(value1: number, value2: number, tolerance: number): boolean;
413
+
356
414
  export declare function checkMultiplicity(multiplicity: string, rejected?: OneLetterMultiplet[]): boolean;
357
415
 
358
416
  declare function checkSignalKinds(range: Range_2, kinds: ReadonlySet<SignalKind>): boolean;
359
417
 
418
+ export declare interface Correlation extends CorrelationAndLinkFields {
419
+ atomType: string;
420
+ label: Record<string, string>;
421
+ link: CorrelationLink[];
422
+ equivalence: number;
423
+ attachment: Record<string, number[]>;
424
+ protonsCount: number[];
425
+ hybridization: number[];
426
+ }
427
+
428
+ declare interface CorrelationAndLinkFields {
429
+ id: string;
430
+ pseudo: boolean;
431
+ edited: Record<string, boolean>;
432
+ }
433
+
434
+ declare interface CorrelationAndLinkOptions {
435
+ id?: string;
436
+ pseudo?: boolean;
437
+ edited?: Record<string, boolean>;
438
+ }
439
+
440
+ export declare namespace correlationApi {
441
+ export {
442
+ Correlation,
443
+ CorrelationBuildOptions,
444
+ CorrelationData,
445
+ CorrelationLink,
446
+ CorrelationState,
447
+ CorrelationTolerance,
448
+ CorrelationValues,
449
+ buildCorrelationData,
450
+ buildValues,
451
+ buildState,
452
+ addLink,
453
+ buildCorrelation,
454
+ buildLink,
455
+ removeLink,
456
+ setCorrelation,
457
+ checkMatch,
458
+ findLinkedCorrelationsBySignalID,
459
+ findLinksBySignalID,
460
+ getAtomCounts,
461
+ getAtomTypeFromNucleus,
462
+ getCorrelationDelta,
463
+ getCorrelationIndex,
464
+ getCorrelationsByAtomType,
465
+ getLabel,
466
+ getLabels,
467
+ getLinkDelta,
468
+ getLinkDim,
469
+ isEditedHSQC,
470
+ setPathLength
471
+ }
472
+ }
473
+
474
+ export declare interface CorrelationBuildOptions {
475
+ tolerance?: CorrelationTolerance;
476
+ mf?: string;
477
+ values?: CorrelationValues;
478
+ skipDataUpdate?: boolean;
479
+ }
480
+
481
+ export declare interface CorrelationData {
482
+ values: CorrelationValues;
483
+ options: CorrelationBuildOptions;
484
+ state: CorrelationState;
485
+ }
486
+
487
+ export declare interface CorrelationLink extends CorrelationAndLinkFields {
488
+ atomType: string[];
489
+ signal: Signal1D | Signal2D;
490
+ axis: string | undefined;
491
+ match: number[];
492
+ experimentLabel: string;
493
+ experimentType: string;
494
+ experimentID: string;
495
+ }
496
+
497
+ declare interface CorrelationOptions extends CorrelationAndLinkOptions {
498
+ atomType?: string;
499
+ label?: Record<string, string>;
500
+ link?: CorrelationLink[];
501
+ equivalence?: number;
502
+ attachment?: Record<string, number[]>;
503
+ protonsCount?: number[];
504
+ hybridization?: number[];
505
+ }
506
+
507
+ declare type CorrelationState = Record<string, StateAtomType>;
508
+
509
+ export declare type CorrelationTolerance = Record<string, number>;
510
+
511
+ export declare type CorrelationValues = Correlation[];
512
+
360
513
  export declare const couplingACSPatterns: string[];
361
514
 
362
515
  declare interface CouplingGroupInput {
@@ -685,6 +838,10 @@ export declare namespace Filters2DManager {
685
838
 
686
839
  declare type FilterSymbols = (typeof Filters)[keyof typeof Filters];
687
840
 
841
+ declare function findLinkedCorrelationsBySignalID(correlations: CorrelationValues, signalID: string): Correlation[];
842
+
843
+ declare function findLinksBySignalID(correlations: CorrelationValues, signalID: string): CorrelationLink[];
844
+
688
845
  /**
689
846
  * Look for a multiplet based on the pattern name or abbreviation.
690
847
  * @param name - pattern name or abbreviation.
@@ -880,8 +1037,21 @@ export declare interface GetAssignmentsOptions {
880
1037
  };
881
1038
  }
882
1039
 
1040
+ /**
1041
+ * Returns the number of atoms per atom type for a given molecular formula.
1042
+ *
1043
+ * @param {string} mf
1044
+ */
1045
+ declare function getAtomCounts(mf: string): Record<string, number>;
1046
+
883
1047
  declare function getAtoms(a: AtomInput[]): AtomOutput[];
884
1048
 
1049
+ /**
1050
+ * Returns the atom type from nucleus.
1051
+ * @param {string} nucleus
1052
+ */
1053
+ declare function getAtomTypeFromNucleus(nucleus: string): string;
1054
+
885
1055
  export declare interface GetAutoAssignmentInput {
886
1056
  spectra: SpectraData[];
887
1057
  /**
@@ -917,6 +1087,24 @@ export declare function getBaselineZonesByDietrich(data: NmrData1D, options?: Ba
917
1087
 
918
1088
  declare function getBonds(b: BondInput[]): BondOutput[];
919
1089
 
1090
+ declare function getCorrelationDelta(correlation: Correlation): number | undefined;
1091
+
1092
+ /**
1093
+ * Returns the array index of a correlation.
1094
+ *
1095
+ * @param correlations
1096
+ * @param correlation
1097
+ */
1098
+ declare function getCorrelationIndex(correlations: CorrelationValues, correlation: Correlation): number;
1099
+
1100
+ /**
1101
+ * Returns all correlations of a certain atom type.
1102
+ *
1103
+ * @param correlations
1104
+ * @param atomType
1105
+ */
1106
+ declare function getCorrelationsByAtomType(correlations: CorrelationValues, atomType: string): CorrelationValues;
1107
+
920
1108
  declare function getCouplingGroups(cg: CouplingGroupInput[]): {
921
1109
  id: string;
922
1110
  parentID: string;
@@ -961,8 +1149,16 @@ declare interface GetKernelOptions {
961
1149
  yLength?: number;
962
1150
  }
963
1151
 
1152
+ declare function getLabel(correlations: CorrelationValues, correlation: Correlation): string;
1153
+
1154
+ declare function getLabels(correlations: CorrelationValues, correlation: Correlation, experimentType: string): string[];
1155
+
964
1156
  declare function getLineShapes(l: LineShapeData[]): LineShapeResult[];
965
1157
 
1158
+ declare function getLinkDelta(link: CorrelationLink): number | undefined;
1159
+
1160
+ declare function getLinkDim(link: CorrelationLink): number;
1161
+
966
1162
  export declare function getPeakDelta(peak: Peak1D | NMRPeak1D, shiftTarget: ShiftTarget, shift: number): {
967
1163
  originalX: number;
968
1164
  x: number;
@@ -1047,6 +1243,8 @@ declare interface HOSEPrediction {
1047
1243
 
1048
1244
  declare type ID = string;
1049
1245
 
1246
+ declare function isEditedHSQC(experiment: Pick<Spectrum2D, 'info'>): boolean;
1247
+
1050
1248
  export declare function isEmptyMolecule(molecule: Molecule): boolean;
1051
1249
 
1052
1250
  export declare function isMolfileNotEmpty(molFile?: string): molFile is string;
@@ -1105,6 +1303,16 @@ declare interface LineShapeResult {
1105
1303
  };
1106
1304
  }
1107
1305
 
1306
+ declare interface LinkOptions extends CorrelationAndLinkOptions {
1307
+ atomType?: string[];
1308
+ experimentType?: string;
1309
+ experimentID?: string;
1310
+ signal?: Signal1D | Signal2D;
1311
+ axis?: string;
1312
+ match?: number[];
1313
+ experimentLabel?: string;
1314
+ }
1315
+
1108
1316
  declare type MakeMandatory<T, K extends keyof T> = T & {
1109
1317
  [P in K]-?: T[P];
1110
1318
  };
@@ -2075,6 +2283,14 @@ export declare function reimComplexBackwardLinearPrediction(data: DataReIm, opti
2075
2283
  im: Float64Array<ArrayBuffer>;
2076
2284
  };
2077
2285
 
2286
+ /**
2287
+ * Removes a link by id search.
2288
+ *
2289
+ * @param {Correlation} correlation
2290
+ * @param {string} id
2291
+ */
2292
+ declare function removeLink(correlation: Correlation, id: string): Correlation;
2293
+
2078
2294
  declare interface RestrictionByCS {
2079
2295
  chemicalShiftRestriction: boolean;
2080
2296
  tolerance: Record<string, number>;
@@ -2111,6 +2327,17 @@ declare interface SelectAnchorOptions {
2111
2327
  windowSize?: number;
2112
2328
  }
2113
2329
 
2330
+ /**
2331
+ * Searches for a correlation index by id in correlation data and replaces it with a given correlation.
2332
+ *
2333
+ * @param {CorrelationData} data
2334
+ * @param {string} id
2335
+ * @param {Correlation} correlation
2336
+ */
2337
+ declare function setCorrelation(data: CorrelationData, id: string, correlation: Correlation): CorrelationData;
2338
+
2339
+ declare function setPathLength(correlations: CorrelationValues, signalID: string, pathLength: number | FromTo | undefined): CorrelationValues;
2340
+
2114
2341
  declare type Shift2DX = FilterFactory<Entry2D, Shift2DXOptions> & Pick<Shift2DXFilterOptions, 'name'>;
2115
2342
 
2116
2343
  declare type Shift2DXOptions = Shift2DXFilterOptions['value'];
@@ -2542,6 +2769,15 @@ export declare interface SplitSpinSystemOptions {
2542
2769
  maxClusterSize?: number;
2543
2770
  }
2544
2771
 
2772
+ declare interface StateAtomType {
2773
+ current: number;
2774
+ total?: number;
2775
+ complete?: boolean;
2776
+ error?: StateAtomTypeError;
2777
+ }
2778
+
2779
+ declare type StateAtomTypeError = Record<string, boolean | number[]>;
2780
+
2545
2781
  declare type SymmetrizeCosyLike = FilterFactory<Entry2D, Record<string, never>> & Pick<SymmetrizeCosyLikeOptions, 'name'>;
2546
2782
 
2547
2783
  declare class T1Regression extends BaseRegression {