rdkit.Chem.rdmolfiles.SmilesMolSupplier

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

# Class SmilesMolSupplier

     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.

Instance Methods | [hide private]
GetItemText(...) GetItemText( (SmilesMolSupplier)self, (int)index) -> str : returns the text for an item |
SetData(...) 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 |
__getitem__(...) __getitem__( (SmilesMolSupplier)arg1, (int)arg2) -> Mol : |
__init__(...) __init__( (object)arg1, (str)data [, (str)delimiter=' ' [, (int)smilesColumn=0 [, (int)nameColumn=1 [, (bool)titleLine=True [, (bool)sanitize=True]]]]]) -> None : Constructor |
__iter__(...) __iter__( (SmilesMolSupplier)arg1) -> SmilesMolSupplier : |
__len__(...) __len__( (SmilesMolSupplier)arg1) -> int : |
__reduce__(...) helper for pickle |
next(...) next( (SmilesMolSupplier)arg1) -> Mol : Returns the next molecule in the file. |
reset(...) reset( (SmilesMolSupplier)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__ = `176`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### GetItemText(...) |
    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(...) |
    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__(...) (Indexing operator) |
    __getitem__( (SmilesMolSupplier)arg1, (int)arg2) -> Mol :

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

### __init__(...) (Constructor) |
    __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*)
Overrides: object.__init__

### __iter__(...) |
    __iter__( (SmilesMolSupplier)arg1) -> SmilesMolSupplier :

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

### __len__(...) (Length operator) |
    __len__( (SmilesMolSupplier)arg1) -> int :

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

### __reduce__(...) |
    helper for pickle
Overrides: object.__reduce__ (inherited documentation)

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

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

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

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