| Trees | Indices | Help |
|
|---|
|
|
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.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
__instance_size__ = 80
|
|||
|
|||
GetItemText( (SDMolSupplier)self, (int)index) -> str :
returns the text for an item
C++ signature :
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetItemText(RDKit::SDMolSupplier {lvalue},unsigned int)
|
SetData( (SDMolSupplier)self, (str)data [, (bool)sanitize=True [, (bool)removeHs=True [, (bool)strictParsing=True]]]) -> None :
Sets the text to be parsed
C++ signature :
void SetData(RDKit::SDMolSupplier {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,bool=True [,bool=True [,bool=True]]])
|
_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__( (SDMolSupplier)arg1, (int)arg2) -> Mol :
C++ signature :
RDKit::ROMol* __getitem__(RDKit::SDMolSupplier*,int)
|
__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::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,bool=True [,bool=True [,bool=True]]])
|
__iter__( (SDMolSupplier)arg1) -> SDMolSupplier :
C++ signature :
RDKit::SDMolSupplier* __iter__(RDKit::SDMolSupplier*)
|
__len__( (SDMolSupplier)arg1) -> int :
C++ signature :
unsigned int __len__(RDKit::SDMolSupplier {lvalue})
|
|
atEnd( (SDMolSupplier)arg1) -> bool :
Returns whether or not we have hit EOF.
C++ signature :
bool atEnd(RDKit::SDMolSupplier {lvalue})
|
next( (SDMolSupplier)arg1) -> Mol :
Returns the next molecule in the file. Raises _StopIteration_ on EOF.
C++ signature :
RDKit::ROMol* next(RDKit::SDMolSupplier*)
|
reset( (SDMolSupplier)arg1) -> None :
Resets our position in the file to the beginning.
C++ signature :
void reset(RDKit::SDMolSupplier {lvalue})
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 | http://epydoc.sourceforge.net |