@zakodium/nmr-types 0.5.23 → 0.5.25
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/dist/nmr-types.d.ts +273 -0
- package/package.json +6 -5
package/dist/nmr-types.d.ts
CHANGED
|
@@ -5,10 +5,14 @@ import type { GaussianShape1D } from 'ml-peak-shape-generator';
|
|
|
5
5
|
import type { GeneralizedLorentzianShape1D } from 'ml-peak-shape-generator';
|
|
6
6
|
import type { Logger } from 'cheminfo-types';
|
|
7
7
|
import type { LorentzianShape1D } from 'ml-peak-shape-generator';
|
|
8
|
+
import type { NmrData1D } from 'cheminfo-types';
|
|
9
|
+
import type { NmrData2D } from 'cheminfo-types';
|
|
8
10
|
import type { NumberArray } from 'cheminfo-types';
|
|
9
11
|
import type { PeakXYWidth } from 'cheminfo-types';
|
|
10
12
|
import type { PseudoVoigtShape1D } from 'ml-peak-shape-generator';
|
|
11
13
|
import type { XYEquallySpacedOptions } from 'ml-spectra-processing';
|
|
14
|
+
import type { z } from 'zod';
|
|
15
|
+
import type { ZodType } from 'zod';
|
|
12
16
|
|
|
13
17
|
export declare interface AirplsOptions {
|
|
14
18
|
algorithm: 'airpls';
|
|
@@ -124,6 +128,13 @@ export declare interface BasePeak {
|
|
|
124
128
|
id: string;
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
export declare interface BaseSpectrum {
|
|
132
|
+
id: string;
|
|
133
|
+
selector?: NmrLoaderSelectors;
|
|
134
|
+
meta: Metadata;
|
|
135
|
+
customInfo: any;
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
export declare interface BernsteinOptions {
|
|
128
139
|
degree: number;
|
|
129
140
|
algorithm: 'bernstein';
|
|
@@ -172,6 +183,11 @@ declare interface BooleanField extends Field<boolean> {
|
|
|
172
183
|
type: 'boolean';
|
|
173
184
|
}
|
|
174
185
|
|
|
186
|
+
export declare interface Color2D {
|
|
187
|
+
positiveColor: string;
|
|
188
|
+
negativeColor: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
175
191
|
declare type CommonField = SelectField | StringField | NumberField | BooleanField | LabelField;
|
|
176
192
|
|
|
177
193
|
export declare interface CubicOptions {
|
|
@@ -218,6 +234,8 @@ export declare interface CubicOptions {
|
|
|
218
234
|
medianWindow?: number;
|
|
219
235
|
}
|
|
220
236
|
|
|
237
|
+
export declare type DataSelectionOption = 'ft' | 'fid' | 'both' | 'preferFT' | 'preferFID';
|
|
238
|
+
|
|
221
239
|
export declare interface DigitalFilter2DOptions extends BaseFilter {
|
|
222
240
|
name: 'digitalFilter2D';
|
|
223
241
|
value: DigitalFilterOptions_2;
|
|
@@ -243,6 +261,27 @@ export declare interface DirectDimensionOptions {
|
|
|
243
261
|
phaseCorrection?: PhaseCorrection;
|
|
244
262
|
}
|
|
245
263
|
|
|
264
|
+
export declare interface Display {
|
|
265
|
+
isVisible: boolean;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export declare interface Display1D extends Display {
|
|
269
|
+
color: string;
|
|
270
|
+
isPeaksMarkersVisible: boolean;
|
|
271
|
+
isRealSpectrumVisible: boolean;
|
|
272
|
+
isVisibleInDomain: boolean;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export declare interface Display2D extends Color2D, Display {
|
|
276
|
+
isPositiveVisible: boolean;
|
|
277
|
+
isNegativeVisible: boolean;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export declare interface DomainUpdateRules {
|
|
281
|
+
readonly updateYDomain: boolean;
|
|
282
|
+
readonly updateXDomain: boolean;
|
|
283
|
+
}
|
|
284
|
+
|
|
246
285
|
declare type EquallySpacedFilterOptions = Pick<XYEquallySpacedOptions, 'from' | 'to' | 'numberOfPoints' | 'exclusions'>;
|
|
247
286
|
|
|
248
287
|
export declare interface EquallySpacedOptions extends BaseFilter {
|
|
@@ -350,6 +389,29 @@ export declare interface GaussianOptions {
|
|
|
350
389
|
lineBroadeningCenter: number;
|
|
351
390
|
}
|
|
352
391
|
|
|
392
|
+
export declare interface GeneralLoadersSelector {
|
|
393
|
+
/**
|
|
394
|
+
* priories processed or raw data if both exists
|
|
395
|
+
* @default 'both'
|
|
396
|
+
*/
|
|
397
|
+
dataSelection?: DataSelectionOption;
|
|
398
|
+
/**
|
|
399
|
+
* should we ignore 1D spectra
|
|
400
|
+
* @default true
|
|
401
|
+
*/
|
|
402
|
+
keep1D?: boolean;
|
|
403
|
+
/**
|
|
404
|
+
* should we ignore 2D spectra
|
|
405
|
+
* @default true
|
|
406
|
+
*/
|
|
407
|
+
keep2D?: boolean;
|
|
408
|
+
/**
|
|
409
|
+
* should we keep only real part. we will ignore keepFID
|
|
410
|
+
* @default true
|
|
411
|
+
*/
|
|
412
|
+
onlyReal?: boolean;
|
|
413
|
+
}
|
|
414
|
+
|
|
353
415
|
export declare interface IndirectDimensionOptions {
|
|
354
416
|
acquisitionScheme?: string;
|
|
355
417
|
reverse?: boolean;
|
|
@@ -500,6 +562,21 @@ export declare interface MatrixOptions<MatrixFilterOptions extends object> {
|
|
|
500
562
|
|
|
501
563
|
export declare type MatrixProperties = Record<string, Properties>;
|
|
502
564
|
|
|
565
|
+
export declare type Metadata = Record<string, any>;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Plugins should use Declaration Merging on this interface.
|
|
569
|
+
* `NmrLoaderSelectors` is a selector used by NMRium loaders to filter the data to load
|
|
570
|
+
*/
|
|
571
|
+
export declare interface NmrLoaderSelectors {
|
|
572
|
+
/**
|
|
573
|
+
* Read methods take a file-collection input, the root is used to call `fileCollection.subroot(selector.root)`.
|
|
574
|
+
*/
|
|
575
|
+
root?: string;
|
|
576
|
+
general?: GeneralLoadersSelector;
|
|
577
|
+
files?: string[];
|
|
578
|
+
}
|
|
579
|
+
|
|
503
580
|
export declare interface NMRPeak1D extends PeakXYWidth {
|
|
504
581
|
id?: string;
|
|
505
582
|
kind?: SignalKind;
|
|
@@ -627,6 +704,14 @@ export declare interface PolynomialOptions {
|
|
|
627
704
|
degree: number;
|
|
628
705
|
}
|
|
629
706
|
|
|
707
|
+
/**
|
|
708
|
+
* Computed from Spectrum1DProcessingTypeRegistry and Spectrum2DProcessingTypeRegistry keys.
|
|
709
|
+
* Ensures type-safety on operator-registration.
|
|
710
|
+
*
|
|
711
|
+
* If the operator is not registered in the type registries. It should not be registerable in the operator registry.
|
|
712
|
+
*/
|
|
713
|
+
export declare type ProcessingOperatorId = Exclude<keyof SpectrumProcessingTypeRegistry, number>;
|
|
714
|
+
|
|
630
715
|
declare type Properties = ListField | SelectField | StringField | NumberField | BooleanField | LabelField;
|
|
631
716
|
|
|
632
717
|
export declare interface Range extends Omit<NMRRange, 'signals' | 'id'> {
|
|
@@ -737,6 +822,194 @@ export declare interface SineBellOptions {
|
|
|
737
822
|
|
|
738
823
|
export declare type SineSquareOptions = Omit<SineBellOptions, 'exponent'>;
|
|
739
824
|
|
|
825
|
+
export declare type Spectra = Spectrum[];
|
|
826
|
+
|
|
827
|
+
export declare type Spectrum = Spectrum1D | Spectrum2D;
|
|
828
|
+
|
|
829
|
+
export declare interface Spectrum1D extends BaseSpectrum {
|
|
830
|
+
/**
|
|
831
|
+
* Contains processed data.
|
|
832
|
+
*
|
|
833
|
+
* originalData -> processing pipeline -> data
|
|
834
|
+
*/
|
|
835
|
+
data: NmrData1D;
|
|
836
|
+
/**
|
|
837
|
+
* Original data extracted from the use data files like jcamp / bruker and so-on.
|
|
838
|
+
*/
|
|
839
|
+
originalData: NmrData1D;
|
|
840
|
+
peaks: Peaks;
|
|
841
|
+
display: Display1D;
|
|
842
|
+
integrals: Integrals;
|
|
843
|
+
ranges: Ranges;
|
|
844
|
+
info: Info1D;
|
|
845
|
+
originalInfo: Info1D;
|
|
846
|
+
filters: Filter1DEntry[];
|
|
847
|
+
/**
|
|
848
|
+
* EXPERIMENTAL type declaration.
|
|
849
|
+
* Can change anytime without migration.
|
|
850
|
+
*/
|
|
851
|
+
processings?: Array<Spectrum1DProcessingTypeRegistry[keyof Spectrum1DProcessingTypeRegistry]>;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Registry of all the 1d spectrum processing operations.
|
|
856
|
+
* Each plugin adding operator for 1d spectrum processing should register their types here with declaration merging.
|
|
857
|
+
*
|
|
858
|
+
* Use the operatorId as the key, and SpectrumProcessingOperation<Settings, Options> as value.
|
|
859
|
+
*
|
|
860
|
+
* Spectrum1D type definition uses `processings?: Array<Spectrum1DProcessingTypeRegistry[keyof Spectrum1DProcessingTypeRegistry]>;`
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```ts
|
|
864
|
+
* declare module '@zakodium/nmr-types' {
|
|
865
|
+
* interface Spectrum1DProcessingTypeRegistry {
|
|
866
|
+
* 'my-package#myOperator': SpectrumProcessingOperation<MyOperatorSettings, MyOperatorOptions>;
|
|
867
|
+
* }
|
|
868
|
+
* }
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
export declare interface Spectrum1DProcessingTypeRegistry extends Record<string & {}, // string only break auto complete
|
|
872
|
+
SpectrumProcessingOperation<unknown, unknown>> {
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
export declare type Spectrum1DSource = Partial<Spectrum1D>;
|
|
876
|
+
|
|
877
|
+
export declare interface Spectrum2D extends BaseSpectrum {
|
|
878
|
+
zones: Zones;
|
|
879
|
+
/**
|
|
880
|
+
* Contains processed data.
|
|
881
|
+
*
|
|
882
|
+
* originalData -> processing pipeline -> data
|
|
883
|
+
*/
|
|
884
|
+
data: NmrData2D;
|
|
885
|
+
info: Info2D;
|
|
886
|
+
originalInfo: Info2D;
|
|
887
|
+
display: Display2D;
|
|
888
|
+
/**
|
|
889
|
+
* Original data extracted from the use data files like jcamp / bruker and so-on.
|
|
890
|
+
*/
|
|
891
|
+
originalData: NmrData2D;
|
|
892
|
+
filters: Filter2DEntry[];
|
|
893
|
+
/**
|
|
894
|
+
* EXPERIMENTAL type declaration.
|
|
895
|
+
* Can change anytime without migration.
|
|
896
|
+
*/
|
|
897
|
+
processings?: Array<Spectrum2DProcessingTypeRegistry[keyof Spectrum2DProcessingTypeRegistry]>;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
|
+
* Registry of all the 2d spectrum processing operations.
|
|
902
|
+
* Each plugin adding operator for 2d spectrum processing should register their types here with declaration merging.
|
|
903
|
+
*
|
|
904
|
+
* Use the operatorId as the key, and SpectrumProcessingOperation<Settings, Options> as value.
|
|
905
|
+
*
|
|
906
|
+
* Spectrum2D type definition uses `processings?: Array<Spectrum2DProcessingTypeRegistry[keyof Spectrum2DProcessingTypeRegistry]>;`
|
|
907
|
+
*
|
|
908
|
+
* @example
|
|
909
|
+
* ```ts
|
|
910
|
+
* declare module '@zakodium/nmr-types' {
|
|
911
|
+
* interface Spectrum2DProcessingTypeRegistry {
|
|
912
|
+
* 'my-package#myOperator': SpectrumProcessingOperation<MyOperatorSettings, MyOperatorOptions>;
|
|
913
|
+
* }
|
|
914
|
+
* }
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
export declare interface Spectrum2DProcessingTypeRegistry extends Record<string & {}, // string only break auto complete
|
|
918
|
+
SpectrumProcessingOperation<unknown, unknown>> {
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
export declare type Spectrum2DSource = Partial<Spectrum2D>;
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* A ProcessingOperation is a step in the processing pipeline.
|
|
925
|
+
* A ProcessingOperation can have no options: `ProcessingOperation<undefined>`.
|
|
926
|
+
* ProcessingOperation are stored in NMRiumState spectra in the processing field.
|
|
927
|
+
*/
|
|
928
|
+
export declare interface SpectrumProcessingOperation<Settings, Options> {
|
|
929
|
+
/**
|
|
930
|
+
* Unique identifier of the operation in the pipeline.
|
|
931
|
+
* React frontend constraint.
|
|
932
|
+
*/
|
|
933
|
+
uid: string;
|
|
934
|
+
/**
|
|
935
|
+
* `id` of the operator registered in the core processing registry.
|
|
936
|
+
*/
|
|
937
|
+
operatorId: ProcessingOperatorId;
|
|
938
|
+
/**
|
|
939
|
+
* User Parameters for the operation.
|
|
940
|
+
*/
|
|
941
|
+
settings: Settings;
|
|
942
|
+
/**
|
|
943
|
+
* Computed Parameters for the operation.
|
|
944
|
+
* Computed from settings and the spectrum.
|
|
945
|
+
*
|
|
946
|
+
* If `undefined`, options should be computed.
|
|
947
|
+
*/
|
|
948
|
+
options: Options | undefined;
|
|
949
|
+
/**
|
|
950
|
+
* Whether the operation is enabled or not.
|
|
951
|
+
*/
|
|
952
|
+
enabled: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Error produced by the operation.
|
|
955
|
+
*/
|
|
956
|
+
error: undefined | string;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
export declare interface SpectrumProcessingOperator<SchemaSettings extends ZodType | null, SchemaOptions extends ZodType | null> {
|
|
960
|
+
/**
|
|
961
|
+
* Unique identifier (across the core operators registry) for the operation.
|
|
962
|
+
* Developer-readable, camelCase, package name as prefix.
|
|
963
|
+
*
|
|
964
|
+
* @example `@zakodium/nmrium-private-plugins#baselineCorrection`
|
|
965
|
+
*/
|
|
966
|
+
id: ProcessingOperatorId;
|
|
967
|
+
/**
|
|
968
|
+
* Ensure the settings are valid for the operation.
|
|
969
|
+
* `null` if the operation doesn't need settings.
|
|
970
|
+
*/
|
|
971
|
+
schemaSettings: SchemaSettings;
|
|
972
|
+
/**
|
|
973
|
+
* Ensure the options are valid for the operation.
|
|
974
|
+
* `null` if the operation doesn't need options, it implies `apply` will always receive `null` as options.
|
|
975
|
+
*/
|
|
976
|
+
schemaOptions: SchemaOptions;
|
|
977
|
+
/**
|
|
978
|
+
* Function that takes the spectrum in the state of the current pipeline step,
|
|
979
|
+
* the operation’s settings, and returns options to apply the operation.
|
|
980
|
+
*/
|
|
981
|
+
computeOptions: (spectrum: Spectrum, settings: z.output<SchemaSettings>) => z.output<SchemaOptions>;
|
|
982
|
+
/**
|
|
983
|
+
* Returns whether the operation can be applied on given data.
|
|
984
|
+
*
|
|
985
|
+
* @param data
|
|
986
|
+
*/
|
|
987
|
+
isApplicable: (spectrum: Spectrum) => boolean;
|
|
988
|
+
/**
|
|
989
|
+
* Function that applies the operation to the spectrum given the options.
|
|
990
|
+
*/
|
|
991
|
+
apply: (spectrum: Spectrum, options: z.output<SchemaOptions>) => Spectrum;
|
|
992
|
+
/**
|
|
993
|
+
* Hints to the caller that the operation will modify the data domain (either x, y, or both),
|
|
994
|
+
* requiring to reset it in the UI.
|
|
995
|
+
*/
|
|
996
|
+
domainUpdateRules: DomainUpdateRules;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
export declare interface SpectrumProcessingOperatorTypeRegistry extends Record<string & {}, SpectrumProcessingOperator<ZodType | null, ZodType | null>> {
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
/**
|
|
1003
|
+
* Registry of all spectrum processing operations.
|
|
1004
|
+
* Use it as a getter from operator id.
|
|
1005
|
+
*
|
|
1006
|
+
* Dedicated Spectrum1DProcessingTypeRegistry and Spectrum2DProcessingTypeRegistry are needed to fulfill Spectrum1D and Spectrum2D type definition.
|
|
1007
|
+
*
|
|
1008
|
+
* Plugin developers should not use declaration merging on this interface.
|
|
1009
|
+
*/
|
|
1010
|
+
export declare interface SpectrumProcessingTypeRegistry extends Spectrum1DProcessingTypeRegistry, Spectrum2DProcessingTypeRegistry {
|
|
1011
|
+
}
|
|
1012
|
+
|
|
740
1013
|
export declare type SpectrumSource = 'prediction' | 'database' | 'unknown';
|
|
741
1014
|
|
|
742
1015
|
declare interface StringField extends Field<string> {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmr-types",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "Types related to NMR data processing.",
|
|
5
5
|
"author": "Zakodium Sàrl",
|
|
6
6
|
"license": "CC-BY-NC-SA-4.0",
|
|
@@ -24,19 +24,20 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^24.13.3",
|
|
27
|
-
"cheminfo-types": "^1.15.0",
|
|
28
27
|
"esbuild": "^0.28.2",
|
|
29
28
|
"rimraf": "^6.1.3",
|
|
30
29
|
"typescript": "~6.0.3",
|
|
31
|
-
"vitest": "^4.1.
|
|
30
|
+
"vitest": "^4.1.11"
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
33
|
+
"cheminfo-types": "^1.15.0",
|
|
34
34
|
"ml-peak-shape-generator": "^5.5.0",
|
|
35
35
|
"ml-signal-processing": "^2.2.2",
|
|
36
|
-
"ml-spectra-processing": "^14.33.0"
|
|
36
|
+
"ml-spectra-processing": "^14.33.0",
|
|
37
|
+
"zod": "^4.4.3"
|
|
37
38
|
},
|
|
38
39
|
"volta": {
|
|
39
40
|
"extends": "../../../package.json"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "c52bfe2085c7690604fbcbe2e06ef6de0a66428d"
|
|
42
43
|
}
|