30bce6638a5840e6a67f0d996c6c51b809cd5c0c,chemml/chem/molecule.py,Molecule,to_smiles,#Molecule#,421

Before Change



        
        // rdkit molecule must exist
        self._check_rdkit_molecule()

        // kekulize flag
        if "kekuleSmiles" in kwargs and kwargs["kekuleSmiles"]:
            Chem.Kekulize(self.rdkit_molecule)

        // store arguments for future reference
        self._smiles = Chem.MolToSmiles(self.rdkit_molecule, **kwargs)

        // arguments
        self._default_smiles_args = {"isomericSmiles":True, "kekuleSmiles":False, "rootedAtAtom":-1, "canonical":True, "allBondsExplicit":False,
                "allHsExplicit":False} //"doRandom":False
        self._smiles_args = update_default_kwargs(self._default_smiles_args, kwargs,
                                                 self._to_smiles_core_names[0], self._to_smiles_core_docs[0])

    def to_smarts(self, **kwargs):
        
        This function creates and stores the SMARTS string for a pre-built molecule.

After Change


            m.creator = creator
            yield m

    def to_smiles(self, **kwargs):
        
        This function creates and stores the SMILES string for a pre-built molecule.

        Parameters
        ----------
        kwargs:
            The arguments for the rdkit.Chem.MolToSmiles function.
            The documentation is available at: http://rdkit.org/docs/source/rdkit.Chem.rdmolfiles.html//rdkit.Chem.rdmolfiles.MolToSmiles

        Notes
        -----
            - The rdkit or pybel molecule object must be created in advance.
            - If only pybel molecule is available, we create an rdkit molecule using its SMILES representation, and then recreate the SMILES string using rdkit arguments.
            - The molecule will be modified in place.
            - For rdkit molecule the SMILES string is canocical by default, unless when one requests kekuleSmiles.

        
        // molecule must exist
        engine = self._check_original_molecule()
        if engine == "pybel":
            smiles = self.pybel_molecule.write("smi").strip().split("\t")[0]
            self._load_rdkit(smiles, "smiles", from_load=False)
            self.to_smiles()
        else:
            self._to_smiles_rdkit(**kwargs)

    def _to_smiles_rdkit(self, **kwargs):
        
        This internal function creates and stores the SMILES string for rdkit molecule.
        
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 21

Instances


Project Name: hachmannlab/chemml
Commit Name: 30bce6638a5840e6a67f0d996c6c51b809cd5c0c
Time: 2019-03-05
Author: mojtabah@buffalo.edu
File Name: chemml/chem/molecule.py
Class Name: Molecule
Method Name: to_smiles


Project Name: hachmannlab/chemml
Commit Name: 30bce6638a5840e6a67f0d996c6c51b809cd5c0c
Time: 2019-03-05
Author: mojtabah@buffalo.edu
File Name: chemml/chem/molecule.py
Class Name: Molecule
Method Name: to_smiles


Project Name: hachmannlab/chemml
Commit Name: 30bce6638a5840e6a67f0d996c6c51b809cd5c0c
Time: 2019-03-05
Author: mojtabah@buffalo.edu
File Name: chemml/chem/molecule.py
Class Name: Molecule
Method Name: to_inchi


Project Name: hachmannlab/chemml
Commit Name: 30bce6638a5840e6a67f0d996c6c51b809cd5c0c
Time: 2019-03-05
Author: mojtabah@buffalo.edu
File Name: chemml/chem/molecule.py
Class Name: Molecule
Method Name: to_smarts