openchemlib-utils
    Preparing search index...

    Class MoleculesDB

    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

    Index

    Constructors

    • Creates an instance of MoleculesDB.

      Parameters

      • OCL: __module

        openchemlib library

      • Optionaloptions: { computeProperties?: boolean; keepEmptyMolecules?: boolean } = {}

        Options.

      Returns MoleculesDB

    Properties

    calculatedStatistics: Map<string, InternalStatistics>
    computeProperties: boolean
    dataStatistics: Map<string, InternalStatistics>
    db: {}
    keepEmptyMolecules: boolean
    OCL: __module
    searcher: SSSearcherWithIndex

    Accessors

    • get statistics(): { calculated: never[]; data: never[] }

      Returns { calculated: never[]; data: never[] }

    Methods

    • 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

      Parameters

      • options: any

      Returns void

    • append to the current database a CSV file

      Parameters

      • csv: string | ArrayBuffer

        text file containing the comma separated value file

      • Optionaloptions: {
            dynamicTyping?: boolean;
            header?: boolean;
            onStep?: Function;
            skipEmptyLines?: boolean;
        }

        options.

        • OptionaldynamicTyping?: boolean

          dynamically type the data (convert values to number of boolean if possible)

        • Optionalheader?: boolean

          if the first line of the file is a header

        • OptionalonStep?: Function

          call back to execute after each molecule

        • OptionalskipEmptyLines?: boolean

          skip empty lines

      Returns Promise<void>

    • 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

      Parameters

      • entries: object[]
      • Optionaloptions: {
            coordinatesPath?: string;
            idCodePath?: string;
            indexPath?: string;
            molfilePath?: string;
            mwPath?: string;
            onStep?: Function;
            smilesPath?: string;
        }
        • OptionalcoordinatesPath?: string
        • OptionalidCodePath?: string
        • OptionalindexPath?: string
        • OptionalmolfilePath?: string
        • OptionalmwPath?: string
        • OptionalonStep?: Function

          call back to execute after each molecule

        • OptionalsmilesPath?: string

      Returns Promise<void>

    • Append a SDF to the current database

      Parameters

      • sdf: string | ArrayBuffer

        text file containing the sdf

      • Optionaloptions: { dynamicTyping?: boolean; eol?: string; mixedEOL?: boolean; onStep?: Function }

        options

        • OptionaldynamicTyping?: boolean

          Dynamically type the data

        • Optionaleol?: string

          Specify the end of line character. Default will be the one found in the file

        • OptionalmixedEOL?: boolean

          Set to true if you know there is a mixture between \r\n and \n

        • OptionalonStep?: Function

          callback to execute after each molecule

      Returns Promise<void>

    • Append a list of SMILES to the current database.

      Parameters

      • smiles: string | ArrayBuffer

        text file containing a list of smiles

      • Optionaloptions: { onStep?: Function }

        Options

        • OptionalonStep?: Function

          call back to execute after each molecule

      Returns Promise<void>

    • Add a molecule to the current database.

      Parameters

      • molecule: Molecule

        The molecule to append.

      • Optionaldata: object

        Options.

      • OptionalmoleculeInfo: object

        May contain precalculated index and mw.

      Returns void

    • Add an entry in the database.

      Parameters

      • moleculeInfo: object

        a molecule as a JSON that may contain the following properties: molfile, smiles, idCode, mf, index

      • Optionaldata: object

      Returns void

    • Search in a MoleculesDB Inside the database all the same molecules are group together

      Parameters

      • Optionalquery: string | Molecule

        smiles, molfile, idlCode or instance of Molecule to look for

      • Optionaloptions: {
            flattenResult?: boolean;
            format?: "smiles" | "molfile" | "smarts" | "idCode";
            keepMolecule?: boolean;
            limit?: number;
            mode?: string;
        }

        Options

        • OptionalflattenResult?: boolean

          The database group the data for the same product. This allows to flatten the result

        • Optionalformat?: "smiles" | "molfile" | "smarts" | "idCode"

          query format

        • OptionalkeepMolecule?: boolean

          keep the OCL.Molecule object in the result

        • Optionallimit?: number

          maximal number of result

        • Optionalmode?: string

          search by 'substructure', 'exact' or 'similarity'

      Returns any[]

      array of object of the type {(molecule), idCode, data, properties}

    • Search in a MoleculesDB Inside the database all the same molecules are group together

      Parameters

      • Optionalquery: string | Molecule

        smiles, molfile, idCode or instance of Molecule to look for

      • Optionaloptions: {
            controler?: AbortController;
            flattenResult?: boolean;
            format?: "smiles" | "molfile" | "smarts" | "idCode";
            interval?: number;
            keepMolecule?: boolean;
            limit?: number;
            mode?: string;
            onStep?: Function;
        }

        Options.

        • Optionalcontroler?: AbortController

          callback to execute to check if the search should be aborted

        • OptionalflattenResult?: boolean

          The database group the data for the same product. This allows to flatten the result

        • Optionalformat?: "smiles" | "molfile" | "smarts" | "idCode"

          query format

        • Optionalinterval?: number

          interval in ms to call the onStep callback

        • OptionalkeepMolecule?: boolean

          keep the OCL.Molecule object in the result

        • Optionallimit?: number

          maximal number of result

        • Optionalmode?: string

          search by 'substructure', 'exact' or 'similarity'

        • OptionalonStep?: Function

          callback to execute after each interval

      Returns Promise<any[]>

      array of object of the type {(molecule), idCode, data, properties}