Package rdkit :: 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.sdf')
      >>> for mol in suppl:
      ...    mol.GetNumAtoms()

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

   3) Random Access:
      >>> suppl = SDMolSupplier('in.sdf')
      >>> mol1 = suppl[0] 
      >>> mol2 = suppl[1] 
      NOTE: this will generate an IndexError if the supplier doesn't have that many
      molecules.

   4) Random Access 2:  looping over all molecules 
      >>> suppl = SDMolSupplier('in.sdf')
      >>> 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(...)
GetItemText( (SDMolSupplier)self, (int)index) -> str : returns the text for an item
 
SetData(...)
SetData( (SDMolSupplier)self, (str)data [, (bool)sanitize=True [, (bool)removeHs=True]]) -> None : Sets the text to be parsed
 
_SetStreamIndices(...)
_SetStreamIndices( (SDMolSupplier)self, (AtomPairsParameters)locs) -> None : Sets the locations of mol beginnings in the input stream.
 
__getitem__(...)
__getitem__( (SDMolSupplier)arg1, (int)arg2) -> Mol :
 
__init__(...)
__init__( (object)arg1) -> None :
 
__iter__(...)
__iter__( (SDMolSupplier)arg1) -> SDMolSupplier :
 
__len__(...)
__len__( (SDMolSupplier)arg1) -> int :
 
__reduce__(...)
helper for pickle
 
atEnd(...)
atEnd( (SDMolSupplier)arg1) -> bool : Returns whether or not we have hit EOF.
 
next(...)
next( (SDMolSupplier)arg1) -> Mol : Returns the next molecule in the file.
 
reset(...)
reset( (SDMolSupplier)arg1) -> None : Resets our position in the file to the beginning.

Inherited from unreachable.instance: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

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

Inherited from object: __class__

Method Details [hide private]

GetItemText(...)

 

GetItemText( (SDMolSupplier)self, (int)index) -> str :
    returns the text for an item

    C++ signature :
        std::string GetItemText(RDKit::SDMolSupplier {lvalue},unsigned int)

SetData(...)

 

SetData( (SDMolSupplier)self, (str)data [, (bool)sanitize=True [, (bool)removeHs=True]]) -> None :
    Sets the text to be parsed

    C++ signature :
        void SetData(RDKit::SDMolSupplier {lvalue},std::string [,bool=True [,bool=True]])

_SetStreamIndices(...)

 

_SetStreamIndices( (SDMolSupplier)self, (AtomPairsParameters)locs) -> None :
    Sets the locations of mol beginnings in the input stream. Be *very* careful with this method.

    C++ signature :
        void _SetStreamIndices(RDKit::SDMolSupplier {lvalue},boost::python::api::object)

__getitem__(...)
(Indexing operator)

 

__getitem__( (SDMolSupplier)arg1, (int)arg2) -> Mol :

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

__init__(...)
(Constructor)

 

__init__( (object)arg1) -> None :

    C++ signature :
        void __init__(_object*)

__init__( (object)arg1, (str)fileName [, (bool)sanitize=True [, (bool)removeHs=True [, (bool)strictParsing=True]]]) -> None :

    C++ signature :
        void __init__(_object*,std::string [,bool=True [,bool=True [,bool=True]]])

Overrides: object.__init__

__iter__(...)

 

__iter__( (SDMolSupplier)arg1) -> SDMolSupplier :

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

__len__(...)
(Length operator)

 

__len__( (SDMolSupplier)arg1) -> int :

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

__reduce__(...)

 
helper for pickle

Overrides: object.__reduce__
(inherited documentation)

atEnd(...)

 

atEnd( (SDMolSupplier)arg1) -> bool :
    Returns whether or not we have hit EOF.
    

    C++ signature :
        bool atEnd(RDKit::SDMolSupplier {lvalue})

next(...)

 

next( (SDMolSupplier)arg1) -> Mol :
    Returns the next molecule in the file.  Raises _StopIteration_ on EOF.
    

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

reset(...)

 

reset( (SDMolSupplier)arg1) -> None :
    Resets our position in the file to the beginning.
    

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