import type { Logger } from 'cheminfo-types'; import type * as OCL from 'openchemlib'; declare interface Add2DOptions extends GenerateContourLinesOptions { /** * Don't calculate contour in case of 2D. */ noContour?: boolean; } declare interface Chromatogram { times: number[]; series: Record; }>; } declare interface ContourLines { minX: number; maxX: number; minY: number; maxY: number; segments: Array<{ zValue?: number; lines?: number[]; }>; } /** * Parse JCAMP-DX data. * The data can be provided as a string or array buffer. In this latter case * we will convert it first to a string before parsing. * @param jcamp * @param optionsParam * @returns Converted result. */ export declare function convert(jcamp: string | ArrayBuffer | Uint8Array, optionsParam?: ConvertOptions): ConvertResult; /** * Conversion options. */ export declare interface ConvertOptions extends Partial { /** * If it is true, anywhere out of XYDATA, PEAKTABLE n PEAKASSIGNMENTS the comments are removed * @default false */ removeComments?: boolean; /** * By default we don't keep meta information. * @default `/^$/` */ keepRecordsRegExp?: RegExp; /** * Canonize the Labels (uppercase without symbol). */ canonicDataLabels?: boolean; /** * Canonize the metadata Labels (uppercase without symbol). */ canonicMetadataLabels?: boolean; /** * Convert numbers to Number. */ dynamicTyping?: boolean; /** * Remove the XY data. */ withoutXY?: boolean; /** * Special post-processing for GC / HPLC / MS. */ chromatogram?: boolean; /** * Force to keep the spectra in case of 2D. */ keepSpectra?: boolean; /** * For which fields we should not trim ? * @default `/^$/` */ noTrimRegExp?: RegExp; /** * A logger like `pino`. */ logger?: Logger; /** * Add profiling information. */ wantXY?: boolean; start?: number; fastParse?: boolean; } export declare interface ConvertResult { entries: Entry[]; flatten: Entry[]; } /** * Parse the JCAMP-DX to extract the structure as a tree. * @param jcamp * @param options * @returns Tree. */ export declare function createTree(jcamp: string | ArrayBuffer | Uint8Array, options?: CreateTreeOptions): Stack[]; export declare interface CreateTreeOptions { flatten?: boolean; } export declare interface Entry { spectra: Spectrum[]; ntuples: Ntuples; meta: Record; info: Record; tmp: Record; title?: string; dataType?: string; dataClass?: string; jcampDX?: string; jcampCS?: string; twoD?: boolean; minMax?: MinMax; children?: Entry[]; shiftOffsetVal?: number; shiftOffsetNum?: number; xType?: string; yType?: string; chromatogram?: Chromatogram; contourLines?: ContourLines; } declare interface GenerateContourLinesOptions { /** * Number of positive / negative contour levels to calculate. * @default `7` */ nbContourLevels: number; /** * Define for 2D the level as 5 times the median as default. * @default `5` */ noiseMultiplier: number; } export declare interface MinMax { z: number[][]; minX: number; maxX: number; minY: number; maxY: number; minZ: number; maxZ: number; median?: number; noice?: number; } export declare interface Ntuples { varname?: string[]; symbol?: string[]; vartype?: string[]; varform?: string[]; vardim?: number[]; units?: string[]; factor?: number[]; first?: number[]; last?: number[]; min?: number[]; max?: number[]; nucleus?: string[]; [key: string]: any | undefined; } declare type OCLLib = typeof OCL; declare interface ParsedCS { molfile: string; molecule: OCL.Molecule; } /** * Parse a JCAMP-CS entry and return a molecule and its molfile. * We try to extract the chirality either from the coordinates or from the STEREOCENTER field. * If chirality is present we will loose the coordinates as we need to * @see https://doi.org/10.1366/0003702914337894 * @param entry * @param options * @returns ParsedCS */ export declare function parseJcampCS(entry: Entry, options: ParseJcampCSOptions): ParsedCS | undefined; export declare interface ParseJcampCSOptions { OCL: OCLLib; logger?: Logger; } export declare function removeComment(value: string, separator?: string): string; export declare const removeCommentRegExp: RegExp; export declare interface Spectrum { [key: string]: any; data: Record; firstX?: number; firstY?: number; lastX?: number; deltaX?: number; yFactor?: number; xFactor?: number; nbPoints?: number; } declare interface Stack { title: string; jcamp: string; children: Stack[] | undefined; jcampDX?: string; jcampCS?: string; dataType?: string; dataClass?: string; } export { }