rdkit.Chem.rdmolfiles.SDWriter

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

# Class SDWriter

     object --+
              |
    ??.instance --+
                  |
                 SDWriter

    A class for writing molecules to SD files.

    Usage examples:

      1) writing to a named file:
         >>> writer = SDWriter('out.sdf')
         >>> for mol in list_of_mols:
         ...    writer.write(mol)

      2) writing to a file-like object:
         >>> import gzip
         >>> outf=gzip.open('out.sdf.gz','w+')
         >>> writer = SDWriter(outf)
         >>> for mol in list_of_mols:
          ...   writer.write(mol)
         >>> writer.close()
         >>> outf.close()

    By default all non-private molecular properties are written to the SD file.
    This can be changed using the SetProps method:
         >>> writer = SDWriter('out.sdf')
         >>> writer.SetProps(['prop1','prop2'])

Instance Methods | [hide private]
GetForceV3000(...) GetForceV3000( (SDWriter)arg1) -> bool : Returns whether or not V3000 mol file writing is being forced. |
GetKekulize(...) GetKekulize( (SDWriter)arg1) -> bool : Returns whether or not molecules are kekulized on writing. |
NumMols(...) NumMols( (SDWriter)arg1) -> int : Returns the number of molecules written so far. |
SetForceV3000(...) SetForceV3000( (SDWriter)arg1, (bool)arg2) -> None : Sets whether or not V3000 mol file writing is being forced. |
SetKekulize(...) SetKekulize( (SDWriter)arg1, (bool)arg2) -> None : Sets whether or not molecules are kekulized on writing. |
SetProps(...) SetProps( (SDWriter)arg1, (AtomPairsParameters)arg2) -> None : Sets the properties to be written to the output file |
__init__(...) __init__( (AtomPairsParameters)arg1, (AtomPairsParameters)arg2) -> object : |
__reduce__(...) helper for pickle |
close(...) close( (SDWriter)arg1) -> None : Flushes the output file and closes it. |
flush(...) flush( (SDWriter)arg1) -> None : Flushes the output file (forces the disk file to be updated). |
write(...) write( (SDWriter)self, (Mol)mol [, (int)confId=-1]) -> None : Writes a molecule to the output file. |
Inherited from `unreachable.instance`: `__new__` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods | [hide private]
GetText(...) GetText( (Mol)mol [, (int)confId=-1 [, (bool)kekulize=True [, (bool)force_v3000=False [, (int)molid=-1]]]]) -> str : returns the SD text for a molecule |

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

Method Details | [hide private]

### GetForceV3000(...) |
    GetForceV3000( (SDWriter)arg1) -> bool :
        Returns whether or not V3000 mol file writing is being forced.

        C++ signature :
            bool GetForceV3000(RDKit::SDWriter {lvalue})

### GetKekulize(...) |
    GetKekulize( (SDWriter)arg1) -> bool :
        Returns whether or not molecules are kekulized on writing.

        C++ signature :
            bool GetKekulize(RDKit::SDWriter {lvalue})

### GetText(...) Static Method |
    GetText( (Mol)mol [, (int)confId=-1 [, (bool)kekulize=True [, (bool)force_v3000=False [, (int)molid=-1]]]]) -> str :
        returns the SD text for a molecule

        C++ signature :
            std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetText(RDKit::ROMol [,int=-1 [,bool=True [,bool=False [,int=-1]]]])

### NumMols(...) |
    NumMols( (SDWriter)arg1) -> int :
        Returns the number of molecules written so far.

        C++ signature :
            unsigned int NumMols(RDKit::SDWriter {lvalue})

### SetForceV3000(...) |
    SetForceV3000( (SDWriter)arg1, (bool)arg2) -> None :
        Sets whether or not V3000 mol file writing is being forced.

        C++ signature :
            void SetForceV3000(RDKit::SDWriter {lvalue},bool)

### SetKekulize(...) |
    SetKekulize( (SDWriter)arg1, (bool)arg2) -> None :
        Sets whether or not molecules are kekulized on writing.

        C++ signature :
            void SetKekulize(RDKit::SDWriter {lvalue},bool)

### SetProps(...) |
    SetProps( (SDWriter)arg1, (AtomPairsParameters)arg2) -> None :
        Sets the properties to be written to the output file

          ARGUMENTS:

            - props: a list or tuple of property names

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

### __init__(...) (Constructor) |
    __init__( (AtomPairsParameters)arg1, (AtomPairsParameters)arg2) -> object :

        C++ signature :
            void* __init__(boost::python::api::object,boost::python::api::object {lvalue})

    __init__( (object)arg1, (str)fileName) -> None :
        Constructor.

           If a string argument is provided, it will be treated as the name of the output file.
           If a file-like object is provided, output will be sent there.

        C++ signature :
            void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
Overrides: object.__init__

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

### close(...) |
    close( (SDWriter)arg1) -> None :
        Flushes the output file and closes it. The Writer cannot be used after this.

        C++ signature :
            void close(RDKit::SDWriter {lvalue})

### flush(...) |
    flush( (SDWriter)arg1) -> None :
        Flushes the output file (forces the disk file to be updated).

        C++ signature :
            void flush(RDKit::SDWriter {lvalue})

### write(...) |
    write( (SDWriter)self, (Mol)mol [, (int)confId=-1]) -> None :
        Writes a molecule to the output file.

          ARGUMENTS:

            - mol: the Mol to be written
            - confId: (optional) ID of the conformation to write

        C++ signature :
            void write(RDKit::SDWriter {lvalue},RDKit::ROMol {lvalue} [,int=-1])