Package Chem :: Module rdmolfiles :: Class SDMolSupplier
[hide private]
[frames] | no frames]

Class SDMolSupplier



 object --+    
          |    
??.instance --+
              |
             SDMolSupplier

A class which supplies molecules from an SD file.

 Usage examples:

   1) Lazy evaluation: the molecules are not constructed until we ask for them:
      >>> suppl = SDMolSupplier('in.smi')
      >>> for mol in suppl:
      ...    mol.GetNumAtoms()

   2) Lazy evaluation 2:
      >>> suppl = SDMolSupplier('in.smi')
      >>> mol1 = suppl.next()
      >>> mol2 = suppl.next()
      >>> suppl.reset()
      >>> mol3 = suppl.next()
      # mol3 and mol1 are the same:        >>> MolToSmiles(mol3)==MolToSmiles(mol1)

   3) Random Access:  all molecules are constructed as soon as we ask for the
      length:
      >>> suppl = SDMolSupplier('in.smi')
      >>> nMols = len(suppl)
      >>> for i in range(nMols):
      ...   suppl[i].GetNumAtoms()

 Properties in the SD file are used to set properties on each molecule.
The properties are accessible using the mol.GetProp(propName) method.



Instance Methods [hide private]
 
GetItemText(...)
returns the text for an item...
 
SetData(...)
Sets the text to be parsed...
 
_SetStreamIndices(...)
Sets the locations of mol beginnings in the input stream.
 
__getitem__(...)
C++ signature:...
 
__init__(...)
C++ signature:...
 
__iter__(...)
C++ signature:...
 
__len__(...)
C++ signature:...
 
next(...)
Returns the next molecule in the file.
 
reset(...)
Resets our position in the file to the beginning.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  __instance_size__ = 48
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

GetItemText(...)

 
returns the text for an item
C++ signature:
    GetItemText(RDKit::SDMolSupplier {lvalue} self, unsigned int index) -> std::string

SetData(...)

 
Sets the text to be parsed
C++ signature:
    SetData(RDKit::SDMolSupplier {lvalue} self, std::string data, bool sanitize=True, bool removeHs=True) -> void*

_SetStreamIndices(...)

 
Sets the locations of mol beginnings in the input stream. Be *very* careful with this method.
C++ signature:
    _SetStreamIndices(RDKit::SDMolSupplier {lvalue} self, boost::python::api::object locs) -> void*

__getitem__(...)
(Indexing operator)

 
C++ signature:
__getitem__(RDKit::SDMolSupplier*, int) -> RDKit::ROMol*

__init__(...)
(Constructor)

 
C++ signature:
    __init__(_object*) -> void*
C++ signature:
    __init__(_object*, std::string fileName, bool sanitize=True, bool removeHs=True) -> void*

Overrides: object.__init__

__iter__(...)

 
C++ signature:
__iter__(RDKit::SDMolSupplier*) -> RDKit::SDMolSupplier*

__len__(...)
(Length operator)

 
C++ signature:
__len__(RDKit::SDMolSupplier {lvalue}) -> unsigned int

next(...)

 
Returns the next molecule in the file.  Raises _StopIteration_ on EOF.

C++ signature:
    next(RDKit::SDMolSupplier*) -> RDKit::ROMol*

reset(...)

 
Resets our position in the file to the beginning.

C++ signature:
    reset(RDKit::SDMolSupplier {lvalue}) -> void*