/** * this.db is an object with properties 'oclID' that has as value * an object that contains the following properties: * molecule: an OCL molecule instance * index: OCL index used for substructure searching * properties: all the calculates properties * data: array containing free data associated with this molecule */ export class MoleculesDB { /** * Creates an instance of MoleculesDB. * @param {typeof import('openchemlib')} OCL - openchemlib library * @param {object} [options={}] - Options. * @param {boolean} [options.computeProperties=false] * @param {boolean} [options.keepEmptyMolecules=false] */ constructor(OCL: typeof import("openchemlib"), options?: { computeProperties?: boolean | undefined; keepEmptyMolecules?: boolean | undefined; }); OCL: typeof import("openchemlib"); db: {}; /** * @type {Map} */ dataStatistics: Map; /** * @type {Map} */ calculatedStatistics: Map; computeProperties: boolean; keepEmptyMolecules: boolean; searcher: import("openchemlib").SSSearcherWithIndex; clear(): void; get nbMolecules(): number; get nbData(): number; get statistics(): { data: never[]; calculated: never[]; }; /** * Append an array of entries to the current database. An entry is an object that by default should contain a 'ocl' property containing idCode and optionally index and coordinates * @param {*} moleculesDB * @param {object[]} entries * @param {object} [options={}] * @param {string} [options.idCodePath='ocl.idCode'] * @param {string} [options.indexPath='ocl.index'] * @param {string} [options.coordinatesPath='ocl.coordinates'] * @param {string} [options.mwPath='mw'] * @param {string} [options.smilesPath] * @param {string} [options.molfilePath] * @param {Function} [options.onStep] - call back to execute after each molecule * @returns {Promise} */ appendEntries(entries: object[], options?: { idCodePath?: string | undefined; indexPath?: string | undefined; coordinatesPath?: string | undefined; mwPath?: string | undefined; smilesPath?: string | undefined; molfilePath?: string | undefined; onStep?: Function | undefined; }): Promise; /** * append to the current database a CSV file * @param {string|ArrayBuffer} csv - text file containing the comma separated value file * @param {object} [options={}] - options. * @param {boolean} [options.header=true] - if the first line of the file is a header * @param {boolean} [options.dynamicTyping=true] - dynamically type the data (convert values to number of boolean if possible) * @param {boolean} [options.skipEmptyLines=true] - skip empty lines * @param {Function} [options.onStep] - call back to execute after each molecule * @returns {Promise} */ appendCSV(csv: string | ArrayBuffer, options?: { header?: boolean | undefined; dynamicTyping?: boolean | undefined; skipEmptyLines?: boolean | undefined; onStep?: Function | undefined; }): Promise; /** * Append a SDF to the current database * @param {string|ArrayBuffer} sdf - text file containing the sdf * @param {object} [options={}] - options * @param {Function} [options.onStep] - callback to execute after each molecule * @param {boolean} [options.dynamicTyping=true] - Dynamically type the data * @param {boolean} [options.mixedEOL=false] - Set to true if you know there is a mixture between \r\n and \n * @param {string} [options.eol] - Specify the end of line character. Default will be the one found in the file * @returns {Promise} */ appendSDF(sdf: string | ArrayBuffer, options?: { onStep?: Function | undefined; dynamicTyping?: boolean | undefined; mixedEOL?: boolean | undefined; eol?: string | undefined; }): Promise; /** * Append a list of SMILES to the current database. * @param {string|ArrayBuffer} smiles - text file containing a list of smiles * @param {object} [options={}] - Options * @param {Function} [options.onStep] - call back to execute after each molecule * @returns {Promise} */ appendSmilesList(smiles: string | ArrayBuffer, options?: { onStep?: Function | undefined; }): Promise; /** * Add a molecule to the current database. * @param {import('openchemlib').Molecule} molecule - The molecule to append. * @param {object} [data={}] - Options. * @param {object} [moleculeInfo={}] - May contain precalculated index and mw. */ pushEntry(molecule: import("openchemlib").Molecule, data?: object, moleculeInfo?: object): void; /** * Add an entry in the database. * @param {object} moleculeInfo - a molecule as a JSON that may contain the following properties: molfile, smiles, idCode, mf, index * @param {object} [data={}] */ pushMoleculeInfo(moleculeInfo: object, data?: object): void; /** * Search in a MoleculesDB * Inside the database all the same molecules are group together * @param {string|import('openchemlib').Molecule} [query] - smiles, molfile, idlCode or instance of Molecule to look for * @param {object} [options={}] - Options * @param {'smiles'|'idCode'|'smarts'|'molfile'} [options.format='idCode'] - query format * @param {'substructure'|'substructureOR'|'exact'|'exactNoStereo'|'similarity'} [options.mode='substructure'] - search algorithm * @param {boolean} [options.flattenResult=true] - The database group the data for the same product. This allows to flatten the result * @param {boolean} [options.keepMolecule=false] - keep the OCL.Molecule object in the result * @param {number} [options.limit=Number.MAX_SAFE_INTEGER] - maximal number of result * @returns {Array} array of object of the type {(molecule), idCode, data, properties} */ search(query?: string | import("openchemlib").Molecule, options?: { format?: "smiles" | "molfile" | "smarts" | "idCode" | undefined; mode?: "exact" | "substructure" | "substructureOR" | "similarity" | "exactNoStereo" | undefined; flattenResult?: boolean | undefined; keepMolecule?: boolean | undefined; limit?: number | undefined; }): any[]; /** * Search in a MoleculesDB * Inside the database all the same molecules are group together * @param {string|import('openchemlib').Molecule} [query] - smiles, molfile, idCode or instance of Molecule to look for * @param {object} [options={}] - Options. * @param {'smiles'|'idCode'|'smarts'|'molfile'} [options.format='idCode'] - query format * @param {'substructure'|'substructureOR'|'exact'|'exactNoStereo'|'similarity'} [options.mode='substructure'] - search algorithm * @param {boolean} [options.flattenResult=true] - The database group the data for the same product. This allows to flatten the result * @param {boolean} [options.keepMolecule=false] - keep the OCL.Molecule object in the result * @param {number} [options.limit=Number.MAX_SAFE_INTEGER] - maximal number of result * @param {number} [options.interval=100] - interval in ms to call the onStep callback * @param {Function} [options.onStep] - callback to execute after each interval * @param {AbortController} [options.controler] - callback to execute to check if the search should be aborted * @returns {Promise} array of object of the type {(molecule), idCode, data, properties} */ searchAsync(query?: string | import("openchemlib").Molecule, options?: { format?: "smiles" | "molfile" | "smarts" | "idCode" | undefined; mode?: "exact" | "substructure" | "substructureOR" | "similarity" | "exactNoStereo" | undefined; flattenResult?: boolean | undefined; keepMolecule?: boolean | undefined; limit?: number | undefined; interval?: number | undefined; onStep?: Function | undefined; controler?: AbortController | undefined; }): Promise; /** * Returns an array with the current database * @returns */ getDB(): any[]; /** * Append the property `data.color` to each entry based on a data or property label * {object} [options={}] * {string} [options.dataLabel] name of the property from `data` to use * {string} [options.propertyLabel] name of the property from `properties` to use * {number} [options.colorLabel='color'] name of the property to add in data that will contain the color * {number} [options.minValue] * {number} [options.maxValue] * {number} [options.minHue=0] * {number} [options.maxHue=360] * {number} [options.saturation=65] percent of color saturation * {number} [options.lightness=65] percent of color lightness * @param options */ appendColor(options: any): void; } //# sourceMappingURL=MoleculesDB.d.ts.map