Re: [Rdkit-discuss] conda build of Release_2016_03_2 failed on Ubuntu 16.04.

2016-06-28 Thread Markus Sitzmann
Hi,

unfortunately I have another problem - rdkit-postgres isn't building for me
since the change to Release_2016_03_2. Is that a known problem?

Below is the end of the build log. I only let build the py35-part
(+ncurses) of the Dockerscript.


Thanks & Best,
Markus

BUILD START: rdkit-postgresql-__conda_version__-py35_1
Fetching package metadata .
Solving package specifications: ..
+ source activate /home/rdkit/miniconda/envs/_build
++ [[ -n 4.1.2(1)-release ]]
++ _SCRIPT_LOCATION=/home/rdkit/miniconda/envs/_build/bin/activate
++ SHELL=bash
+++ dirname /home/rdkit/miniconda/envs/_build/bin/activate
++ _CONDA_DIR=/home/rdkit/miniconda/envs/_build/bin
++ '[' 1 -gt 1 ']'
++ case "$(uname -s)" in
+++ uname -s
++ EXT=
++ [[ -n 4.1.2(1)-release ]]
+++ basename /home/rdkit/miniconda/conda-bld/work/conda_build.sh
++ [[ conda_build.sh == \a\c\t\i\v\a\t\e ]]
++ '[' 1 -eq 0 ']'
++ args=/home/rdkit/miniconda/envs/_build
++ /home/rdkit/miniconda/envs/_build/bin/conda ..checkenv bash
/home/rdkit/miniconda/envs/_build
++ ((  0 != 0  ))
++ source /home/rdkit/miniconda/envs/_build/bin/deactivate
+++ [[ -n 4.1.2(1)-release ]]
+++ _SCRIPT_LOCATION=/home/rdkit/miniconda/envs/_build/bin/deactivate
+++ SHELL=bash
 dirname /home/rdkit/miniconda/envs/_build/bin/deactivate
+++ _CONDA_DIR=/home/rdkit/miniconda/envs/_build/bin
+++ case "$(uname -s)" in
 uname -s
+++ EXT=
+++ [[ 1 > 0 ]]
+++ key=/home/rdkit/miniconda/envs/_build
+++ case $key in
+++ shift
+++ [[ 0 > 0 ]]
+++ [[ -n 4.1.2(1)-release ]]
 basename /home/rdkit/miniconda/conda-bld/work/conda_build.sh
+++ [[ conda_build.sh == \d\e\a\c\t\i\v\a\t\e ]]
+++ [[ -z '' ]]
+++ [[ -n 4.1.2(1)-release ]]
 basename /home/rdkit/miniconda/conda-bld/work/conda_build.sh
