[Rdkit-discuss] Buglets in the last release

2010-04-28 Thread Thomas Heller
The Q12010 release contains several assert statements that are always true.  
Python26 warns about that:

...\rdkit_q12010_1\rdkit\sping\PDF\pdfgen.py:648: SyntaxWarning: assertion is 
always true, perhaps remove parentheses?
  assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image")
...\rdkit_q12010_1\rdkit\sping\PDF\pdfutils.py:30: SyntaxWarning: assertion is 
always true, perhaps remove parentheses?
  assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image")
...\rdkit_q12010_1\rdkit\sping\PS\pidPS.py:924: SyntaxWarning: assertion is 
always true, perhaps remove parentheses?
  assert(len(rawimage) == imgwidth*imgheight, 'Wrong amount of data for image')
...\rdkit_q12010_1\rdkit\sping\PS\pidPS.py:1015: SyntaxWarning: assertion is 
always true, perhaps remove parentheses?
  assert(len(rawimage) == imwidth*imheight, 'Wrong amount of data for image')


rdkit\Chem\Draw\__init__.py contains an unneeded 'import cairo' statement on 
line 58 which prevents
this function from working when cairo is not installed.

Otherwise I'm fascinated by the smiles rendering functionality.  Great work!

-- 
Thanks,
Thomas

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


[Rdkit-discuss] Error depicting a smiles string

2010-04-29 Thread Thomas Heller
Hi Greg,

I get errors when trying to depict this smiles string: OC(=O)[C@@H]1CCCN1

It is from the wikipedia entry for Proline:
http://en.wikipedia.org/wiki/Proline

