Re: [Rdkit-discuss] SDwriter

2016-12-16 Thread Milinda Samaraweera
This SD file is then used as an input for another program, that program is
having problems reading the sequence numbers.

Thanks,
MAK

On Fri, Dec 16, 2016 at 10:43 PM, Greg Landrum 
wrote:

> It's easy enough to make this an option, but given that it is part of the
> SDF spec (as Andrew has pointed out) the only reason I can think of to do
> so would be because it causes problems for some other piece of (likely
> commonly used) software.
>
> Are the sequence numbers causing a problem for you?
>
> -greg
>
>
>
>
>
>
> On Sat, Dec 17, 2016 at 1:46 AM +0100, "Milinda Samaraweera" <
> milindaatw...@gmail.com> wrote:
>
> Dear Users,
>>
>> I was using the SDWriter in the rdkit kit to generate a SD file with
>> mutiple entries generated using smiles and later assign SD tag data (e.g.
>> pubchem_ID, IUPAC_name, etc).
>>
>> However at the end of each tag header I noticed there is a number
>> (bolded):
>>
>> ...
>> >   * (1) *
>> N1-(2-ethylbutyl)hexane-1,3,6-triamine
>>
>> >*(1) *
>> 118903148
>>
>> ...
>> M  END
>> >   * (2)*
>> N1,N2-dimethyl-N2-[3-(methylamino)propyl]-N1-propylpropane-1,2-diamine
>>
>> >   * (2) *
>> 118883401
>>
>> What is this number and how you avoid printing this number when SDwriter
>> is used? As this number is not found in standard SD files.
>>
>> Thanks,
>> CodeMAK
>>
>>


-- 
Milinda Samaraweera, Ph.D.
Postdoctoral Fellow, Department of Pharmacy
University of Connecticut
69 North Eagleville road
Storrs, CT, 06269
milindaatw...@gmail.com
860-617-8594
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDwriter

2016-12-16 Thread Greg Landrum
It's easy enough to make this an option, but given that it is part of the SDF 
spec (as Andrew has pointed out) the only reason I can think of to do so would 
be because it causes problems for some other piece of (likely commonly used) 
software.
Are the sequence numbers causing a problem for you?
-greg






On Sat, Dec 17, 2016 at 1:46 AM +0100, "Milinda Samaraweera" 
 wrote:










Dear Users,

I was using the SDWriter in the rdkit kit to generate a SD file with mutiple 
entries generated using smiles and later assign SD tag data (e.g. pubchem_ID, 
IUPAC_name, etc).

However at the end of each tag header I noticed there is a number (bolded):

...
>    (1) 
N1-(2-ethylbutyl)hexane-1,3,6-triamine

>    (1) 
118903148

...
M  END
>    (2) 
N1,N2-dimethyl-N2-[3-(methylamino)propyl]-N1-propylpropane-1,2-diamine

>    (2) 
118883401

What is this number and how you avoid printing this number when SDwriter is 
used? As this number is not found in standard SD files.

Thanks,
CodeMAK







--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDwriter

2016-12-16 Thread Andrew Dalke
On Dec 17, 2016, at 1:45 AM, Milinda Samaraweera wrote:
> However at the end of each tag header I noticed there is a number (bolded):
> 
> ...
> >(1) 
> N1-(2-ethylbutyl)hexane-1,3,6-triamine
   ...
> What is this number and how you avoid printing this number when SDwriter is 
> used? As this number is not found in standard SD files.

Many programs do not generate a term in parentheses, although it it allowed by 
the connection table specification as a way to designate an "external registry 
number".

The ctfile.pdf I have from 2011 says:

   • Note: The > sign is a reserved character. A field name cannot contain 
hyphen (-),
 period (.), less than (<), greater than (>), equal sign (=), percent sign 
(%) or
 blank space ( ). Field names must begin with an alpha character and can 
contain
 alpha and numeric characters after that, including underscore.

 Optional information for the data header includes:
• The compound’s external and internal registry numbers.
  External registry numbers must be enclosed in parentheses.

• Any combination of information

   The following are examples of valid data headers:
  > 
  > 55 (MD-08974)DT12
  > DT12   55
  > (MD-0894)  FROM ARCHIVES

As you have discovered, RDKit stores the output record number for each molecule 
in this field.

I see no way to disable that through the API. The two options I can suggest for 
now are:

1) Implement your own writer using MolToMolBlock() to generate the connection 
table text and your own code to enumerate through the properties. The result 
looks something like:

def mol_to_sd_block(mol):
block = Chem.MolToMolBlock(mol)
lines = [block]
for name in mol.GetPropNames():
lines.append("> <%s>\n%s\n\n" % (name, mol.GetProp(name)))
lines.append("\n")
return "".join(lines)


2) Maintain your own fork where you've deleted like 87 or so of 
Code/GraphMol/FileParsers/SDWriter.cpp where it says:

  if (d_molid >= 0) (*dp_ostream) << "(" << d_molid + 1 << ") ";


Cheers,


Andrew
da...@dalkescientific.com



--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDwriter

2016-12-16 Thread Peter Gedeck
Hello

In cases like this i know that Greg did the valid implementation according
to the standard. If you check the ctfile definition (
http://c4.cabrillo.edu/404/ctfile.pdf#page41) you will see that the data
header is pretty flexible. The only requirement is that it starts with a >.
Usually we find the and data name as in , but even this seems not
required (third example). Otherwise the user is free to add whatever is
required before or after the data name. Only constraint is that external
registration numbers must be in round brackets (external Regis).

Looking at the code, I think it is not possible to suppress the sequential
numbers or replace them with something else.

Best,

Peter
On Fri, Dec 16, 2016 at 7:46 PM Milinda Samaraweera 
wrote:

> Dear Users,
>
> I was using the SDWriter in the rdkit kit to generate a SD file with
> mutiple entries generated using smiles and later assign SD tag data (e.g.
> pubchem_ID, IUPAC_name, etc).
>
> However at the end of each tag header I noticed there is a number (bolded):
>
> ...
> >   * (1) *
> N1-(2-ethylbutyl)hexane-1,3,6-triamine
>
> >*(1) *
> 118903148
>
> ...
> M  END
> >   * (2)*
> N1,N2-dimethyl-N2-[3-(methylamino)propyl]-N1-propylpropane-1,2-diamine
>
> >   * (2) *
> 118883401
>
> What is this number and how you avoid printing this number when SDwriter
> is used? As this number is not found in standard SD files.
>
> Thanks,
> CodeMAK
>
>
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] SDwriter

2016-12-16 Thread Milinda Samaraweera
Dear Users,

I was using the SDWriter in the rdkit kit to generate a SD file with
mutiple entries generated using smiles and later assign SD tag data (e.g.
pubchem_ID, IUPAC_name, etc).

However at the end of each tag header I noticed there is a number (bolded):

...
>   * (1) *
N1-(2-ethylbutyl)hexane-1,3,6-triamine

>*(1) *
118903148

...
M  END
>   * (2)*
N1,N2-dimethyl-N2-[3-(methylamino)propyl]-N1-propylpropane-1,2-diamine

>   * (2) *
118883401

What is this number and how you avoid printing this number when SDwriter is
used? As this number is not found in standard SD files.

Thanks,
CodeMAK
--
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter from Java

2016-03-30 Thread Greg Landrum
On Wed, Mar 30, 2016 at 2:47 PM, Tim Dudgeon  wrote:

> And there's no other way to generate a SDF from Java?
> e.g. can each ROMol be converted to text in SD format and then that text
> written to the Java OutputStream?
>

There's no way to do it in a single step.
You can get the mol block and the properties individually and then use
those, but that's not particularly nice.

I *think* I can pretty easily add a static method to the SDWriter class
that takes a molecule and optional list of properties as an argument and
returns the string that would go in to the SDF. This would then
automatically show up in the wrappers (I think). Let me investigate that.

-greg
--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter from Java

2016-03-30 Thread Tim Dudgeon

And there's no other way to generate a SDF from Java?
e.g. can each ROMol be converted to text in SD format and then that text 
written to the Java OutputStream?


Tim

On 30/03/2016 13:31, Greg Landrum wrote:

Hi Tim,

That constructor is expecting a C++ stream pointer. The takeOwnership 
flag tells it to take assume ownership of the pointer (i.e. to free up 
the memory being used by the stream when the SDWriter itself is 
free'd). I am guessing that this will not be useable from Java (and 
should probably be disabled).


There is likely a way to set up the wrappers so that Java streams are 
properly handled, but it's difficult to assess how much work that 
would be.


-greg


On Wed, Mar 30, 2016 at 2:00 PM, Tim Dudgeon > wrote:


Hi All,

this probably a pretty basic question, but I'm struggling to work out
how to use the SDWriter from Java.
The class that SWIG has generated for SDWriter has a constructor
of type:
SDWriter(SWIGTYPE_p_std__ostream outstream)
which looks like its the one I need (I need to write to a Java
OutputStream, not a file).
But I can't would out how to generate an instance of
SWIGTYPE_p_std__ostream from my Java OutputStream.
Any pointers?

(Also, what does the boolean takeownership param of the similar
constructor do?)


Tim




--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/rdkit-discuss




--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter from Java

2016-03-30 Thread Greg Landrum
Hi Tim,

That constructor is expecting a C++ stream pointer. The takeOwnership flag
tells it to take assume ownership of the pointer (i.e. to free up the
memory being used by the stream when the SDWriter itself is free'd). I am
guessing that this will not be useable from Java (and should probably be
disabled).

There is likely a way to set up the wrappers so that Java streams are
properly handled, but it's difficult to assess how much work that would be.

-greg


On Wed, Mar 30, 2016 at 2:00 PM, Tim Dudgeon  wrote:

> Hi All,
>
> this probably a pretty basic question, but I'm struggling to work out
> how to use the SDWriter from Java.
> The class that SWIG has generated for SDWriter has a constructor of type:
> SDWriter(SWIGTYPE_p_std__ostream outstream)
> which looks like its the one I need (I need to write to a Java
> OutputStream, not a file).
> But I can't would out how to generate an instance of
> SWIGTYPE_p_std__ostream from my Java OutputStream.
> Any pointers?
>
> (Also, what does the boolean takeownership param of the similar
> constructor do?)
>
>
> Tim
>
>
>
>
> --
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] SDWriter from Java

2016-03-30 Thread Tim Dudgeon
Hi All,

this probably a pretty basic question, but I'm struggling to work out 
how to use the SDWriter from Java.
The class that SWIG has generated for SDWriter has a constructor of type:
SDWriter(SWIGTYPE_p_std__ostream outstream)
which looks like its the one I need (I need to write to a Java 
OutputStream, not a file).
But I can't would out how to generate an instance of 
SWIGTYPE_p_std__ostream from my Java OutputStream.
Any pointers?

(Also, what does the boolean takeownership param of the similar 
constructor do?)


Tim



--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter kekulizes by default

2014-01-06 Thread Greg Landrum
Hi Michal,

On Mon, Jan 6, 2014 at 3:30 PM, Michal Krompiec
wrote:

> Hello Greg,
> >>> Chem.MolToSmiles(Chem.MolFromSmiles('O=C1NC=CC1=C1C=C(-c2nccc2)NC1=O'))
> [14:25:55] Can't kekulize mol
>
>
The problem is, once again, in the pyrrole:
In [2]: Chem.MolFromSmiles('O=C1NC=CC1=C1C=C(-c2nccc2)NC1=O')
[15:38:53] Can't kekulize mol

If you add the "explicit" H, everything works:

In [3]: Chem.MolFromSmiles('O=C1NC=CC1=C1C=C(-c2[nH]ccc2)NC1=O')
Out[3]: 

This smiles was generated from ChemSketch. OpenBabel converts it to
> O=C1NC=CC1=C1C=C(c2[nH]ccc2)NC1=O which is correctly interpreted by
> RDKit (no problems with kekulization).
> But IMHO both representations are correct, am I wrong?
>

The SMILES c1cccn1 does not really contain sufficient information to figure
out what the user meant. The RDKit does not, in general, try to "guess"
intent, so it fails on that form. Daylight's depictor also does not process
that form of pyrrole.

It's possible to imagine adding a special case for pyrrole, but something
like Cc1nncc1 would still cause problems.

The fact that you're getting those SMILES at all is really a bug in
ChemSketch. It should be adding the H.

-greg
--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter kekulizes by default

2014-01-06 Thread Michal Krompiec
Hello Greg,
>>> Chem.MolToSmiles(Chem.MolFromSmiles('O=C1NC=CC1=C1C=C(-c2nccc2)NC1=O'))
[14:25:55] Can't kekulize mol

This smiles was generated from ChemSketch. OpenBabel converts it to
O=C1NC=CC1=C1C=C(c2[nH]ccc2)NC1=O which is correctly interpreted by
RDKit (no problems with kekulization).
But IMHO both representations are correct, am I wrong?
Best wishes,
Michal


On 5 December 2013 12:19, Greg Landrum  wrote:
> Hi Michal,
>
> On Thu, Dec 5, 2013 at 11:52 AM, Michal Krompiec 
> wrote:
>>
>> Hello,
>> Is it possible to suppress kekulization by SDWriter? I get the
>> following error on a call to SDWriter.write:
>> ValueError: Sanitization error: Can't kekulize mol
>> But some molecules can't be kekulized using RDKit's algorithm, even
>> though they are otherwise 'correct'.
>
>
> hmm, I'd love to see examples of those if you can share them.
>
>>
>> I browsed the sources and it seems that SDWriter calls MolToMolBlock
>> with the default parameter kekulize=True. Can this parameter be
>> exposed in SDWriter?
>
>
> Yep, I'll get it in for the next release.
>
> -greg
>

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter kekulizes by default

2013-12-06 Thread Michal Krompiec
Dear Greg,
It seems that all examples I found are in fact incorrect (due to an
error during conversion of SDF produced by ISIS Draw with OpenBabel)
and contain this bit:
c1(sc(c2c1nsn2)) which was meant to be: c1scc2N=S=Nc12.
By the way, ChemSketch understands c1(sc(c2c1nsn2)) as N1SNc2cscc12.
So it is not a bug in your code, unless you consider the fused
thiadiazole ring aromatic.
Best wishes,
Michal

On 5 December 2013 12:19, Greg Landrum  wrote:
> Hi Michal,
>
> On Thu, Dec 5, 2013 at 11:52 AM, Michal Krompiec 
> wrote:
>>
>> Hello,
>> Is it possible to suppress kekulization by SDWriter? I get the
>> following error on a call to SDWriter.write:
>> ValueError: Sanitization error: Can't kekulize mol
>> But some molecules can't be kekulized using RDKit's algorithm, even
>> though they are otherwise 'correct'.
>
>
> hmm, I'd love to see examples of those if you can share them.
>
>>
>> I browsed the sources and it seems that SDWriter calls MolToMolBlock
>> with the default parameter kekulize=True. Can this parameter be
>> exposed in SDWriter?
>
>
> Yep, I'll get it in for the next release.
>
> -greg
>

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SDWriter kekulizes by default

2013-12-05 Thread Greg Landrum
Hi Michal,

On Thu, Dec 5, 2013 at 11:52 AM, Michal Krompiec
wrote:

> Hello,
> Is it possible to suppress kekulization by SDWriter? I get the
> following error on a call to SDWriter.write:
> ValueError: Sanitization error: Can't kekulize mol
> But some molecules can't be kekulized using RDKit's algorithm, even
> though they are otherwise 'correct'.
>

hmm, I'd love to see examples of those if you can share them.


> I browsed the sources and it seems that SDWriter calls MolToMolBlock
> with the default parameter kekulize=True. Can this parameter be
> exposed in SDWriter?
>

Yep, I'll get it in for the next release.

-greg
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] SDWriter kekulizes by default

2013-12-05 Thread Michal Krompiec
Hello,
Is it possible to suppress kekulization by SDWriter? I get the
following error on a call to SDWriter.write:
ValueError: Sanitization error: Can't kekulize mol
But some molecules can't be kekulized using RDKit's algorithm, even
though they are otherwise 'correct'.
I browsed the sources and it seems that SDWriter calls MolToMolBlock
with the default parameter kekulize=True. Can this parameter be
exposed in SDWriter?
Thanks,
Michal

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] 'SDWriter' object has no attribute 'close

2010-06-10 Thread Cedric MORETTI
Markus thank you, you responded to my problem.
I had read the manual RDKIT and I could not see where you need to close 
SDWRITER.
So I do not understand my error.
C
 

-Original Message-
From: markus kossner [mailto:m.koss...@tu-bs.de] 
Sent: jeudi, 10. juin 2010 15:43
To: Cedric MORETTI
Cc: rdkit-discuss@lists.sourceforge.net
Subject: Re: [Rdkit-discuss] 'SDWriter' object has no attribute 'close

