nmr-processing 18.0.1 → 18.1.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.
@@ -1,7 +1,5 @@
1
1
  import type { AnalizeMultipletOptions } from 'multiplet-analysis';
2
- import { AtomMapping } from './ctMolfileParser';
3
2
  import { BaseRegression } from 'ml-regression-base';
4
- import { CTSignal } from './ctCreateSignals';
5
3
  import type { DataReIm } from 'ml-spectra-processing';
6
4
  import type { DataXReIm } from 'ml-spectra-processing';
7
5
  import { DataXY } from 'cheminfo-types';
@@ -14,30 +12,28 @@ import type { GroupedDiaID } from 'openchemlib-utils';
14
12
  import type { GSDOptions } from 'ml-gsd';
15
13
  import { GSDPeakOptimized } from 'ml-gsd';
16
14
  import { GSDPeakOptimizedID } from 'ml-gsd';
17
- import { Jcoupling as Jcoupling_2 } from './Jcoupling';
15
+ import { Jcoupling as Jcoupling_2 } from './Jcoupling.js';
18
16
  import type { JoinBroadPeaksOptions } from 'ml-gsd';
19
- import { LightLogger } from 'cheminfo-types';
17
+ import type { LightLogger } from 'cheminfo-types';
20
18
  import type { Logger } from 'cheminfo-types';
21
- import { MatchingMultiplicity as MatchingMultiplicity_2 } from '..';
19
+ import { MatchingMultiplicity as MatchingMultiplicity_2 } from '../index.js';
22
20
  import { Matrix } from 'ml-matrix';
23
21
  import type { Molecule } from 'openchemlib';
24
22
  import type { NmrData1D } from 'cheminfo-types';
25
23
  import type { NmrData2D } from 'cheminfo-types';
26
24
  import type { NmrData2DContent } from 'cheminfo-types';
27
25
  import type { NmrData2DFt } from 'cheminfo-types';
28
- import { NMRRange as NMRRange_2 } from './NMRRange';
26
+ import { NMRRange as NMRRange_2 } from './NMRRange.js';
29
27
  import type { NumberArray } from 'cheminfo-types';
30
28
  import type { OCLMolecule } from 'cheminfo-types';
31
- import { OneLetterMultiplet as OneLetterMultiplet_2 } from './MultiplicityPatterns';
29
+ import { OneLetterMultiplet as OneLetterMultiplet_2 } from './MultiplicityPatterns.js';
32
30
  import type { OptimizePeaksOptions } from 'ml-gsd';
33
31
  import type { OptionsSG1D } from 'spectrum-generator';
34
- import { ParsedCoupling } from './ctJSONParser';
35
- import { ParsedShift } from './ctJSONParser';
36
32
  import type { Peak2D as Peak2D_2 } from 'ml-matrix-peaks-finder';
37
33
  import type { PeakXYWidth } from 'cheminfo-types';
38
34
  import { PointXY } from 'cheminfo-types';
39
35
  import type { Shape1D } from 'ml-peak-shape-generator';
40
- import { SpectraDataWithIds as SpectraDataWithIds_2 } from './nmrAssigment';
36
+ import { SpectraDataWithIds as SpectraDataWithIds_2 } from './nmrAssigment.js';
41
37
  import type { TopicMolecule } from 'openchemlib-utils';
42
38
  import type { XDistributionStats } from 'ml-spectra-processing';
43
39
  import type { XRobustDistributionStats } from 'ml-spectra-processing';
@@ -137,6 +133,8 @@ export declare interface ApplyWindowOptions {
137
133
  output?: DoubleArray;
138
134
  }
139
135
 
136
+ declare type Atom = ReturnType<typeof getAtoms>[0];
137
+
140
138
  declare interface AtomInput {
141
139
  id: ID;
142
140
  pid: ID;
@@ -157,6 +155,28 @@ declare interface AtomInput {
157
155
  s: ID | null;
158
156
  }
159
157
 
158
+ declare interface AtomOutput {
159
+ id: ID;
160
+ parentID: ID;
161
+ name: string;
162
+ remarks: string;
163
+ nucleusType: NucleusType;
164
+ cipRank: {
165
+ canonical: number;
166
+ rd: number;
167
+ nmr: number;
168
+ };
169
+ ordinal: number;
170
+ stereochemistryFlags: number[];
171
+ spinSystemFlags: number[];
172
+ formalcharge: number;
173
+ partialCharge: number;
174
+ coordinates2D: [number, number, number];
175
+ coordinates3D: [number, number, number];
176
+ parent2D: string | null;
177
+ shift: ID | null;
178
+ }
179
+
160
180
  declare type AtomTypes = 'H' | 'C';
161
181
 
162
182
  export declare interface AutoPhaseCorrection2D {
@@ -298,6 +318,14 @@ declare interface BondInput {
298
318
  a: [ID, ID];
299
319
  }
300
320
 
321
+ declare interface BondOutput {
322
+ id: ID;
323
+ bondType: string;
324
+ stereochemistryFlags: number[];
325
+ spinSystemFlags: number[];
326
+ atoms: [ID, ID];
327
+ }
328
+
301
329
  declare interface BooleanField extends Field<boolean> {
302
330
  type: 'boolean';
303
331
  }
@@ -402,6 +430,29 @@ export declare interface CreateSignals2DOptions {
402
430
  maxX: number;
403
431
  }
404
432
 
433
+ declare interface CTJSONConverterOutput {
434
+ molarFraction: {
435
+ value: number;
436
+ low: number;
437
+ high: number;
438
+ };
439
+ fieldStrength: number;
440
+ baseItensity: number;
441
+ intensityLimit: number;
442
+ spinSystemFlags: number[];
443
+ spinSystemType: string;
444
+ analysisType: number;
445
+ inchiKey: string;
446
+ populations: ReturnType<typeof getPopulations>;
447
+ lineShapes: ReturnType<typeof getLineShapes>;
448
+ shiftGroups: ReturnType<typeof getShiftGroups>;
449
+ shifts: ReturnType<typeof getShifts>;
450
+ couplingGroups: ReturnType<typeof getCouplingGroups>;
451
+ couplings: ReturnType<typeof getCouplings>;
452
+ atoms: ReturnType<typeof getAtoms>;
453
+ bonds: ReturnType<typeof getBonds>;
454
+ }
455
+
405
456
  declare interface CTJSONInput {
406
457
  v: number;
407
458
  vl: number;
@@ -423,6 +474,19 @@ declare interface CTJSONInput {
423
474
  b: BondInput[];
424
475
  }
425
476
 
477
+ declare interface CTParserResult extends Omit<CTJSONConverterOutput, 'shifts' | 'couplings'> {
478
+ shifts: ParsedShift[];
479
+ couplings: ParsedCoupling[];
480
+ }
481
+
482
+ declare interface CTSignal {
483
+ delta: number;
484
+ diaIDs: string[];
485
+ js: Jcoupling[];
486
+ nbAtoms: number;
487
+ atoms: number[];
488
+ }
489
+
426
490
  export declare type DataBaseLevelEntry = number | [number] | [number, number, number, number | null, number] | undefined | XDistributionStats;
427
491
 
428
492
  export declare type DataBaseLevelStructure = Record<string, DataBaseLevelEntry>;
@@ -889,6 +953,8 @@ export declare interface GetAssignmentsOptions {
889
953
  };
890
954
  }
891
955
 
956
+ declare function getAtoms(a: AtomInput[]): AtomOutput[];
957
+
892
958
  export declare interface GetAutoAssignmentInput {
893
959
  spectra: SpectraData[];
894
960
  /**
@@ -914,6 +980,34 @@ export declare function getBaselineZones(data: NmrData1D, options?: BaselineZone
914
980
  */
915
981
  export declare function getBaselineZonesByDietrich(data: NmrData1D, options?: BaselineZoneOptionsDietrich): BaselineCorrectionZone[];
916
982
 
983
+ declare function getBonds(b: BondInput[]): BondOutput[];
984
+
985
+ declare function getCouplingGroups(cg: CouplingGroupInput[]): {
986
+ id: string;
987
+ parentID: string;
988
+ name: string;
989
+ remarks: string;
990
+ coupling: {
991
+ value: number;
992
+ low: number;
993
+ high: number;
994
+ };
995
+ spinSystemFlags: number[];
996
+ couplingType: string;
997
+ }[];
998
+
999
+ declare function getCouplings(c: CouplingInput[]): {
1000
+ id: string;
1001
+ parentID: string;
1002
+ name: string;
1003
+ remarks: string;
1004
+ couplingGroup: string;
1005
+ shifts: {
1006
+ from: string;
1007
+ to: string;
1008
+ };
1009
+ }[];
1010
+
917
1011
  export declare function getDatabase(url?: string, options?: {
918
1012
  /**
919
1013
  * @default 'tsv'
@@ -940,6 +1034,8 @@ declare interface GetKernelOptions {
940
1034
  yLength?: number;
941
1035
  }
942
1036
 
1037
+ declare function getLineShapes(l: LineShapeData[]): LineShapeResult[];
1038
+
943
1039
  declare function getNbAtoms(range: Range_2, signalIndex?: number): number;
944
1040
 
945
1041
  export declare function getPeakDelta(peak: Peak1D | NMRPeak1D, shiftTarget: ShiftTarget, shift: number): {
@@ -964,6 +1060,36 @@ export declare interface GetPeakListOptions extends GSDOptions, OptimizePeaksOpt
964
1060
  maxAbsDdY?: number;
965
1061
  }
966
1062
 
1063
+ declare function getPopulations(p: PopulationInput[]): PopulationOutput[];
1064
+
1065
+ declare function getShiftGroups(sg: ShiftGroupEntry[]): {
1066
+ id: string;
1067
+ parentID: string;
1068
+ name: string;
1069
+ remarks: string;
1070
+ shift: {
1071
+ value: number;
1072
+ low: number;
1073
+ high: number;
1074
+ };
1075
+ spin2: number;
1076
+ spinCount: number;
1077
+ exchangeable: boolean;
1078
+ spinSystemFlags: number[];
1079
+ gamma: number;
1080
+ iterationWeight: number;
1081
+ response: {
1082
+ value: number;
1083
+ low: number;
1084
+ high: number;
1085
+ sf: number[];
1086
+ };
1087
+ population: string;
1088
+ lineShape: string;
1089
+ }[];
1090
+
1091
+ declare function getShifts(s: ShiftInput[]): ShiftOutput[];
1092
+
967
1093
  export declare function getShiftX(spectrum: Entry1D): number;
968
1094
 
969
1095
  declare interface HOSEPrediction {
@@ -1114,6 +1240,24 @@ declare interface LineShapeData {
1114
1240
  };
1115
1241
  }
1116
1242
 
1243
+ declare interface LineShapeResult {
1244
+ id: string;
1245
+ parentID: string;
1246
+ name: string;
1247
+ remarks: string;
1248
+ spinSystemFlags: number[];
1249
+ lineWidth: {
1250
+ value: number;
1251
+ low: number;
1252
+ high: number;
1253
+ };
1254
+ gaussian: {
1255
+ value: number;
1256
+ low: number;
1257
+ high: number;
1258
+ };
1259
+ }
1260
+
1117
1261
  declare interface ListField extends Field<string[]> {
1118
1262
  type: 'list';
1119
1263
  properties: Record<string, CommonField>;
@@ -1385,6 +1529,11 @@ declare interface NMRZoneWithIds extends Omit<NMRZone, 'signals' | 'id'> {
1385
1529
  */
1386
1530
  export declare function normalizeNucleus(nucleus: string): string;
1387
1531
 
1532
+ declare interface NucleusType {
1533
+ atomicNumber: number;
1534
+ isotope: number;
1535
+ }
1536
+
1388
1537
  declare interface NumberField extends Field<number> {
1389
1538
  type: 'number';
1390
1539
  }
@@ -1605,15 +1754,28 @@ declare type ParametersFromSignal = Record<string, Record<string, number>>;
1605
1754
  export declare function parseCT(json: CTJSONInput, molfile: string, options: {
1606
1755
  logger?: LightLogger;
1607
1756
  atomicNumber?: number;
1608
- }): {
1757
+ }): ParseCTOutput;
1758
+
1759
+ export declare interface ParseCTOutput extends CTParserResult {
1609
1760
  signals: CTSignal[];
1610
- atomsMapping: Array<AtomMapping>;
1611
- atomsMappingLookup: Record<string, number>;
1612
- molfile: string;
1613
- id: string;
1614
- shifts: ParsedShift[];
1615
- couplings: ParsedCoupling[];
1616
- };
1761
+ }
1762
+
1763
+ /**
1764
+ * Interface for coupling data between atoms
1765
+ */
1766
+ declare interface ParsedCoupling {
1767
+ from: Atom[];
1768
+ to: Atom[];
1769
+ value: number;
1770
+ }
1771
+
1772
+ /**
1773
+ * Interface for chemical shift data
1774
+ */
1775
+ declare interface ParsedShift {
1776
+ atoms: Atom[];
1777
+ value: number;
1778
+ }
1617
1779
 
1618
1780
  export declare interface Peak1D extends Omit<NMRPeak1D, 'id'>, BasePeak {
1619
1781
  originalX?: number;
@@ -1769,6 +1931,19 @@ declare interface PopulationInput {
1769
1931
  sf: number[];
1770
1932
  }
1771
1933
 
1934
+ declare interface PopulationOutput {
1935
+ id: ID;
1936
+ parentID: ID;
1937
+ name: string;
1938
+ remarks: string;
1939
+ population: {
1940
+ value: number;
1941
+ low: number;
1942
+ high: number;
1943
+ };
1944
+ spinSystemFlags: number[];
1945
+ }
1946
+
1772
1947
  /**
1773
1948
  * Generate the 2D correlation nmr peaks based on the number of bonds between a pair of atoms
1774
1949
  * @param molecule
@@ -2310,6 +2485,14 @@ declare interface ShiftInput {
2310
2485
  sg: ID;
2311
2486
  }
2312
2487
 
2488
+ declare interface ShiftOutput {
2489
+ id: ID;
2490
+ parentID: ID;
2491
+ name: string;
2492
+ remarks: string;
2493
+ shiftGroup: ID;
2494
+ }
2495
+
2313
2496
  declare type ShiftTarget = 'origin' | 'current';
2314
2497
 
2315
2498
  declare type ShiftX = FilterFactory<Entry1D, ShiftXOptions> & Pick<ShiftXFilterOptions, 'name'>;