rdkit.Chem.Fingerprints.DbFpSupplier module — The RDKit 2016.09.1 documentation

# rdkit.Chem.Fingerprints.DbFpSupplier module

Supplies a class for working with fingerprints from databases #DOC

class `rdkit.Chem.Fingerprints.DbFpSupplier.` `DbFpSupplier`(dbResults, fpColName='AutoFragmentFp', usePickles=True)

  Bases: `rdkit.VLib.Node.VLibNode`

  new fps come back with all additional fields from the database set in a “_fieldsFromDb” data member

  `GetColumnNames`()
  `next`()

class `rdkit.Chem.Fingerprints.DbFpSupplier.` `ForwardDbFpSupplier`(*args, **kwargs)

  Bases: `rdkit.Chem.Fingerprints.DbFpSupplier.DbFpSupplier`

  DbFp supplier supporting only forward iteration

      >>> from rdkit import RDConfig
      >>> from rdkit.Dbase.DbConnection import DbConnect
      >>> fName = RDConfig.RDTestDatabase
      >>> conn = DbConnect(fName,'simple_combined')
      >>> suppl = ForwardDbFpSupplier(conn.GetData())

  we can loop over the supplied fingerprints: >>> fps = [] >>> for fp in suppl: ... fps.append(fp) >>> len(fps) 12

  `NextItem`()

    NOTE: this has side effects

  `reset`()

class `rdkit.Chem.Fingerprints.DbFpSupplier.` `RandomAccessDbFpSupplier`(*args, **kwargs)

  Bases: `rdkit.Chem.Fingerprints.DbFpSupplier.DbFpSupplier`

  DbFp supplier supporting random access: >>> import os.path >>> from rdkit import RDConfig >>> from rdkit.Dbase.DbConnection import DbConnect >>> fName = RDConfig.RDTestDatabase >>> conn = DbConnect(fName,’simple_combined’) >>> suppl = RandomAccessDbFpSupplier(conn.GetData()) >>> len(suppl) 12

  we can pull individual fingerprints: >>> fp = suppl[5] >>> fp.GetNumBits() 128 >>> fp.GetNumOnBits() 54

  a standard loop over the fingerprints: >>> fps = [] >>> for fp in suppl: ... fps.append(fp) >>> len(fps) 12

  or we can use an indexed loop: >>> fps = [None]*len(suppl) >>> for i in range(len(suppl)): ... fps[i] = suppl[i] >>> len(fps) 12

  `NextItem`()
  `reset`()