Re: [Rdkit-discuss] problem using RDKit c++ class to read sdf file

2015-07-13 Thread Greg Landrum
Hi Sergio,

You need to provide the filename when you construct the SDMolSupplier.
Here's some sample code from one of the RDKit tests that demonstrates how
to use the supplier:
https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/FileParsers/testMolSupplier.cpp#L42

(that file contains other examples of using the suppliers too)

-greg


On Tue, Jul 14, 2015 at 7:10 AM, Wong, Sergio E.  wrote:

>  Dear RDKit users;
>
> I am trying to read a sdf file using the following code:
>
> #include
> #include
> #include
> #include
> #include
> #include
>
> int main()
> {
> RDKit::SDMolSupplier supplier;
>
> supplier.init();
> supplier.SDMolSupplier("PubChem_info_dat.sdf");
>
> return 0;
>
> }
>
> When I try to compile it, I get the following error:
>
> test.c: In function ‘int main()’:
> test.c:19:10: error: invalid use of ‘RDKit::SDMolSupplier::SDMolSupplier’
>  supplier.SDMolSupplier("PubChem_info_dat.sdf");
>   ^
>
> Can anyone suggest anything?
>
> Thanks!
> -Sergio
>
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] problem using RDKit c++ class to read sdf file

2015-07-13 Thread Wong, Sergio E.
Dear RDKit users;

I am trying to read a sdf file using the following code:

#include
#include
#include
#include
#include
#include

int main()
{
RDKit::SDMolSupplier supplier;

supplier.init();
supplier.SDMolSupplier("PubChem_info_dat.sdf");

return 0;

}

When I try to compile it, I get the following error:

test.c: In function ‘int main()’:
test.c:19:10: error: invalid use of ‘RDKit::SDMolSupplier::SDMolSupplier’
 supplier.SDMolSupplier("PubChem_info_dat.sdf");
  ^

Can anyone suggest anything?

Thanks!
-Sergio


--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread Greg Landrum
Just a quick FYI that Paolo's PR has been accepted in github.

I'm still digging out from the email from last week, so  I'm slow.

-greg


On Tue, Jul 14, 2015 at 12:23 AM, Paolo Tosco  wrote:

>  Hi James,
>
> I just submitted a pull request about this; a patch is attached to this
> e-mail. To apply the patch, cd to $RDBASE and issue the following command:
>
> patch -p0 < patch20150713.txt
>
> Best,
> p.
>
>
> On 13/07/2015 15:16, James Davidson wrote:
>
>  Dear All,
>
>
>
> I have just built revision 5775 on Windows, and the pyGraphMolWrap test
> fails.  The relevant bit of the verbose output is below:
>
>
>
> 78: ERROR: testGithub498 (__main__.TestCase)
>
> 78: --
>
> 78: Traceback (most recent call last):
>
> 78:   File "C:/RDKit/Code/GraphMol/Wrap/rough_test.py", line 3033, in
> testGithub498
>
> 78: outf = gzip.open(tempfile.mktemp(),'wt+')
>
> 78:   File "C:\Anaconda\lib\gzip.py", line 34, in open
>
> 78: return GzipFile(filename, mode, compresslevel)
>
> 78:   File "C:\Anaconda\lib\gzip.py", line 94, in __init__
>
> 78: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
>
> 78: ValueError: Invalid mode ('wt+b')
>
>
>
>
>
> This seems to be due to a difference in python/gzip behaviour on Windows
> vs. eg Linux:
>
>
>
> *On Ubuntu (Anaconda python):*
>
>
>
> In [1]: import tempfile, gzip
>
> In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
>
> In [3]:
>
>
>
>
>
> *On Windows (again Anaconda python):*
>
>
>
> In [1]: import tempfile, gzip
>
> In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
>
> ---
>
> ValueErrorTraceback (most recent call last)
>
>  in ()
>
> > 1 outf = gzip.open(tempfile.mktemp(), 'wt+')
>
>
>
> C:\Anaconda\lib\gzip.pyc in open(filename, mode, compresslevel)
>
>  32
>
>  33 """
>
> ---> 34 return GzipFile(filename, mode, compresslevel)
>
>  35
>
>  36 class GzipFile(io.BufferedIOBase):
>
>
>
> C:\Anaconda\lib\gzip.pyc in __init__(self, filename, mode, compresslevel,
> fileobj, mtime)
>
>  92 mode += 'b'
>
>  93 if fileobj is None:
>
> ---> 94 fileobj = self.myfileobj = __builtin__.open(filename,
> mode or 'rb')
>
>  95 if filename is None:
>
>  96 # Issue #13781: os.fdopen() creates a fileobj with a
> bogus name
>
>
>
> ValueError: Invalid mode ('wt+b')
>
>
>
> In [3]:
>
>
>
>
>
>
>
> Is this an easy one to fix?
>
>
>
> Kind regards
>
>
>
> James
>
> __
> PLEASE READ: This email is confidential and may be privileged. It is
> intended for the named addressee(s) only and access to it by anyone else is
> unauthorised. If you are not an addressee, any disclosure or copying of the
> contents of this email or any action taken (or not taken) in reliance on it
> is unauthorised and may be unlawful. If you have received this email in
> error, please notify the sender or postmas...@vernalis.com. Email is not
> a secure method of communication and the Company cannot accept
> responsibility for the accuracy or completeness of this message or any
> attachment(s). Please check this email for virus infection for which the
> Company accepts no responsibility. If verification of this email is sought
> then please request a hard copy. Unless otherwise stated, any views or
> opinions presented are solely those of the author and do not represent
> those of the Company.
>
> The Vernalis Group of Companies
> 100 Berkshire Place
> Wharfedale Road
> Winnersh, Berkshire
> RG41 5RD, England
> Tel: +44 (0)118 938 
>
> To access trading company registration and address details, please go to
> the Vernalis website at www.vernalis.com and click on the "Company
> address and registration details" link at the bottom of the page..
> __
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud 
> Today.https://www.gigenetcloud.com/
>
>
>
> ___
> Rdkit-discuss mailing 
> listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
>
>
> --
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> __

Re: [Rdkit-discuss] AP / DP descriptors

2015-07-13 Thread Greg Landrum
Hi Michael,

On Sun, Jul 5, 2015 at 2:43 PM, Michael Reutlinger  wrote:

>
> I would like to use a machine learning method with the AP and DP
> descriptors as described by Robert Sheridan.
>
> AP descriptors are the 'atom pair' descriptors from Carhart et al. 1985
> and I think they are already available in RDKIT.
>

Indeed, they are.


> DP 'donor−acceptor pair', called 'BP' in Kearsley et al. 1996, is a
> reduced pharmacophore version of AP.
>
> I would like to know if you think there is a straightforward way to use
> the existing AP functionality (maybe using  atomInvariants) to reproduce
> the descriptor as described in Kearsley et al.?
>

Yes, if you have a way to assign integer invariants (atom types) to atoms
that correspond to the BP features described in Kearsley et al. then it
would be very straightforward to use those in the calculation. Note that
the RDKit atom pair code does require that all atoms have a type (i.e. you
can't have atoms that are ignored like some pharmacophore methods would
do), but looking at the paper it seems like this isn't a problem: any atom
that doesn't get assigned to one of the other classes just gets put into
class 7: "other".

The paper does not, unfortunately, include enough information to directly
implement the fingerprint: you will need to come up with definitions
(probably SMARTS-based?) for the the 6 atom classes. I've thought several
times about adding the fingerprint-types from the paper to the RDKit (and
then testing them out using Sereina's benchmarking platform), but this has
always ended up getting hung-up on the missing atom-type definitions.

-greg
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread Paolo Tosco

Hi James,

I just submitted a pull request about this; a patch is attached to this 
e-mail. To apply the patch, cd to $RDBASE and issue the following command:


patch -p0 < patch20150713.txt

Best,
p.

On 13/07/2015 15:16, James Davidson wrote:


Dear All,

I have just built revision 5775 on Windows, and the pyGraphMolWrap 
test fails.  The relevant bit of the verbose output is below:


78: ERROR: testGithub498 (__main__.TestCase)

78: --

78: Traceback (most recent call last):

78:   File "C:/RDKit/Code/GraphMol/Wrap/rough_test.py", line 3033, in 
testGithub498


78: outf = gzip.open(tempfile.mktemp(),'wt+')

78:   File "C:\Anaconda\lib\gzip.py", line 34, in open

78: return GzipFile(filename, mode, compresslevel)

78:   File "C:\Anaconda\lib\gzip.py", line 94, in __init__

78: fileobj = self.myfileobj = __builtin__.open(filename, mode or 
'rb')


78: ValueError: Invalid mode ('wt+b')

This seems to be due to a difference in python/gzip behaviour on 
Windows vs. eg Linux:


*On Ubuntu (Anaconda python):*

In [1]: import tempfile, gzip

In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')

In [3]:

*On Windows (again Anaconda python):*

In [1]: import tempfile, gzip

In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')

---

ValueError Traceback (most recent call last)

 in ()

> 1 outf = gzip.open(tempfile.mktemp(), 'wt+')

C:\Anaconda\lib\gzip.pyc in open(filename, mode, compresslevel)

 32

 33 """

---> 34 return GzipFile(filename, mode, compresslevel)

 35

 36 class GzipFile(io.BufferedIOBase):

C:\Anaconda\lib\gzip.pyc in __init__(self, filename, mode, 
compresslevel, fileobj, mtime)


 92 mode += 'b'

 93 if fileobj is None:

---> 94 fileobj = self.myfileobj = 
__builtin__.open(filename, mode or 'rb')


 95 if filename is None:

 96 # Issue #13781: os.fdopen() creates a fileobj with 
a bogus name


ValueError: Invalid mode ('wt+b')

In [3]:

Is this an easy one to fix?

Kind regards

James


__
PLEASE READ: This email is confidential and may be privileged. It is 
intended for the named addressee(s) only and access to it by anyone 
else is unauthorised. If you are not an addressee, any disclosure or 
copying of the contents of this email or any action taken (or not 
taken) in reliance on it is unauthorised and may be unlawful. If you 
have received this email in error, please notify the sender or 
postmas...@vernalis.com. Email is not a secure method of communication 
and the Company cannot accept responsibility for the accuracy or 
completeness of this message or any attachment(s). Please check this 
email for virus infection for which the Company accepts no 
responsibility. If verification of this email is sought then please 
request a hard copy. Unless otherwise stated, any views or opinions 
presented are solely those of the author and do not represent those of 
the Company.


The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go 
to the Vernalis website at www.vernalis.com and click on the "Company 
address and registration details" link at the bottom of the page..

__


--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/


___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


*** Code/GraphMol/Wrap/rough_test.new.pyMon Jul 13 23:19:32 2015
--- Code/GraphMol/Wrap/rough_test.orig.py   Mon Jul 13 23:18:35 2015
***
*** 3030,3040 
  
def testGithub498(self):
  import gzip,tempfile
! if (sys.version_info < (3, 0)):
!   mode = 'w+'
! else:
!   mode = 'wt+'
! outf = gzip.open(tempfile.mktemp(), mode)
  m = Chem.MolFromSmiles('C')
  w = Chem.SDWriter(outf)
  w.write(m)
--- 3030,3036 
  
def testGithub498(self):
  import gzip,tempfile
! outf = gzip.open(tempfile.mktemp(), 'wt+')
  m = Chem.MolFromSmiles('C')
  w = Chem.SDWriter(outf)
  w.write(m)
--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs

Re: [Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread Nicholas Firth
Looks like the problem opening the file with the extra parameters used ('t+') 
as the gzip module just sticks a 'b' on the end of the opening mode

if mode and 'b' not in mode:
mode += 'b'

The test should run if line 3033 is changed from
 outf = gzip.open(tempfile.mktemp(),'wt+')
to
 outf = gzip.open(tempfile.mktemp(),'wb+')

which I would put right but I still have zero idea how to use git :)

The more interesting question is why does this work on Unix/Mac but not on 
Windows, and why do you get this error when it's not in the gzip code?


Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey 
| SM2 5NG
T 020 8722 4033 | E nicholas.fi...@icr.ac.uk | 
W www.icr.ac.uk | Twitter 
@ICRnews
Facebook 
www.facebook.com/theinstituteofcancerresearch
Making the discoveries that defeat cancer

[cid:image001.gif@01CE053D.51D3C4E0]

On 13 Jul 2015, at 15:16, James Davidson 
mailto:j.david...@vernalis.com>> wrote:

gzip.pyc


The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only.  If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer and network.--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Rev. 5775 (Windows) - pyGraphMolWrap test fails

2015-07-13 Thread James Davidson
Dear All,

I have just built revision 5775 on Windows, and the pyGraphMolWrap test fails.  
The relevant bit of the verbose output is below:

78: ERROR: testGithub498 (__main__.TestCase)
78: --
78: Traceback (most recent call last):
78:   File "C:/RDKit/Code/GraphMol/Wrap/rough_test.py", line 3033, in 
testGithub498
78: outf = gzip.open(tempfile.mktemp(),'wt+')
78:   File "C:\Anaconda\lib\gzip.py", line 34, in open
78: return GzipFile(filename, mode, compresslevel)
78:   File "C:\Anaconda\lib\gzip.py", line 94, in __init__
78: fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
78: ValueError: Invalid mode ('wt+b')


This seems to be due to a difference in python/gzip behaviour on Windows vs. eg 
Linux:

On Ubuntu (Anaconda python):

In [1]: import tempfile, gzip
In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
In [3]:


On Windows (again Anaconda python):

In [1]: import tempfile, gzip
In [2]: outf = gzip.open(tempfile.mktemp(), 'wt+')
---
ValueErrorTraceback (most recent call last)
 in ()
> 1 outf = gzip.open(tempfile.mktemp(), 'wt+')

C:\Anaconda\lib\gzip.pyc in open(filename, mode, compresslevel)
 32
 33 """
---> 34 return GzipFile(filename, mode, compresslevel)
 35
 36 class GzipFile(io.BufferedIOBase):

C:\Anaconda\lib\gzip.pyc in __init__(self, filename, mode, compresslevel, 
fileobj, mtime)
 92 mode += 'b'
 93 if fileobj is None:
---> 94 fileobj = self.myfileobj = __builtin__.open(filename, mode 
or 'rb')
 95 if filename is None:
 96 # Issue #13781: os.fdopen() creates a fileobj with a bogus 
name

ValueError: Invalid mode ('wt+b')

In [3]:



Is this an easy one to fix?

Kind regards

James

__
PLEASE READ: This email is confidential and may be privileged. It is intended 
for the named addressee(s) only and access to it by anyone else is 
unauthorised. If you are not an addressee, any disclosure or copying of the 
contents of this email or any action taken (or not taken) in reliance on it is 
unauthorised and may be unlawful. If you have received this email in error, 
please notify the sender or postmas...@vernalis.com. Email is not a secure 
method of communication and the Company cannot accept responsibility for the 
accuracy or completeness of this message or any attachment(s). Please check 
this email for virus infection for which the Company accepts no responsibility. 
If verification of this email is sought then please request a hard copy. Unless 
otherwise stated, any views or opinions presented are solely those of the 
author and do not represent those of the Company.

The Vernalis Group of Companies
100 Berkshire Place
Wharfedale Road
Winnersh, Berkshire
RG41 5RD, England
Tel: +44 (0)118 938 

To access trading company registration and address details, please go to the 
Vernalis website at www.vernalis.com and click on the "Company address and 
registration details" link at the bottom of the page..
__--
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss