nmr-processing 17.0.0 → 17.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,16 +1,18 @@
1
1
  import { AnalizeMultipletOptions } from 'multiplet-analysis';
2
2
  import { BaseRegression } from 'ml-regression-base';
3
+ import { DataReIm } from 'ml-spectra-processing';
3
4
  import { DataXReIm } from 'ml-spectra-processing';
4
5
  import { DataXY } from 'cheminfo-types';
5
6
  import { DoubleArray } from 'cheminfo-types';
6
7
  import { ExponentialRegression } from 'ml-regression-exponential';
7
8
  import type { FilterXYType } from 'ml-signal-processing';
8
9
  import { FromTo } from 'cheminfo-types';
10
+ import { GroupedDiaID } from 'openchemlib-utils';
9
11
  import { GSDOptions } from 'ml-gsd';
10
12
  import { GSDPeakOptimized } from 'ml-gsd';
11
13
  import { GSDPeakOptimizedID } from 'ml-gsd';
12
14
  import { JoinBroadPeaksOptions } from 'ml-gsd';
13
- import type { LightLogger } from 'cheminfo-types';
15
+ import { LightLogger } from 'cheminfo-types';
14
16
  import { Logger } from 'cheminfo-types';
15
17
  import { Matrix } from 'ml-matrix';
16
18
  import * as matrixPeakFinders from 'ml-matrix-peaks-finder';
@@ -28,7 +30,6 @@ import type { Peak2D as Peak2D_2 } from 'ml-matrix-peaks-finder';
28
30
  import { PeakXYWidth } from 'cheminfo-types';
29
31
  import { PointXY } from 'cheminfo-types';
30
32
  import { Shape1D } from 'ml-peak-shape-generator';
31
- import { Spectrum2D } from 'spectrum-generator';
32
33
  import { TopicMolecule } from 'openchemlib-utils';
33
34
  import { XYEquallySpacedOptions } from 'ml-spectra-processing';
34
35
  import type { XYNumber } from 'spectrum-generator';
@@ -42,6 +43,8 @@ export declare interface AirplsOptions {
42
43
  tolerance: number;
43
44
  }
44
45
 
46
+ declare type AnalysisInfoSection = Record<string, string>;
47
+
45
48
  declare type Apodization1D = FilterFactory<Entry1D, Apodization2DOptions> & Pick<Apodization1DFilterOptions, 'name'>;
46
49
 
47
50
  declare interface Apodization1DFilterOptions extends BaseFilter {
@@ -127,6 +130,11 @@ export declare interface ApplyWindowOptions {
127
130
  output?: DoubleArray;
128
131
  }
129
132
 
133
+ export declare interface AtomMapping {
134
+ label: string;
135
+ atom: number;
136
+ }
137
+
130
138
  declare type AtomTypes = 'H' | 'C';
131
139
 
132
140
  export declare interface AutoPhaseCorrection2D {
@@ -300,6 +308,14 @@ declare function checkRangeKind(range: Range_2): boolean;
300
308
 
301
309
  declare function checkSignalKinds(range: Range_2, kinds: string[]): boolean;
302
310
 
311
+ export declare interface ChemicalShift {
312
+ Element: string;
313
+ Shift: string;
314
+ Spincount: string;
315
+ Nucleicount: string;
316
+ Name: string;
317
+ }
318
+
303
319
  declare type CommonField = SelectField | StringField | NumberField | BooleanField | LabelField;
304
320
 
305
321
  declare interface CompilePatternOptions {
@@ -311,8 +327,24 @@ declare interface CompilePatternOptions {
311
327
  };
312
328
  }
313
329
 
330
+ export declare interface Coupling {
331
+ atomFrom: number;
332
+ atomTo: number;
333
+ atomLabelTo: string;
334
+ value: number;
335
+ key: string;
336
+ toDiaID: number;
337
+ pathLength: number;
338
+ }
339
+
314
340
  export declare const couplingACSPatterns: string[];
315
341
 
342
+ declare interface CouplingConstant {
343
+ Coupling: string;
344
+ Shift1: string;
345
+ Shift2: string;
346
+ }
347
+
316
348
  export declare const couplingPatterns: OneLetterMultiplet[];
317
349
 
318
350
  export declare function createApodizationWindowData(options: {
@@ -343,6 +375,27 @@ export declare interface CreateSignals2DOptions {
343
375
  maxX: number;
344
376
  }
345
377
 
378
+ /**
379
+ * CT results are stored in a CSV file with a specific format and a SDF file.
380
+ * This function will parse the CSV and return an object with the different sections.
381
+ * @param csv
382
+ * @returns
383
+ */
384
+ declare function ctCSVParser(csv: string, options: {
385
+ logger: LightLogger;
386
+ }): CtCSVParserResult;
387
+
388
+ declare interface CtCSVParserResult {
389
+ 'ANALYSIS INFO'?: AnalysisInfoSection;
390
+ SCORES?: ScoreEntry[];
391
+ SPINSYSTEMS?: ParsedRow[];
392
+ 'CHEMICAL SHIFTS (ppm)'?: ParsedRow[];
393
+ 'COUPLING CONSTANTS (Hz)'?: ParsedRow[];
394
+ LINESHAPES?: ParsedRow[];
395
+ QMGI?: ParsedRow[];
396
+ [key: string]: SectionData | undefined;
397
+ }
398
+
346
399
  export declare function ctParser(sdf: string, csv: string, options: {
347
400
  OCL: {
348
401
  Molecule: typeof Molecule_2;
@@ -350,8 +403,8 @@ export declare function ctParser(sdf: string, csv: string, options: {
350
403
  logger?: LightLogger;
351
404
  }): {
352
405
  molecules: ParsedMolecule[];
353
- sections: Record<string, any>;
354
- groups: any[];
406
+ sections: ReturnType<typeof ctCSVParser>;
407
+ groups: GroupData[];
355
408
  };
356
409
 
357
410
  export declare type DataBaseLevelEntry = number | [number] | [number, number, number, number | null, number] | undefined | NMRSignalStatistics;
@@ -896,6 +949,19 @@ export declare interface GetPeakListOptions extends GSDOptions, OptimizePeaksOpt
896
949
 
897
950
  export declare function getShiftX(spectrum: Entry1D): number;
898
951
 
952
+ export declare interface GroupData {
953
+ id: string;
954
+ molfile: string;
955
+ spinSystem: {
956
+ SSType: string;
957
+ };
958
+ couplingConstants: CouplingConstant[];
959
+ chemicalShifts: ChemicalShift[];
960
+ atomsMapping: AtomMapping[];
961
+ atomsMappingLookup: Record<string, number>;
962
+ signals?: NMRSignal1D[];
963
+ }
964
+
899
965
  export declare const impurities: SolventImpurities;
900
966
 
901
967
  export declare type Impurity = Record<string, ImpuritySignal[]>;
@@ -1133,7 +1199,14 @@ export declare function mapZones(zones: Zone[], datum: Entry2D, options?: MapOpt
1133
1199
  assignment?: string;
1134
1200
  }[];
1135
1201
 
1136
- export declare function markSolventPeaks<T extends NMRRange>(input: T[], solventSignals: NMRSignal1D[], options?: any): T[];
1202
+ export declare function markSolventPeaks<T extends NMRRange>(input: T[], solventSignals: NMRSignal1D[], options?: MarkSolventPeaksOptions): T[];
1203
+
1204
+ declare interface MarkSolventPeaksOptions {
1205
+ /** The NMR spectrometer frequency in MHz
1206
+ * @default 400
1207
+ */
1208
+ frequency?: number;
1209
+ }
1137
1210
 
1138
1211
  export declare type MatchingMultiplicity = MultipletDefinition & {
1139
1212
  match: string;
@@ -1200,6 +1273,16 @@ declare interface MatrixToStocsyOptions {
1200
1273
  colors?: string[];
1201
1274
  }
1202
1275
 
1276
+ declare interface MinMaxContent {
1277
+ z: Float64Array[];
1278
+ minX: number;
1279
+ maxX: number;
1280
+ minY: number;
1281
+ maxY: number;
1282
+ minZ: number;
1283
+ maxZ: number;
1284
+ }
1285
+
1203
1286
  export declare interface MultipletDefinition {
1204
1287
  label: string;
1205
1288
  value: OneLetterMultiplet;
@@ -1337,12 +1420,6 @@ export declare interface ObservedNucleusData {
1337
1420
  frequency: number;
1338
1421
  }
1339
1422
 
1340
- /**
1341
- * This function will generate an object compatible with NMR-ium
1342
- *
1343
- * @param molecule
1344
- * @param options
1345
- */
1346
1423
  declare interface OneDOptions {
1347
1424
  proton: FromTo;
1348
1425
  carbon: FromTo;
@@ -1544,6 +1621,8 @@ declare interface ParsedMolecule {
1544
1621
  id: string;
1545
1622
  }
1546
1623
 
1624
+ declare type ParsedRow = Record<string, string>;
1625
+
1547
1626
  export declare interface Peak1D extends Omit<NMRPeak1D, 'id'>, BasePeak {
1548
1627
  originalX?: number;
1549
1628
  }
@@ -1573,7 +1652,12 @@ export declare interface Peaks {
1573
1652
  }
1574
1653
 
1575
1654
  /**
1576
- * Try to remove peaks of impurities.
1655
+ * Filters impurities from a list of NMR peaks based on the specified options.
1656
+ *
1657
+ * @template T - The type of NMR peaks.
1658
+ * @param {T[]} peakList - The list of NMR peaks to be filtered.
1659
+ * @param {OptionsPeaksFilterImpurities} [options={}] - The options for filtering impurities.
1660
+ * @returns {T[]} The filtered list of NMR peaks.
1577
1661
  */
1578
1662
  export declare function peaksFilterImpurities<T extends NMRPeak1D>(peakList: T[], options?: OptionsPeaksFilterImpurities): T[];
1579
1663
 
@@ -1777,22 +1861,58 @@ declare interface PredictCOSYOptions {
1777
1861
  export declare interface Predicted {
1778
1862
  molfile: string;
1779
1863
  molfileWithH: string;
1780
- hoses: any[];
1781
- diaIDs: any[] | undefined;
1782
- groupedDiaIDs: any[];
1864
+ hoses: string[];
1865
+ diaIDs: string[] | undefined;
1866
+ groupedDiaIDs: GroupedDiaID[];
1783
1867
  moleculeWithHydrogens: Molecule;
1784
- distanceMatrix: any[];
1868
+ distanceMatrix: NumberArray[];
1785
1869
  spectra: PredictedSpectra;
1786
1870
  }
1787
1871
 
1788
- export declare interface PredictedSpectra {
1872
+ export declare interface Predicted1DSpectra {
1789
1873
  proton?: PredictionBase1D;
1790
1874
  carbon?: PredictionBase1D;
1875
+ }
1876
+
1877
+ export declare interface Predicted2DSpectra {
1791
1878
  cosy?: PredictionBase2D;
1792
1879
  hsqc?: PredictionBase2D;
1793
1880
  hmbc?: PredictionBase2D;
1794
1881
  }
1795
1882
 
1883
+ export declare interface PredictedSpectra extends Predicted1DSpectra, Predicted2DSpectra {
1884
+ }
1885
+
1886
+ declare interface PredictedSpectrum1D {
1887
+ data: {
1888
+ x: NumberArray;
1889
+ re: NumberArray;
1890
+ im: null;
1891
+ };
1892
+ info: Spectrum1DInfo;
1893
+ ranges: {
1894
+ values: Array<{
1895
+ from: number;
1896
+ to: number;
1897
+ }>;
1898
+ };
1899
+ }
1900
+
1901
+ declare interface PredictedSpectrum2D {
1902
+ data: {
1903
+ rr: MinMaxContent & {
1904
+ noise: number;
1905
+ };
1906
+ };
1907
+ info: Spectrum2DInfo;
1908
+ zones: {
1909
+ values: Array<{
1910
+ x: FromTo;
1911
+ y: FromTo;
1912
+ }>;
1913
+ };
1914
+ }
1915
+
1796
1916
  /**
1797
1917
  * Generate the correlation bidimensional nmr peaks based on the number of bonds between a pair of atoms
1798
1918
  * @returns {Promise<object>} - object with molfile, diaIDs, 2D signals joined signals and zones.
@@ -1920,12 +2040,14 @@ export declare interface PredictProtonOptions {
1920
2040
  cache?: PredictionCacheFn;
1921
2041
  }
1922
2042
 
1923
- export declare function predictSpectra(molecule: Molecule, options?: PredictAllSpectraOptions): Promise<{
1924
- spectra: any[];
1925
- molecules: {
2043
+ export declare function predictSpectra(molecule: Molecule, options?: PredictAllSpectraOptions): Promise<PredictSpectraResult>;
2044
+
2045
+ declare interface PredictSpectraResult {
2046
+ spectra: Array<PredictedSpectrum1D | PredictedSpectrum2D>;
2047
+ molecules: Array<{
1926
2048
  molfile: string;
1927
- }[];
1928
- }>;
2049
+ }>;
2050
+ }
1929
2051
 
1930
2052
  declare type Properties = ListField | SelectField | StringField | NumberField | BooleanField | LabelField;
1931
2053
 
@@ -2083,6 +2205,11 @@ declare function reapplyFilters_2(datum: Entry2D, options?: {
2083
2205
  logger?: Logger;
2084
2206
  }): void;
2085
2207
 
2208
+ export declare function reimComplexBackwardLinearPrediction(data: DataReIm, options: BackwardLPOptions): {
2209
+ re: Float64Array<ArrayBuffer>;
2210
+ im: Float64Array<ArrayBuffer>;
2211
+ };
2212
+
2086
2213
  declare function resetDiaIDs(range: Range_2): void;
2087
2214
 
2088
2215
  declare interface RestrictionByCS {
@@ -2103,6 +2230,13 @@ export declare interface ResurrectOptions {
2103
2230
  logger?: Logger;
2104
2231
  }
2105
2232
 
2233
+ declare interface ScoreEntry {
2234
+ key: string;
2235
+ value: string;
2236
+ }
2237
+
2238
+ declare type SectionData = AnalysisInfoSection | ScoreEntry[] | ParsedRow[];
2239
+
2106
2240
  declare interface SelectField extends Field<any> {
2107
2241
  type: 'select';
2108
2242
  choices: any[];
@@ -2255,7 +2389,15 @@ declare interface SignalProcessingFilter extends BaseFilter {
2255
2389
  value: MatrixOptions;
2256
2390
  }
2257
2391
 
2258
- export declare function signals2DToZ(signals: NMRSignal2D[], options?: Signals2DToZOptions): Spectrum2D;
2392
+ export declare function signals2DToZ(signals: NMRSignal2D[], options?: Signals2DToZOptions): {
2393
+ minX: number;
2394
+ maxX: number;
2395
+ minY: number;
2396
+ maxY: number;
2397
+ minZ: number;
2398
+ maxZ: number;
2399
+ z: Float64Array<ArrayBufferLike>[];
2400
+ };
2259
2401
 
2260
2402
  declare interface Signals2DToZOptions {
2261
2403
  /**
@@ -2407,6 +2549,12 @@ declare interface Simulate1DOptions {
2407
2549
  shape?: Shape1D;
2408
2550
  }
2409
2551
 
2552
+ /**
2553
+ * This function will generate an object compatible with NMR-ium
2554
+ *
2555
+ * @param molecule
2556
+ * @param options
2557
+ */
2410
2558
  declare interface SimulationOptions {
2411
2559
  frequency: number;
2412
2560
  oneD?: Partial<OneDOptions>;
@@ -2470,6 +2618,25 @@ export declare interface SpectraData2DWithIds extends Omit<SpectraData2D, 'zones
2470
2618
 
2471
2619
  export declare type SpectraDataWithIds = SpectraData1DWithIds | SpectraData2DWithIds;
2472
2620
 
2621
+ declare interface Spectrum1DInfo {
2622
+ nucleus: string;
2623
+ dimension: number;
2624
+ isComplex: boolean;
2625
+ originFrequency: number;
2626
+ baseFrequency: number;
2627
+ pulseSequence: string;
2628
+ experiment: string;
2629
+ isFt: boolean;
2630
+ }
2631
+
2632
+ declare interface Spectrum2DInfo {
2633
+ nucleus: string[];
2634
+ originFrequency: string;
2635
+ baseFrequency: string | number;
2636
+ pulseSequence: string;
2637
+ experiment: string;
2638
+ }
2639
+
2473
2640
  export declare interface SpinSystem {
2474
2641
  /**
2475
2642
  * isolated clusters from a similarity/connectivity matrix