| Trees | Indices | Help |
|
|---|
|
|
object --+
|
??.instance --+
|
SmilesMolSupplier
A class which supplies molecules from a text file.
Usage examples:
1) Lazy evaluation: the molecules are not constructed until we ask for them:
>>> suppl = SmilesMolSupplier('in.smi')
>>> for mol in suppl:
... mol.GetNumAtoms()
2) Lazy evaluation 2:
>>> suppl = SmilesMolSupplier('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 = SmilesMolSupplier('in.smi')
>>> nMols = len(suppl)
>>> for i in range(nMols):
... suppl[i].GetNumAtoms()
If the input file has a title line and more than two columns (smiles and id), the
additional columns will be used to set properties on each molecule. The properties
are accessible using the mol.GetProp(propName) method.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
__instance_size__ = 176
|
|||
|
|||
GetItemText( (SmilesMolSupplier)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::SmilesMolSupplier {lvalue},unsigned int)
|
SetData( (SmilesMolSupplier)self, (str)data [, (str)delimiter=' ' [, (int)smilesColumn=0 [, (int)nameColumn=1 [, (bool)titleLine=True [, (bool)sanitize=True]]]]]) -> None :
Sets the text to be parsed
C++ signature :
void SetData(RDKit::SmilesMolSupplier {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=' ' [,int=0 [,int=1 [,bool=True [,bool=True]]]]])
|
__getitem__( (SmilesMolSupplier)arg1, (int)arg2) -> Mol :
C++ signature :
RDKit::ROMol* __getitem__(RDKit::SmilesMolSupplier*,int)
|
__init__( (object)arg1, (str)data [, (str)delimiter=' ' [, (int)smilesColumn=0 [, (int)nameColumn=1 [, (bool)titleLine=True [, (bool)sanitize=True]]]]]) -> None :
Constructor
ARGUMENTS:
- fileName: name of the file to be read
- delimiter: (optional) text delimiter (a string). Defauts to ' '.
- smilesColumn: (optional) index of the column containing the SMILES
data. Defaults to 0.
- nameColumn: (optional) index of the column containing molecule names.
Defaults to 1.
- titleLine: (optional) set this toggle if the file contains a title line.
Defaults to 1.
- sanitize: (optional) toggles sanitization of molecules as they are read.
Defaults to 1.
C++ signature :
void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=' ' [,int=0 [,int=1 [,bool=True [,bool=True]]]]])
__init__( (object)arg1) -> None :
C++ signature :
void __init__(_object*)
|
__iter__( (SmilesMolSupplier)arg1) -> SmilesMolSupplier :
C++ signature :
RDKit::SmilesMolSupplier* __iter__(RDKit::SmilesMolSupplier*)
|
__len__( (SmilesMolSupplier)arg1) -> int :
C++ signature :
unsigned int __len__(RDKit::SmilesMolSupplier {lvalue})
|
|
next( (SmilesMolSupplier)arg1) -> Mol :
Returns the next molecule in the file. Raises _StopIteration_ on EOF.
C++ signature :
RDKit::ROMol* next(RDKit::SmilesMolSupplier*)
|
reset( (SmilesMolSupplier)arg1) -> None :
Resets our position in the file to the beginning.
C++ signature :
void reset(RDKit::SmilesMolSupplier {lvalue})
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 | http://epydoc.sourceforge.net |