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:
VLibNode
new fps come back with all additional fields from the database set in a “_fieldsFromDb” data member
DbResults should be a subclass of Dbase.DbResultSet.DbResultBase
- GetColumnNames()¶
- next()¶
part of the iterator interface
raises StopIteration on failure
- class rdkit.Chem.Fingerprints.DbFpSupplier.ForwardDbFpSupplier(*args, **kwargs)¶
Bases:
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
DbResults should be a subclass of Dbase.DbResultSet.DbResultBase
- NextItem()¶
NOTE: this has side effects
- reset()¶
resets our iteration state
- class rdkit.Chem.Fingerprints.DbFpSupplier.RandomAccessDbFpSupplier(*args, **kwargs)¶
Bases:
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
DbResults should be a subclass of Dbase.DbResultSet.DbResultBase
- NextItem()¶
- reset()¶
resets our iteration state