Class SDFileParser

Constructors

  • Creates a new parser.

    Parameters

    • sdf: string

      String with the SDF

    • fields: string[]

      Array of field names to parse. If null, the SDF is scanned to find all possible names (not efficient).

    Returns SDFileParser

Methods

  • Returns the content of the field name from the current record or null.

    Parameters

    • name: string

    Returns string

  • Parameters

    • index: number

    Returns string

  • Returns the list of field names for the entire SDF.

    Parameters

    • recordsToInspect: number

      Number of records scanned to determine the list.

    Returns string[]

  • Returns the current Molfile string.

    Returns string

  • Move to the next Molfile. Returns true if there is one, false otherwise.

    Returns boolean

    Example


    const sdf = fs.readFileSync('./mysdf.sdf', 'utf8');
    const parser = new SDFileParser(sdf);
    while (parser.next()) {
    const molecule = parser.getMolecule();
    // process molecule
    }