Hi Michal,

The second two of those, particularly the last one, are viable alternatives
that are worth considering. The process would go faster if someone were to
submit a pull request with a sample implementation (hint, hint).

-greg



On Thu, Jul 25, 2013 at 6:51 AM, Michał Nowotka <[email protected]> wrote:

> I've looked into the code and have some questions:
>
> 1. Why not to change MolDrawing constructor to something like:
>
>   def __init__(self,canvas=None):
>     self.canvas = canvas
>     if canvas:
>       self.canvasSize=canvas.size
>     if self.canvasSize:
>         self.dotsPerAngstrom = int(max(self.canvasSize) / 10)
>     self.atomPs = {}
>     self.boundingBoxes = {}
>
> 2. Why not to add MolDrawing as optional argument for methods like
> MolToImage so then I can set my own values of 'dotsPerAngstrom',
> 'useFraction', 'colorBonds' etc.
>
> 3. Even better - why not to extract drawing parameters like
> 'dotsPerAngstrom', 'useFraction', 'colorBonds' etc. from MolDrawing to some
> dict-like class (lets name it 'DrawingOptions') and add this class as an
> optional parameter to MolDrawing constructor and all methods that construct
> MolDrawing (MolToImage etc.)
>
> Without those changes customization of compound drawing is very limited.
>
>
>
> On Thu, Jul 25, 2013 at 11:10 AM, Michał Nowotka <[email protected]> wrote:
>
>> My mistake again. There is nothing like 'dotsPerAngstrom' in
>> RDKit_2012_09_1. At least Draw, module doesn't have it. Also, Draw module
>> doesn't contain 'MolDrawing' module...
>>
>>
>> On Thu, Jul 25, 2013 at 11:06 AM, Michał Nowotka <[email protected]>wrote:
>>
>>> OK, i've found 'dotsPerAngstrom' in Draw.
>>> Unfortunately setting it to any higher value (tried 60, 160, 660, 1000)
>>> doesn't change anything...
>>>
>>>
>>> On Thu, Jul 25, 2013 at 11:03 AM, Michał Nowotka <[email protected]>wrote:
>>>
>>>> I'm getting:
>>>>
>>>> Draw.MolDrawing.dotsPerAngstrom=60
>>>> AttributeError: 'module' object has no attribute 'MolDrawing'
>>>>
>>>> I'm using RDKit_2012_09_1
>>>>
>>>>
>>>>
>>>> On Thu, Jul 25, 2013 at 10:56 AM, Greg Landrum 
>>>> <[email protected]>wrote:
>>>>
>>>>>
>>>>> On Thu, Jul 25, 2013 at 5:36 AM, Michał Nowotka <[email protected]>wrote:
>>>>>
>>>>>> When I do this:
>>>>>>
>>>>>> image = Draw.MolToImage(mol, size=(200, 200))
>>>>>>
>>>>>> I'm getting image with compound taking most of available canvas
>>>>>> space. But this:
>>>>>>
>>>>>> image = Draw.MolToImage(mol, size=(500, 500))
>>>>>>
>>>>>> gives me an image with the compound of exact same size - it's just
>>>>>> the canvas which is bigger. I guess this is because molfile already
>>>>>> contains fixed 2D coordinates. Is there any possibility to regenerate it
>>>>>> taking into account current image size?
>>>>>>
>>>>>
>>>>> It's not the molfile.
>>>>>
>>>>> The class rdkit.Chem.Draw.MolDrawing.MolDrawing has a data member
>>>>> called dotsPerAngstrom that is used as the "desired" number of pixels per
>>>>> Angstrom in the drawing. This number is automatically reduced when a big
>>>>> molecule is drawn onto a small canvas, but it is never increased in the
>>>>> drawing code (by design).
>>>>>
>>>>> You can, however, change it on your own;
>>>>> In [2]: from rdkit.Chem import Draw
>>>>>
>>>>> In [3]: Draw.MolDrawing.dotsPerAngstrom=60
>>>>>
>>>>> In [4]:
>>>>> Draw.MolToImageFile(Chem.MolFromSmiles('c1ccccn1'),'blah.png',size=(500,500))
>>>>>
>>>>> Note: the dotsPerAngstrom value will still be reduced automatically
>>>>> when rendering a large molecule.
>>>>>
>>>>> Hope this helps,
>>>>> -greg
>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to