As it turns out rdkit is passing 'nan' as coordinates to all the drawing 
functions ;-(
-- 
Thanks,
Thomas

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


Re: [Rdkit-discuss] Error depicting a smiles string

2010-04-30 Thread Thomas Heller
Greg Landrum schrieb:
> Dear Thomas,
> 
> On Thu, Apr 29, 2010 at 4:05 PM, Thomas Heller  wrote:
>>
>> I get errors when trying to depict this smiles string: OC(=O)[C@@H]1CCCN1
>>
>> It is from the wikipedia entry for Proline:
>> http://en.wikipedia.org/wiki/Proline
>>
>> As it turns out rdkit is passing 'nan' as coordinates to all the drawing 
>> functions ;-(
> 
> Can you please provide a bit of code that demonstrates the problem?
> 
> The following works fine for me:
> [16]>>> from rdkit import Chem
> [17]>>> from rdkit.Chem import Draw
> [18]>>> m = Chem.MolFromSmiles('OC(=O)[C@@H]1CCCN1')
> [19]>>> Draw.MolToImageFile(m,'proline.png')

Greg, does 'proline.png' contain a valid image in your case?


Attached is a script that demonstrates the problem.  It uses a custom Canvas
class that prints the calls to stdout - my real code uses a canvas
that directly draws into a windows device context.

Running the script with Python2.6 (on Windows) and RDKit_Q12010_1 I get this 
output:

c:\code>\python26\python test.py
drawline (nan, nan, nan, nan) {'color': Color(1.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
stringBox ('HO', Font(10,0,0,0,'helvetica')) {}
drawRect (nan, nan, nan, nan) {'edgeColor': Color(-1.00,-1.00,-1.00), 
'edgeWidth': 0, 'fillColor': Color(1.00,1.00,1.00)}
drawString HO (nan, nan) Font(10,0,0,0,'helvetica') Color(1.00,0.00,0.00)
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(1.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(1.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1}
stringBox ('O', Font(10,0,0,0,'helvetica')) {}
drawRect (nan, nan, nan, nan) {'edgeColor': Color(-1.00,-1.00,-1.00), 
'edgeWidth': 0, 'fillColor': Color(1.00,1.00,1.00)}
drawString O (nan, nan) Font(10,0,0,0,'helvetica') Color(1.00,0.00,0.00)
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,1.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,0.00), 'width': 1, 
'dash': None}
drawline (nan, nan, nan, nan) {'color': Color(0.00,0.00,1.00), 'width': 1, 
'dash': None}
stringBox ('HN', Font(10,0,0,0,'helvetica')) {}
drawRect (nan, nan, nan, nan) {'edgeColor': Color(-1.00,-1.00,-1.00), 
'edgeWidth': 0, 'fillColor': Color(1.00,1.00,1.00)}
drawString HN (nan, nan) Font(10,0,0,0,'helvetica') Color(0.00,0.00,1.00)

c:\code>

Other examples work fine:

c:\code>\python26\python test.py CN
drawline (77.5, 100.0, 100.0, 100.0) {'color': Color(0.00,0.00,0.00), 'width': 
1, 'dash': None}
drawline (100.0, 100.0, 122.5, 100.0) {'color': Color(0.00,0.00,1.00), 'width': 
1, 'dash': None}
stringBox ('NH2', Font(12,0,0,0,'helvetica')) {}
drawRect (120.5, 102.0, 124.5, 98.0) {'edgeColor': Color(-1.00,-1.00,-1.00), 
'edgeWidth': 0, 'fillColor': Color(1.00,1.00,1.00)}
drawString NH2 (120.5, 102.0) Font(12,0,0,0,'helvetica') Color(0.00,0.00,1.00)

c:\code>

Here is the test script:


import sys
from rdkit.Chem import AllChem
 
def draw(canvas, mol, size=(300,300), kekulize=True, wedgeBonds=True,
  highlightAtoms=["N"]):
  if not mol:
raise ValueError,'Null molecule provided'

  from rdkit.Chem.Draw import MolDrawing
  drawer = MolDrawing.MolDrawing(canvas)
  if kekulize:
from rdkit import Chem
mol = Chem.Mol(mol.ToBinary())
Chem.Kekulize(mol)

  if not mol.GetNumConformers():
from rdkit.Chem import AllChem
AllChem.Compute2DCoords(mol)
  
  drawer.wedgeDashedBonds=wedgeBonds
  drawer.AddMol(mol,highlightAtoms=highlightAtoms)


class Canvas(object):
size = (200, 200)
def drawLine(self, *args, **kw):
print "drawline", args, kw

def stringBox(self, *args, **kw):
print "stringBox", args, kw
return (5, 5)

def drawRect(self, *args, **kw):
print "drawRect", args, kw

def drawString(self, text, x, y, font, color):
print "drawString", text, (x, y), font, color


if len(sys.argv) > 1:
smiles = sys.argv[1]
else:
smiles = "OC(=O)[C@@H]1CCCN1"
mol = AllChem.MolFromSmiles(smiles)
 
draw(Canvas(), mol, size=(200, 200))


-- 
Thanks,
Thomas

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


Re: [Rdkit-discuss] Error depicting a smiles string

2010-05-03 Thread Thomas Heller
Greg Landrum schrieb:
> Dear Thomas,
> 
> I checked in the fix for this problem this morning.

Great.  Will you make a binary release as well, or should I
try to compile it myself?

-- 
Thanks,
Thomas

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


Re: [Rdkit-discuss] Q2 2010 Release

2010-06-30 Thread Thomas Heller
Am 30.06.2010 22:16, schrieb Greg Landrum:
> Dear all,
> 
> I'm very happy to announce that the next version of the RDKit --
> Q22010_1 -- is released.
> 
> The release notes are below.
> 
> The source release and windows binaries (python 2.6 only this time,
> please let me know if anyone needs a python 2.5 release) will be on
> the sourceforge downloads page:

If it isn't too much work for you I would very much appreciate a python 2.5
windows binary.

-- 
Thanks,
Thomas

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Q2 2010 Release

2010-07-08 Thread Thomas Heller
Greg Landrum schrieb:
> Dear Thomas,
> 
> I'm uploading a python 2.5 build to the sourceforge and google code
> repositories now.

Great!

> Sorry that took so long,

No problem - and thanks for it.

Thomas

--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss