Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Jean-Marc Nuzillard
Each molecule has the _Name I gave it. Thank you for suggesting to interleave molecule indexes (or names) with warning messages redirected to unbuffered stderr. It works. I will use the trick together with Lukas (Thanks!) idea of redirecting stderr for in-script processing. All the best,

Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Dimitri Maziuk via Rdkit-discuss
On 1/21/19 1:42 PM, Jean-Marc Nuzillard wrote: >             sys.stderr.write("Bad: %s\n" % (mol.GetProp("_Name"),)) > I know which bond has a problem but I still do not know in which molecule. Are you sure they all have _Name's? I'd just print the count outside of the try/catch block and

Re: [Rdkit-discuss] DeleteSubstructs using an MCS object

2019-01-21 Thread Paolo Tosco
Hi Jenke, The reason why the resulting molecule contains no atoms is that the 3,5-dichlorophenyl substituent matches twice the 3-chlorophenyl substructure. If you look at the deleteSubstructs() code in ChemTransforms.cpp you may see that the atoms deleted from the main structures are the

Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Jean-Marc Nuzillard
Adapting from https://github.com/rdkit/rdkit/issues/642 I wrote:     reader = Chem.SDMolSupplier(file_sdf, sanitize = False)     for mol in reader:         try:             Chem.SanitizeMol(mol)         except:             sys.stderr.write("Bad: %s\n" % (mol.GetProp("_Name"),))            

[Rdkit-discuss] DeleteSubstructs using an MCS object

2019-01-21 Thread SCHEEN Jenke
Hi all, I'm trying to remove the MCS between two molecules (attached, 02.pdb and 12.pdb) using rdFMCS.FindMCS and AllChem.DeleteSubstructs using the following code: # from rdkit import Chem from rdkit.Chem import AllChem, rdmolfiles, rdFMCS

Re: [Rdkit-discuss] Dividing inputstream over threads

2019-01-21 Thread Dmitri Maziuk via Rdkit-discuss
On Mon, 21 Jan 2019 09:43:48 +0100 Markus Sitzmann wrote: > There is no need for objects with SQLAlchemy, SQLAlchemy's Core and > its expression language is pretty excellent without objects ... I spent weeks last year rewriting code that I myself wrote back when I believed that... When I wrote

Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Lukas Pravda
Hi Jean-Marc, Just a thought, but SDMolSupplier has a lazy eval, if I am not mistaken. Technically you should get all the rdkit warnings and errors at the time of processing that bit of the sdf file. You can always read the stderror output, parse it and throw exception every time a 'funny'

Re: [Rdkit-discuss] Dividing inputstream over threads

2019-01-21 Thread Peter St. John
Another option is dask (https://docs.dask.org/en/latest/). I've used `map_partitions` from dask to bulk convert a column of smiles strings into various computed properties. You could then output to a CSV or other database file. -- Peter On Mon, Jan 21, 2019 at 1:45 AM Markus Sitzmann wrote: >

Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Jean-Marc Nuzillard
My problem is more to know which molecules cause problems than avoiding the printing of warning messages in the console window. I am looking for an option that would turn warnings into errors, if any. Jean-Marc Le 21/01/2019 à 13:44, Stephen O'hagan a écrit : I've had similar problems; none

Re: [Rdkit-discuss] Warning as error

2019-01-21 Thread Stephen O'hagan
I've had similar problems; none of the claimed methods to switch off RDKit logging of warnings has worked for me. I ended up just re-directing stderr when running the script like this: python myfile.py 2> myErrorLog.txt Dr. Steve O'Hagan, -Original Message-

[Rdkit-discuss] Warning as error

2019-01-21 Thread Jean-Marc Nuzillard
Dear all, The minimalist python code:     reader = Chem.SDMolSupplier('my_file.sdf')     for mol in reader:         pass gives me warning messages when run on a particular SD file. How can I simply run a specific action for the molecules that cause problem, possibly using  try/catch statements?

Re: [Rdkit-discuss] Dividing inputstream over threads

2019-01-21 Thread Markus Sitzmann
> SQLalchemy creates a fairly specific ecosystem that you have to buy > into for it to make sense. When you don't have objects, only a table > of properties, OR mapper is just bloat. There is no need for objects with SQLAlchemy, SQLAlchemy's Core and its expression language is pretty excellent