Hi Luke, Finally I was able to try this one. Thank you!
All the best, Joanna ________________________________ From: Luke Zulauf <l...@zymergen.com> Sent: Wednesday, July 15, 2020 1:02 AM To: ITS RDC <itsrdc...@outlook.com> Cc: rdkit-discuss@lists.sourceforge.net <rdkit-discuss@lists.sourceforge.net> Subject: Re: [Rdkit-discuss] Trouble with Chem.MolFromSmiles Hi Joanna, There's no need to call MolFromSmiles if you're using a MolSupplier (which generates Mol objects already) - you just need to iterate over the Mol objects it generates: from rdkit import Chem from rdkit.Chem import rdmolfiles # Create the mol supplier, reading from the input file supplier = Chem.SmilesMolSupplier('directory/filename.smi', delimiter='\t', titleLine=False) # Iterate over the molecules. We can either convert the supplier to a list of molecules: molecules = list(supplier) # Or simply iterate over the supplier directly: for molecule in supplier: # Add explicit Hs # Convert to sdf pass I hope that helps! Luke Zulauf Staff Software Engineer, Cheminformatics ZYMERGEN | WE MAKE TOMORROW Zymergen.com<http://www.zymergen.com/> | Twitter<https://twitter.com/Zymergen> | LinkedIn<https://www.linkedin.com/company/zymergen/> | Facebook<https://facebook.com/zymergen> On Tue, Jul 14, 2020 at 8:59 AM ITS RDC <itsrdc...@outlook.com<mailto:itsrdc...@outlook.com>> wrote: Hi all, I have a SMILES list containing 251 SMILES strings (collected from a csv file) which I needed to convert to mol files because Open Babel is not doing its job in adding explicit Hs in batches before being converted to .sdf so I can process the molecules in rdkit and PyRx. So I am trying to use RDKit as an alternative to generate what I need. I used the following: from rdkit import Chem from rdkit.Chem import rdmolfiles suppl_smiles = [] temp = Chem.SmilesMolSupplier('directory/filename.smi',delimiter='\t',titleline=False) y = len(temp) for x in range (y): suppl_smiles.append(temp) temp2 = suppl_smiles[x] temp3 = Chem.MolFromSmiles(temp2) The one in highlight always returns the following: TypeError: No registered converter was able to produce a C++ rvalue of type class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > from this Python object of type SmilesMolSupplier I have been looking in GitHub, Source Forge, and other fora regarding batch conversion of smiles to mol files (I only encountered sdf containing multiple molecules to smiles which I already figured out) but I have not seen using MolFromSmiles using calling the tuple index as an object. I'd appreciate your help. Thank you. Joanna _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss