brukerconverter
Advanced tools
Comparing version 6.3.0 to 6.3.2-pre.1696485692
@@ -1,166 +0,208 @@ | ||
import { DoubleArray, NmrData2D, FromTo } from 'cheminfo-types'; | ||
import type { FileCollectionItem, FileCollection } from 'filelist-utils'; | ||
import { DoubleArray } from 'cheminfo-types'; | ||
import { FileCollection } from 'filelist-utils'; | ||
import { FileCollectionItem } from 'filelist-utils'; | ||
import { FromTo } from 'cheminfo-types'; | ||
import { NmrData2D } from 'cheminfo-types'; | ||
import { Options } from 'filelist-utils/lib/Options'; | ||
type FirstLevelKeys = | ||
| 'ser' | ||
| 'fid' | ||
| 'acqus' | ||
| 'acqu2s' | ||
| '1r' | ||
| '1i' | ||
| '2rr' | ||
| 'procs' | ||
| 'proc2s'; | ||
export declare type ConverterOptions = ConverterOptions_2; | ||
type FirstLevelPartialFile = Partial< | ||
Record<FirstLevelKeys, FileCollectionItem> | ||
>; | ||
declare interface ConverterOptions_2 { | ||
xy?: boolean; | ||
keepFiles?: boolean; | ||
keepSpectra?: boolean; | ||
keepRecordsRegExp?: RegExp; | ||
} | ||
export interface GroupByExperimentsOptions { | ||
/** | ||
* processing number to select, default the smallest number | ||
* @default first | ||
*/ | ||
processingNumber?: number[]; | ||
/** | ||
* experiment number to select, default all | ||
* @default all | ||
*/ | ||
experimentNumbers?: number[]; | ||
/** | ||
* should we keep 1D spectra | ||
* @default true | ||
*/ | ||
keep1D?: boolean; | ||
/** | ||
* should we keep 2D spectra | ||
* @default true | ||
*/ | ||
keep2D?: boolean; | ||
/** | ||
* should we take only the first processed data (procno). | ||
* @default true | ||
*/ | ||
onlyFirstProcessedData?: boolean; | ||
/** | ||
* allow filter by only processed (FT) or raw data (FID), set a preference for | ||
* FT or FID if both exists, or always load both. | ||
* @default 'both' | ||
*/ | ||
dataSelection?: 'ft' | 'fid' | 'both' | 'preferFT' | 'preferFID'; | ||
/**@typedef {import('../types').ConvertFileListOptions} ConvertFileListOptions */ | ||
/** | ||
* Convert a fileCollection of a bruker folder with 1D and 2D data. | ||
* @param {import('filelist-utils').FileCollection} fileCollection - FileCollection instance of the bruker folder or zip file. | ||
* @param {ConvertFileListOptions} [options={}] | ||
* @returns {Promise<Array<import('../types').SpectraData>>} | ||
*/ | ||
export declare function convertFileCollection(fileCollection: FileCollection, options?: ConvertFileListOptions_2 | undefined): Promise<Array<SpectraData_2>>; | ||
export declare type ConvertFileListOptions = ConvertFileListOptions_2; | ||
declare interface ConvertFileListOptions_2 { | ||
filter?: GroupByExperimentsOptions_2; | ||
converter?: ConverterOptions_2; | ||
} | ||
export type Procno = FirstLevelPartialFile & { | ||
name: string; | ||
fileCollection: FileCollection; | ||
expno: number; | ||
is2D?: boolean; | ||
is1D?: boolean; | ||
isFT?: boolean; | ||
}; | ||
/**@typedef {import('../../types').ConverterOptions} ConverterOptions */ | ||
/** | ||
* Extract information and data from bruker files. | ||
* @param {import('../../types').Experiment} brukerFiles - grouped FileCollectionItems into an object. | ||
* @param {ConverterOptions} [options = {}] - options. | ||
* @returns {Promise<import('../../types').SpectraData>} | ||
*/ | ||
export declare function convertOneExperiment(brukerFiles: Experiment, options?: ConverterOptions_2 | undefined): Promise<SpectraData_2>; | ||
export type ProcessedData = Record<string, Procno>; | ||
/**@typedef {Parameters<import('filelist-utils').fileCollectionFromZip>[0]} ZipContent */ | ||
/** | ||
* Convert a zip that contains bruker folders, with one and/or bi-dimensional data. | ||
* @param {ZipContent} zip | ||
* @param {import('../../types').ConvertFileListOptions} options | ||
* @returns {Promise<Array<import('../../types').SpectraData>>} | ||
*/ | ||
export declare function convertZip(zip: ZipContent, options: ConvertFileListOptions_2): Promise<Array<SpectraData_2>>; | ||
export type Experiment = FirstLevelPartialFile & { | ||
name: string; | ||
expno: number; | ||
fileCollectionItems: FileCollectionItem[]; | ||
processedData?: ProcessedData; | ||
is2D?: boolean; | ||
is1D?: boolean; | ||
isFID?: boolean; | ||
declare interface Datum1D { | ||
re: DoubleArray; | ||
im: DoubleArray; | ||
x: DoubleArray; | ||
} | ||
declare type Experiment = FirstLevelPartialFile & { | ||
name: string; | ||
expno: number; | ||
fileCollectionItems: FileCollectionItem[]; | ||
quantFactorSample?: FileCollectionItem; | ||
processedData?: ProcessedData; | ||
is2D?: boolean; | ||
is1D?: boolean; | ||
isFID?: boolean; | ||
}; | ||
export function groupByExperiments( | ||
fileCollection: FileCollection, | ||
options?: GroupByExperimentsOptions, | ||
): Experiment[]; | ||
declare type FirstLevelKeys = | ||
| 'ser' | ||
| 'fid' | ||
| 'acqus' | ||
| 'acqu2s' | ||
| '1r' | ||
| '1i' | ||
| '2rr' | ||
| 'procs' | ||
| 'proc2s'; | ||
export interface ConverterOptions { | ||
xy?: boolean; | ||
keepFiles?: boolean; | ||
keepSpectra?: boolean; | ||
keepRecordsRegExp?: RegExp; | ||
} | ||
export interface ConvertFileListOptions { | ||
filter?: GroupByExperimentsOptions; | ||
converter?: ConverterOptions; | ||
} | ||
declare type FirstLevelPartialFile = Partial< | ||
Record<FirstLevelKeys, FileCollectionItem> | ||
>; | ||
export interface Datum1D { | ||
re: DoubleArray; | ||
im: DoubleArray; | ||
x: DoubleArray; | ||
declare interface GeneralBrukerSource { | ||
name: string; | ||
expno: number; | ||
procno?: number; | ||
isFID: boolean; | ||
files?: FileCollectionItem[]; | ||
} | ||
export interface Spectrum1D { | ||
dataType: string; | ||
dataTable: string; | ||
nbPoints: number; | ||
firstX: number; | ||
lastX: number; | ||
nucleus: string[]; | ||
xUnit: string; | ||
yUnit: string; | ||
isXYdata: boolean; | ||
observeFrequency: number; | ||
deltaX: number; | ||
data: Datum1D; | ||
} | ||
/** | ||
* @typedef {import('../types').GroupByExperimentsOptions} GroupByExperimentsOptions | ||
*/ | ||
/** | ||
* Retrieve the list of files for further process | ||
* @param {import('filelist-utils').FileCollection} fileCollection - FileCollection instance of the bruker folder or zip file. | ||
* @param {GroupByExperimentsOptions} [options={}] | ||
* @returns {Array<import('../types').Experiment>} | ||
*/ | ||
export declare function groupByExperiments(fileCollection: FileCollection, options?: GroupByExperimentsOptions_2 | undefined): Array<Experiment>; | ||
export interface Spectrum2D extends Spectrum1D { | ||
pageValue: number; | ||
export declare type GroupByExperimentsOptions = GroupByExperimentsOptions_2; | ||
declare interface GroupByExperimentsOptions_2 { | ||
/** | ||
* processing number to select, default the smallest number | ||
* @default first | ||
*/ | ||
processingNumber?: number[]; | ||
/** | ||
* experiment number to select, default all | ||
* @default all | ||
*/ | ||
experimentNumbers?: number[]; | ||
/** | ||
* should we keep 1D spectra | ||
* @default true | ||
*/ | ||
keep1D?: boolean; | ||
/** | ||
* should we keep 2D spectra | ||
* @default true | ||
*/ | ||
keep2D?: boolean; | ||
/** | ||
* should we take only the first processed data (procno). | ||
* @default true | ||
*/ | ||
onlyFirstProcessedData?: boolean; | ||
/** | ||
* allow filter by only processed (FT) or raw data (FID), set a preference for | ||
* FT or FID if both exists, or always load both. | ||
* @default 'both' | ||
*/ | ||
dataSelection?: 'ft' | 'fid' | 'both' | 'preferFT' | 'preferFID'; | ||
} | ||
export interface File { | ||
relativePath?: string; | ||
name: string; | ||
lastModified: number; | ||
size?: number; | ||
declare type ProcessedData = Record<string, Procno_2>; | ||
/** | ||
* ProcessedData | ||
*/ | ||
export declare type Procno = Procno_2; | ||
declare type Procno_2 = FirstLevelPartialFile & { | ||
name: string; | ||
fileCollectionItems: FileCollectionItem[]; | ||
expno: number; | ||
procno: number; | ||
is2D?: boolean; | ||
is1D?: boolean; | ||
isFT?: boolean; | ||
}; | ||
export declare type SpectraData = SpectraData_2; | ||
declare interface SpectraData1D { | ||
spectra: Spectrum1D[]; | ||
ntuples: any; | ||
integrals?: Array<FromTo & { integration: number }> | ||
meta: Record<string, string | number>; | ||
info: Record<string, string | number>; | ||
title: string; | ||
dataType: string; | ||
shiftOffsetNum: 0; | ||
source: GeneralBrukerSource & { | ||
is1D: boolean; | ||
}; | ||
} | ||
export interface SpectraData1D { | ||
spectra: Spectrum1D[]; | ||
ntuples: any; | ||
integrals?: Array<FromTo & { integration: number }> | ||
meta: Record<string, string | number>; | ||
info: Record<string, string | number>; | ||
title: string; | ||
dataType: string; | ||
shiftOffsetNum: 0; | ||
source: GeneralBrukerSource & { | ||
is1D: boolean; | ||
}; | ||
export declare type SpectraData2D = SpectraData2D_2; | ||
declare interface SpectraData2D_2 { | ||
spectra: Spectrum2D[]; | ||
minMax: NmrData2D; | ||
ntuples: any; | ||
meta: Record<string, any>; | ||
info: Record<string, any>; | ||
title: string; | ||
dataType: string; | ||
shiftOffsetNum: 0; | ||
source: GeneralBrukerSource & { is2D: boolean }; | ||
} | ||
export interface GeneralBrukerSource { | ||
name: string; | ||
expno: number; | ||
procno?: number; | ||
isFID: boolean; | ||
files?: File[]; | ||
declare type SpectraData_2 = SpectraData1D | SpectraData2D_2; | ||
declare interface Spectrum1D { | ||
dataType: string; | ||
dataTable: string; | ||
nbPoints: number; | ||
firstX: number; | ||
lastX: number; | ||
nucleus: string[]; | ||
xUnit: string; | ||
yUnit: string; | ||
isXYdata: boolean; | ||
observeFrequency: number; | ||
deltaX: number; | ||
data: Datum1D; | ||
} | ||
export interface SpectraData2D { | ||
spectra: Spectrum2D[]; | ||
minMax: NmrData2D; | ||
ntuples: any; | ||
meta: Record<string, any>; | ||
info: Record<string, any>; | ||
title: string; | ||
dataType: string; | ||
shiftOffsetNum: 0; | ||
source: GeneralBrukerSource & { is2D: boolean }; | ||
declare interface Spectrum2D extends Spectrum1D { | ||
pageValue: number; | ||
} | ||
type SpectraData = SpectraData1D | SpectraData2D; | ||
declare type ZipContent = [zipContent: string | number[] | Blob | ArrayBuffer | Uint8Array | NodeJS.ReadableStream | Promise<string | number[] | Blob | ArrayBuffer | Uint8Array | NodeJS.ReadableStream>, options?: Options | undefined][0]; | ||
export function convertFileCollection( | ||
fileCollection: FileCollection, | ||
options?: ConvertFileListOptions, | ||
): Promise<SpectraData[]>; | ||
export function convertOneExperiment( | ||
brukerFiles: Experiment, | ||
options?: ConverterOptions, | ||
): Promise<SpectraData>; | ||
export { } |
{ | ||
"name": "brukerconverter", | ||
"version": "6.3.0", | ||
"version": "6.3.2-pre.1696485692", | ||
"description": "Parse and convert Bruker raw data", | ||
"main": "lib/index.js", | ||
"module": "src/index.js", | ||
"types": "brukerconverter.d.ts", | ||
"main": "brukerconverter.cjs", | ||
"module": "brukerconverter.mjs", | ||
"exports": { | ||
".": { | ||
"types": "./brukerconverter.d.ts", | ||
"require": "./brukerconverter.cjs", | ||
"default": "./brukerconverter.mjs" | ||
} | ||
}, | ||
"files": [ | ||
"lib", | ||
"src", | ||
"brukerconverter.d.ts" | ||
"brukerconverter.d.ts", | ||
"brukerconverter.cjs", | ||
"brukerconverter.mjs" | ||
], | ||
"scripts": { | ||
"build": "cheminfo-build --entry src/index.js --root BrukerConverter", | ||
"api-extractor": "api-extractor run --local", | ||
"bundle": "npm run bundle-cjs && npm run bundle-esm", | ||
"bundle-common": "esbuild src/index.js --bundle --packages=external --minify", | ||
"bundle-cjs": "npm run bundle-common -- --format=cjs --outfile=brukerconverter.cjs", | ||
"bundle-esm": "npm run bundle-common -- --format=esm --outfile=brukerconverter.mjs", | ||
"bundle-types": "npm run tsc && npm run api-extractor", | ||
"build": "cheminfo-build --entry src/index.js --root BrukerConverter --no-source-map && rm dist/brukerconverter.js", | ||
"clean": "rimraf dist types", | ||
"eslint": "eslint src", | ||
"eslint-fix": "npm run eslint -- --fix", | ||
"prepack": "rollup -c", | ||
"prepack": "npm run bundle && npm run bundle-types", | ||
"prettier": "prettier --check src", | ||
"prettier-write": "prettier --write src", | ||
"test": "npm run test-only && npm run eslint && npm run prettier", | ||
"test-only": "jest --coverage" | ||
"test-only": "jest --coverage", | ||
"tsc": "tsc --project tsconfig.types.json" | ||
}, | ||
@@ -27,13 +42,13 @@ "keywords": [ | ||
], | ||
"repository": "cheminfo/brukerconverter", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cheminfo/brukerconverter/issues" | ||
"url": "https://github.com/cheminfo/nmrium/issues/new?title=%5Bbrukerconverter%5D" | ||
}, | ||
"homepage": "https://github.com/cheminfo/brukerconverter", | ||
"devDependencies": { | ||
"@babel/plugin-transform-modules-commonjs": "^7.21.2", | ||
"@microsoft/api-extractor": "^7.38.0", | ||
"@types/jest": "^29.5.0", | ||
"bruker-data-test": "^0.4.0", | ||
"cheminfo-build": "^1.2.0", | ||
"esbuild": "^0.19.4", | ||
"eslint": "^8.36.0", | ||
@@ -40,0 +55,0 @@ "eslint-config-cheminfo": "^8.2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 8 instances in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
1
1
31429
12
6
255
3