+++ [[ conda_build.sh == \d\e\a\c\t\i\v\a\t\e ]]
+++ return 0
+++ /home/rdkit/miniconda/envs/_build/bin/conda ..activate bash
/home/rdkit/miniconda/envs/_build
prepending /home/rdkit/miniconda/envs/_build/bin to PATH
++ _NEW_PART=/home/rdkit/miniconda/envs/_build/bin
++ ((  0 == 0  ))
++ export
CONDA_PATH_BACKUP=/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++
CONDA_PATH_BACKUP=/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export CONDA_PS1_BACKUP=
++ CONDA_PS1_BACKUP=
++ export
PATH=/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++
PATH=/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/envs/_build/bin:/home/rdkit/miniconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ [[ '' == */* ]]
++ export CONDA_DEFAULT_ENV=/home/rdkit/miniconda/envs/_build
++ CONDA_DEFAULT_ENV=/home/rdkit/miniconda/envs/_build
++ firstpath=/home/rdkit/miniconda/envs/_build/bin
+++ echo /home/rdkit/miniconda/envs/_build/bin
+++ sed 's|/bin$||'
++ export CONDA_PREFIX=/home/rdkit/miniconda/envs/_build
+++ /home/rdkit/miniconda/envs/_build/bin/conda ..changeps1
++ '[' 1 = 1 ']'
+++ grep -q CONDA_DEFAULT_ENV
++ export 'PS1=(/home/rdkit/miniconda/envs/_build) '
++ PS1='(/home/rdkit/miniconda/envs/_build) '
++ _CONDA_D=/home/rdkit/miniconda/envs/_build/etc/conda/activate.d
++ [[ -d /home/rdkit/miniconda/envs/_build/etc/conda/activate.d ]]
++ unset CONDA_PATH
++ [[ -n 4.1.2(1)-release ]]
++ hash -r
+ /home/rdkit/miniconda/envs/_build/bin/python
/home/rdkit/conda-rdkit/rdkit-postgresql/pkg_version.py
+ cd /home/rdkit/miniconda/conda-bld/work/Code/PgSQL/rdkit
+ make
gcc -I/home/rdkit/miniconda/envs/_build/include
-I/home/rdkit/miniconda/envs/_build/include/rdkit -DRDKITVER='"007300"'
-DBUILD_AVALON_SUPPORT -DBUILD_INCHI_SUPPORT -mpopcnt -I. -I./
-I/home/rdkit/miniconda/envs/_build/include/postgresql/server
-I/home/rdkit/miniconda/envs/_build/include/postgresql/internal
-D_GNU_SOURCE -I/home/rdkit/miniconda/envs/_build/include/libxml2
 -I/home/rdkit/miniconda/envs/_build/include -fPIC -c -o rdkit_io.o
rdkit_io.c
gcc -I/home/rdkit/miniconda/envs/_build/include
-I/home/rdkit/miniconda/envs/_build/include/rdkit -DRDKITVER='"007300"'
-DBUILD_AVALON_SUPPORT -DBUILD_INCHI_SUPPORT -mpopcnt -I. -I./
-I/home/rdkit/miniconda/envs/_build/include/postgresql/server
-I/home/rdkit/miniconda/envs/_build/include/postgresql/internal
-D_GNU_SOURCE -I/home/rdkit/miniconda/envs/_build/include/libxml2
 -I/home/rdkit/miniconda/envs/_build/include -fPIC -c -o mol_op.o mol_op.c
mol_op.c: In function 'fmcs_mol2s_transition':
mol_op.c:334: warning: initialization makes pointer from integer without a
cast
mol_op.c:363: warning: initialization makes pointer from integer without a
cast
mol_op.c: In function 'fmcs_mol_transition':
mol_op.c:432: warning: initialization makes pointer from integer without a
cast
mol_op.c:439: warning: cast from pointer to integer of different size
mol_op.c:443: warning: initialization makes pointer from integer without a

Re: [Rdkit-discuss] SMILES string from SureChEMBL iPython Notebook Tutorial

2016-06-28 Thread DmitriR
Hi Brian, 

First off, now I can capture the warnings, so for practical purposes my 
question has been addressed, thank you for helping me get to this point. 

Cool trick with StringIO. I can even just do:

Python 3.5.1 :: Anaconda 2.4.0 (x86_64), OSX 10.11.5, jupyter 4.1.0, Firefox

```
import io
err = sys.stderr
sys.stderr = io.StringIO()

# capture errors/warnings
Chem.MolFromSmiles('C1CC')

msgs = sys.stderr.getvalue()
sys.stderr = err
print('Captured', msgs)

# now errors show in the notebook again
Chem.MolFromSmiles('C1CC')
```

==

However, if you feel like digging a bit deeper, I'm a little confused too now :)

What is the scope of WrapLogs() effects? (notebook-wide, or cell?) Or, by 
chance, does it set anything really persistent?

In my prior notebook session, prior to trying WrapLogs() I could already see 
the warnings printed on red background (like in your screenshot, except that 
you have an ERROR msg, not WARNINGs as in my example). 

A call to WrapLogs() made warnings apparently disappear from the notebook. 

Upon reinitializing the session I could see the warnings on red background as 
before, wrote the code snippet in my prior email, and *without calling 
WrapLogs()* I could capture the warnings with it. 

So I assumed that RDKit messages went to the notebook's stderr by default, and 
WrapLogs() did something else. 

After getting your last email, I made a minimal test case (new notebook with 
just the RDKit call that generates warnings `dff['InChI'] = 
dff['ROMol'].map(Chem.MolToInchi)`, wrapped inside the stderr capture code 
snippet), killed all python instances, restarted the browser, loaded data from 
pickled dataframe. 

Now, *without ever having called WrapLogs()* I still get all RDKit warnings go 
to stderr, and I can still  capture them using the snippet. Calls to WrapLogs() 
now appear to have no effect whatsoever. 

If this indicates to you any potential issue, we can look more into it. 
Otherwise I'm good. 

==

The other strange behavior that I described below (the number of warnings 
alternating between successive calls to the same code using Chem.MolToInchi) 
remains though. Maybe it's the underlying InChi code, I did not investigate. 

Thanks again.
Dmitri



> On Jun 28, 2016, at 2:14 PM, Brian Kelley  wrote:
> 
> Dmitri,
>   I admit to being a bit confused.  What WrapLogs() does is simply redirect 
> the C++ errors into python's stderr. See attache png.   I think you may have 
> noticed that, as you are capturing with sys.stderr.
> 
> These errors are output (at least for me) in the IPython notebook.  I'm not 
> sure what is being hidden here.  Perhaps the notebook has changed somehow?  
> Here is my version:
> 
> Python 2.7.11 |Anaconda 2.1.0 (x86_64)| (default, Dec  6 2015, 18:57:58) 
> Type "copyright", "credits" or "license" for more information.
> 
> IPython 4.0.0 -- An enhanced Interactive Python.
> 
> 
> btw - you can use StringIO as opposed to a file
> 
> from StringIO import StringIO
> 
> err = sys.stderr
> io = sys.stderr = StringIO()
> 
> sys.stderr = err
> print io.getvalue()
> 
> 
> 
> On Tue, Jun 28, 2016 at 1:24 PM, DmitriR  wrote:
> Brian - Thank you!
> 
> (on OSX 10.11.5, jupyter 4.1.0)
> 
> rdkit.Chem.WrapLogs() does hide the messages.
> I could not figure out how to access them though once they are hidden.
> 
> To capture warnings, this mechanism seems to work - but it is ugly.
> 
> ```
> import os
> ## switch the streams
> stderr_fn = 'stderr.log'
> orig_stderr = sys.stderr
> sys.stderr = open(stderr_fn, 'w')
> 
> ## RDKit code producing warnings goes here
> 
> ## switch back stderr, process the warnings
> sys.stderr.flush()
> sys.stderr = orig_stderr
> with open(stderr_fn, 'r') as f: err_data = f.read()
> os.remove(stderr_fn)
> print(len(err_data))
> ```
> 
> Assuming it is all even necessary, this could be made much nicer by using a 
> context manager/decorator to handle stderr capture and return the warnings 
> text in an extra argument, along the lines of
> http://stackoverflow.com/questions/5136611/capture-stdout-from-a-script-in-python
> 
> ==
> 
> But also I noticed something weird:
> 
> If I re-run the notebook cell with code that produces warnings, I get *no 
> warnings* every third or sometimes second invocation.
> 
> And when I run this with data that produce a lot of warnings (hundreds), I 
> get different number of warnings between runs, at least with this call:
> 
> ```
> #dff is a pandas dataframe
> dff['InChI'] = dff['ROMol'].map(Chem.MolToInchi)
> ```
> 
> it cycles higher-number -> lower-number -> higher-number ... Not sure what to 
> make of it. Something screwed up with my system?
> 
> Dmitri
> 
> 
> 
> > On Jun 28, 2016, at 8:24 AM, Brian Kelley  wrote:
> >
> > Dmitri,  if you import rdkit.Chem.Draw.IPythonConsole the c++ errors and 
> > warnings should be seen in IPython.  This doesn't appear to work on Windows 
> > yet, sadly.
> >
> > This is enabled by the 

Re: [Rdkit-discuss] SMILES string from SureChEMBL iPython Notebook Tutorial

2016-06-28 Thread DmitriR
Hi Greg - 

Thank you very much for the clear and detailed explanation!

(and, now that I have a chance to say this, thank you for putting the project 
together; being able to work with chemistry in the python notebook is great, 
and having hooks into pandas is really cool)

In this case I was basically just going through the example code and ran into 
some behaviors that I did not understand (and you kindly explained). So it's 
all clear now. Uppercase aromatic atoms in MCS output does appear to be a bug; 
Hs on aromatic nitrogens I'll need to fix manually or with a transform. 

==

Separately, on another thing that came up in my working through that data:

I'd like to add my 2cents-equivalent of vote toward a bit fuller control of 
warnings produced by the C++ backend. In that example's data I was getting a 
lot of (fully valid, I think) warnings about stereochemistry, but I could not 
do anything to catch or hide them - and in an ipython notebook, it can get less 
than tidy. I did see this mentioned in other threads, so I understand that 
logging is a known issue somewhere on the stack. For now I just clean up 
manually.

Thanks again!

Kind regards,
Dmitri



> On Jun 28, 2016, at 1:39 AM, Greg Landrum  wrote:
> 
> Hi Dmitri,
> 
> The results that come back from the MCS in that examples really describe 
> queries, not necessarily stable molecules or things that can be accurately 
> translated into SMILES.
> 
> I'll describe below what's going on to cause the error, but the more 
> important question is: what are you trying to do?
> 
> In this case there are two problems. One has to do with the aromatic bonds in 
> the SMILES coming from C atoms that are written as capital letters. Here's a 
> simplified version of your example:
> 
> In [11]: Chem.MolFromSmiles('O=C1:[NH]:C:N:N2:C:*:C:C:1:2')
> [06:43:37] Explicit valence for atom # 1 C, 5, is greater than permitted
> 
> If I rewrite the SMILES to have the atoms with aromatic bonds written with 
> lower case letters everything is fine:
> 
> In [12]: Chem.MolFromSmiles('O=c1:[nH]:c:n:n2:c:*:c:c:1:2')
> Out[12]: 
> 
> This shouldn't make a difference in SMILES, so I'm inclined to think that 
> it's a bug.
> 
> The second problem was the missing hydrogen specification on the aromatic 
> nitrogen that has an H (I fixed this in the SMILES above). Since the RDKit 
> does not attempt to guess at chemistry, the general rule is that aromatic 
> heteroatoms should have Hs specified if they have any. There have been a 
> number of mailing list threads on this topic.
> 
> Best,
> -greg
> 
> 
> 
> 
> On Mon, Jun 27, 2016 at 8:26 PM, DmitriR  wrote:
> Dear RDKitters, 
> 
> I would appreciate any comments on the following:
> 
> I am looking at the 'SureChEMBL iPython Notebook Tutorial' 
> http://nbviewer.jupyter.org/github/rdkit/UGM_2014/blob/master/Notebooks/Vardenafil.ipynb
> 
> following along with rdkit '2016.03.1' on OSX 
> 
> In Cell 142, there is this SMILES: 
> 
> MCS SMILES: O=C1:N:C(C2:C:C:C:C:C:2):N:N2:C:[*]:C:C:1:2
> This is a representation of a generalized structure, not any particular 
> molecule.
> 
> It was generated with Chem.MolToSmiles(mcsM,isomericSmiles=True) 
> 
> But when I try 
> Chem.MolFromSmiles('O=C1:N:C(C2:C:C:C:C:C:2):N:N2:C:[*]:C:C:1:2')
> 
> I get "RDKit ERROR: [14:11:32] Explicit valence for atom # 1 C, 5, is greater 
> than permitted"
> 
> So there is no "round-trip" possible here. 
> 
> Which behavior is "correct", given the aromaticity and structure as specified?
> Should this be rendering/creating molecule, or failing?
> 
> Thanks!
> 
> (MarvinSketch does display the SMILES without complaints.;
> image is attached)
> 
> Dmitri
> 
> 
> 
> 
> --
> Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San
> Francisco, CA to explore cutting-edge tech and listen to tech luminaries
> present their vision of the future. This family event has something for
> everyone, including kids. Get more information and register today.
> http://sdm.link/attshape
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> 
> 

--
Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] conda build of Release_2016_03_2 failed on Ubuntu 16.04.

2016-06-28 Thread Axel Pahl

Hi Riccardo,

thanks, I found the problem. As suspected it was related to conda and 
had nothing to do with RDKit 
(https://github.com/conda/conda/issues/2212#issuecomment-228277548).


Many thanks for your help.

Kind regards,
Axel

On 27.06.2016 22:44, Riccardo Vianello wrote:

Hi Axel,

thanks a lot for your help, using the development branch and the
Release_2016_03_2 git tag in rdkit/meta.yaml worked.
I now get a strange error in anaconda when actually trying to
install the package (Error: Invalid version spec: ==), but that
seems to be unrelated to RDKit (there is already an issue on
anaconda github).
My understanding was that the preferred way to install the RDKit
was via anaconda (RDKit was the reason I started using anaconda),
is that still correct?


I'm not exactly sure about the commands you used, but I'm afraid I 
wasn't able to reproduce the described problem using conda 4.1.4 and 
conda-build 1.21.2 on my fedora box. In case the error persisted, 
could you please provide some additional context?


Best regards,
Riccardo



--
Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss