Thanks for the quick response, Greg. I was able to use the method described in your blog post <https://greglandrum.github.io/rdkit-blog/tutorial/substructure/2021/12/20/substructlibrary-search-order.html> to pickle the database.
Pat On Sun, Mar 13, 2022 at 1:26 AM Greg Landrum <greg.land...@gmail.com> wrote: > Hi Pat, > > I don't think you're doing anything wrong. This looks like a bug in the > RDKit. > It seems to be connected to the PatternHolder... I will look into it. > > -greg > > > On Sat, Mar 12, 2022 at 10:26 PM Patrick Walters <wpwalt...@gmail.com> > wrote: > >> Hi All, >> >> I'd appreciate any insight on what I'm doing wrong. I'm trying to save >> an rdSubstructLibrary. with library.toStream(). When library is empty I >> can save the library with library.toStream(), however when I've added >> molecule to the library, I get this error message. >> >> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 121: >> invalid continuation byte >> >> Example code below. Any suggestions would be appreciated. >> >> Thanks, >> >> Pat >> >> #!/usr/bin/env python >> >> import sys >> from rdkit import Chem >> from rdkit.Chem import rdSubstructLibrary >> >> smiles_list = ["C","CC","CCC","CCCC","CCCCC"] >> mol_list = [Chem.MolFromSmiles(x) for x in smiles_list] >> library = >> rdSubstructLibrary.SubstructLibrary(rdSubstructLibrary.CachedSmilesMolHolder(), >> >> rdSubstructLibrary.PatternHolder()) >> # Error when molecules are added >> # If the two lines below are commented, everything works >> for mol in mol_list: >> library.AddMol(mol) >> # ----------------------------- >> with open("out.sslib","w") as f: >> library.ToStream(f) >> _______________________________________________ >> Rdkit-discuss mailing list >> 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