Cedric MORETTI wrote:
>
> Hello all,
>
> I have I little problem with RDKIT( I hope :D)
>
> My program don't arrive to close the SDwriter whereas I put the 
> command "writer.close()" and Chem.SDWriter.close() in the end of programm
>
> I just let the part of the code that is import for understand the 
> problem and the error.
>
> I have the error when the program has finished to read the file
>
> Tks
>
> C
>
> from sys import *
>
> #from ChemScript11 import *
>
> from cinfony import rdk
>
> from rdkit import Chem
>
> import time
>
> reader1 = Chem.SDMolSupplier(sys.argv[0])
>
> writer = Chem.SDWriter(sys.argv[1])
>
> z = 0
>
> for mol in reader1:
>
> "
>
> [Blablablablabla ( It's to simulate a code)]
>
> writer.write(mol)
>
> writer.close()
>
> reader1.close()
>
> Chem.SDWriter.close()
>
> Traceback (most recent call last):
>
> File "C:\Scripttravail\supermain.py", line 18, in 
>
> exec(file.read())
>
> File "", line 51, in 
>
> AttributeError: 'SDWriter' object has no attribute 'close
>
> **
> DISCLAIMER
> This email and any files transmitted with it, including replies and forwarded 
> copies (which may contain alterations) subsequently transmitted from 
> Firmenich, are confidential and solely for the use of the intended recipient. 
> The contents do not represent the opinion of Firmenich except to the extent 
> that it relates to their official business.
> **
>
> 
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> 
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Hi Cedric,
the Chem.SDWriter Object does not need to be closed, does it? It is 
automatically closed at the end of your program.
It doesn't even have a method that is named 'close()' like the ones you 
might know from python text file I/O objects.
This is what the Traceback error complains when it says :
->AttributeError: 'SDWriter' object has no attribute 'close'
So you should go well with simply deleting the three lines at the end of 
your script that give the .close() commands.
Hope this helps,
Markus
**
DISCLAIMER
This email and any files transmitted with it, including replies and forwarded 
copies (which may contain alterations) subsequently transmitted from Firmenich, 
are confidential and solely for the use of the intended recipient. The contents 
do not represent the opinion of Firmenich except to the extent that it relates 
to their official business.
**


--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] 'SDWriter' object has no attribute 'close

2010-06-10 Thread markus kossner
Cedric MORETTI wrote:
>
> Hello all,
>
> I have I little problem with RDKIT( I hope :D)
>
> My program don’t arrive to close the SDwriter whereas I put the 
> command “writer.close()” and Chem.SDWriter.close() in the end of programm
>
> I just let the part of the code that is import for understand the 
> problem and the error.
>
> I have the error when the program has finished to read the file
>
> Tks
>
> C
>
> from sys import *
>
> #from ChemScript11 import *
>
> from cinfony import rdk
>
> from rdkit import Chem
>
> import time
>
> reader1 = Chem.SDMolSupplier(sys.argv[0])
>
> writer = Chem.SDWriter(sys.argv[1])
>
> z = 0
>
> for mol in reader1:
>
> “
>
> [Blablablablabla ( It’s to simulate a code)]
>
> writer.write(mol)
>
> writer.close()
>
> reader1.close()
>
> Chem.SDWriter.close()
>
> Traceback (most recent call last):
>
> File "C:\Scripttravail\supermain.py", line 18, in 
>
> exec(file.read())
>
> File "", line 51, in 
>
> AttributeError: 'SDWriter' object has no attribute 'close
>
> **
> DISCLAIMER
> This email and any files transmitted with it, including replies and forwarded 
> copies (which may contain alterations) subsequently transmitted from 
> Firmenich, are confidential and solely for the use of the intended recipient. 
> The contents do not represent the opinion of Firmenich except to the extent 
> that it relates to their official business.
> **
>
> 
>
> --
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> 
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Hi Cedric,
the Chem.SDWriter Object does not need to be closed, does it? It is 
automatically closed at the end of your program.
It doesn't even have a method that is named 'close()' like the ones you 
might know from python text file I/O objects.
This is what the Traceback error complains when it says :
->AttributeError: 'SDWriter' object has no attribute 'close'
So you should go well with simply deleting the three lines at the end of 
your script that give the .close() commands.
Hope this helps,
Markus

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] 'SDWriter' object has no attribute 'close

2010-06-10 Thread Cedric MORETTI
Hello all,
I have I little problem with RDKIT( I hope :D)
My program don't arrive to close the SDwriter whereas I put the command 
"writer.close()" and Chem.SDWriter.close() in the end of programm
I just let the part of the code  that is import for understand the problem and 
the error.
I have the error when the program has finished to read the file
Tks
C


from sys import *
#from ChemScript11 import *
from cinfony import rdk
from rdkit import Chem
import time


reader1 = Chem.SDMolSupplier(sys.argv[0])
writer = Chem.SDWriter(sys.argv[1])


z = 0
for mol in reader1:

 "
 [Blablablablabla ( It's to simulate a code)]
  writer.write(mol)

writer.close()
reader1.close()
Chem.SDWriter.close()


Traceback (most recent call last):
  File "C:\Scripttravail\supermain.py", line 18, in 
exec(file.read())
  File "", line 51, in 
AttributeError: 'SDWriter' object has no attribute 'close

**
DISCLAIMER
This email and any files transmitted with it, including replies and forwarded 
copies (which may contain alterations) subsequently transmitted from Firmenich, 
are confidential and solely for the use of the intended recipient. The contents 
do not represent the opinion of Firmenich except to the extent that it relates 
to their official business.
**

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss