brukerconverter
Advanced tools
Comparing version 6.0.2 to 6.0.3-pre.1673653817
@@ -24,3 +24,3 @@ import { DoubleArray } from 'cheminfo-types'; | ||
*/ | ||
processingNumbern?: number[]; | ||
processingNumber?: number[]; | ||
/** | ||
@@ -86,2 +86,3 @@ * experiment number to select, default all | ||
xy?: boolean; | ||
keepFiles?: boolean; | ||
keepSpectra?: boolean; | ||
@@ -120,2 +121,9 @@ keepRecordsRegExp?: RegExp; | ||
export interface Files { | ||
relativePath: string; | ||
name: string; | ||
lastModified: number; | ||
size: number; | ||
} | ||
export interface SpectraData1D { | ||
@@ -129,7 +137,4 @@ spectra: Spectrum1D[]; | ||
shiftOffsetNum: 0; | ||
source: { | ||
name: string; | ||
expno: number; | ||
source: BrukerSource & { | ||
is1D: boolean; | ||
isFID: boolean; | ||
}; | ||
@@ -149,2 +154,10 @@ } | ||
export interface GeneralBrukerSource { | ||
name: string; | ||
expno: number; | ||
procno?: number; | ||
isFID: boolean; | ||
files?: Files; | ||
} | ||
export interface SpectraData2D { | ||
@@ -159,8 +172,3 @@ spectra: Spectrum2D[]; | ||
shiftOffsetNum: 0; | ||
source: { | ||
name: string; | ||
expno: number; | ||
is2D: boolean; | ||
isFID: boolean; | ||
}; | ||
source: BrukerSource & { is2D: boolean }; | ||
} | ||
@@ -174,1 +182,6 @@ | ||
): Promise<SpectraData[]>; | ||
export function convertOneExperiment( | ||
brukerFiles: Experiment, | ||
options?: ConverterOptions, | ||
): Promise<SpectraData>; |
@@ -72,2 +72,3 @@ 'use strict'; | ||
expno: currentExperimentNo, | ||
procno: currentProcessingNo, | ||
}; | ||
@@ -564,2 +565,3 @@ } | ||
* @param {boolean} [options.xy] - if true, spectra data is a object with x and y | ||
* @param {boolean} [options.keepFiles] - if true, the fileCollectionItems will be saved in source. | ||
* @param {boolean} [options.keepSpectra=false] - for 2D should we keep the spectra or just the matrix ? | ||
@@ -585,2 +587,5 @@ * @param {RegExp} [options.keepRecordsRegExp='\/.*\/'] - regular expresion to parse the metadata of the spectrum. | ||
} | ||
if (options.keepFiles) { | ||
result.source.files = brukerFiles.fileCollectionItems; | ||
} | ||
// todo we could as well keep the FileList at this level if | ||
@@ -593,5 +598,5 @@ // we want to keep the original data | ||
if (result.meta.GRPDLY) { | ||
result.meta.GRPDLY = Number(result.meta.GRPDLY); | ||
result.meta.DSPFVS = Number(result.meta.DSPFVS); | ||
result.meta.DECIM = Number(result.meta.DECIM); | ||
maybeAdd(result.meta, 'DSPFVS', result.meta.DSPFVS); | ||
maybeAdd(result.meta, 'GRPDLY', result.meta.GRPDLY); | ||
maybeAdd(result.meta, 'DECIM', result.meta.DECIM); | ||
} | ||
@@ -624,2 +629,11 @@ | ||
function maybeAdd(obj, name, value) { | ||
if (value === undefined) return; | ||
if (Array.isArray(value)) { | ||
obj[name] = value.slice(); | ||
} else { | ||
obj[name] = [value]; | ||
} | ||
} | ||
/** | ||
@@ -652,3 +666,4 @@ * | ||
exports.convertFileCollection = convertFileCollection; | ||
exports.convertOneExperiment = convertOneExperiment; | ||
exports.convertZip = convertZip; | ||
exports.groupByExperiments = groupByExperiments; |
{ | ||
"name": "brukerconverter", | ||
"version": "6.0.2", | ||
"version": "6.0.3-pre.1673653817", | ||
"description": "Parse and convert Bruker raw data", | ||
@@ -53,2 +53,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
@@ -12,3 +12,5 @@ import { getCoffee } from 'bruker-data-test'; | ||
const fileCollection = await getCoffee(); | ||
const results = await convertFileCollection(fileCollection); | ||
const results = await convertFileCollection(fileCollection, { | ||
converter: { keepFiles: true }, | ||
}); | ||
expect(results).toHaveLength(18); | ||
@@ -15,0 +17,0 @@ |
@@ -64,2 +64,3 @@ /** | ||
expno: currentExperimentNo, | ||
procno: currentProcessingNo, | ||
}; | ||
@@ -66,0 +67,0 @@ } |
export { convertZip } from './helpers/convertZip'; | ||
export { convertOneExperiment } from './util/convertOneExperiment'; | ||
export { convertFileCollection } from './convertFileCollection'; | ||
export { groupByExperiments } from './groupByExperiments'; |
@@ -10,2 +10,3 @@ import { convert1D } from './convert1D'; | ||
* @param {boolean} [options.xy] - if true, spectra data is a object with x and y | ||
* @param {boolean} [options.keepFiles] - if true, the fileCollectionItems will be saved in source. | ||
* @param {boolean} [options.keepSpectra=false] - for 2D should we keep the spectra or just the matrix ? | ||
@@ -31,2 +32,5 @@ * @param {RegExp} [options.keepRecordsRegExp='\/.*\/'] - regular expresion to parse the metadata of the spectrum. | ||
} | ||
if (options.keepFiles) { | ||
result.source.files = brukerFiles.fileCollectionItems; | ||
} | ||
// todo we could as well keep the FileList at this level if | ||
@@ -39,5 +43,5 @@ // we want to keep the original data | ||
if (result.meta.GRPDLY) { | ||
result.meta.GRPDLY = Number(result.meta.GRPDLY); | ||
result.meta.DSPFVS = Number(result.meta.DSPFVS); | ||
result.meta.DECIM = Number(result.meta.DECIM); | ||
maybeAdd(result.meta, 'DSPFVS', result.meta.DSPFVS); | ||
maybeAdd(result.meta, 'GRPDLY', result.meta.GRPDLY); | ||
maybeAdd(result.meta, 'DECIM', result.meta.DECIM); | ||
} | ||
@@ -69,1 +73,10 @@ | ||
} | ||
function maybeAdd(obj, name, value) { | ||
if (value === undefined) return; | ||
if (Array.isArray(value)) { | ||
obj[name] = value.slice(); | ||
} else { | ||
obj[name] = [value]; | ||
} | ||
} |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
54113
1543
2