Hello,

I have found the way... using MolToImage

Thank you again!!

Best,
Andrés


from rdkit import Chem
from rdkit.Chem import Draw

def main():

    #First we get the parameters
    if len(sys.argv) != 4:
        return 1
    smile=sys.argv[1]
    path=sys.argv[2]
    image_format=sys.argv[3]


    #We setup the image file
    size = (240, 240)
    #Create the molecule using SMILES as input
    m = Chem.MolFromSmiles(smile)

    #Draw the molecule and save in path
    Draw.MolToImage(m, path, image_format, size=size)
        





El Jun 25, 2014, a las 10:38 AM, acanada escribió:

> Hi Greg,
> 
> Thank you very much for your answer! I get what you mean, but still unclear 
> to me. If for example, I want to draw molecules, in the documentation I need 
> the sdf file as the input... But instead I have the SMILES.... How should I 
> proceed? I thought to translate SMILES to sdf and then use the sdf as input. 
> 
> If it's as you say, I don't need the sdf file... So I think I can handle this 
> by loading the sdf files of the molecules in my database (i.e using chebi web 
> service to retrieve sdf and serializing to the database), then I can retrieve 
> the sdf from the database and use 
> 
>               suppl = Chem.SDMolSupplier('data/cdk2.sdf')
> 
> to draw the molecule... But I should create a file with the data from the 
> table and it seems to me not very efficient at all...
> 
> 
> Am I messing too much? Is there an standard way to do this?
> 
> 
> Bests regards,
> Andrés
> 
> 
> El Jun 25, 2014, a las 7:59 AM, Greg Landrum escribió:
> 
>> [Andres: sorry you're getting two copies of this; I forgot to include the 
>> mailing list on the first one]
>> 
>> Hi Andres,
>> 
>> On Tue, Jun 24, 2014 at 5:43 PM, acanada <[email protected]> wrote:
>> 
>> I'm very new to RDKit and the RDKit database cartridge. I'm not chemist so 
>> please my apologize for the simple question.
>> After reading the documentation it's clear to me how to create the 
>> emolecules database with the raw_data table and populate with the 
>> version.smi.gz file 
>> (http://downloads.emolecules.com/free/2014-06-01/version.smi.gz). Then I 
>> create the mols table that will have only the smiles accepted by RDKit. 
>> Great!
>> 
>> My question, if it has any sense:  Is there a how-to to create a sdf table 
>> populating it with the version.sdf.gz file 
>> (http://downloads.emolecules.com/free/2014-06-01/version.sdf.gz)?? Can you 
>> please point me where the instructions are?
>> 
>> There is not currently an easy way to do this analogous to the way things 
>> are built from the smiles file. The SMILES file is easier for postgresql to 
>> manage on its own because it has one record per line. SDF files have 
>> multi-line records, so you would need to use something that understands the 
>> format (e.g. the RDKit python wrappers) to be able to load it.
>>  
>> Or what is the version.sdf.gz file used for?
>> 
>> It provides another format of more-or-less the same data. Unless you have a 
>> concrete reason for wanting that version of the data, there is probably no 
>> need to use the file at all.
>> 
>> Best,
>> -greg
>> 
>> 
>> On Tue, Jun 24, 2014 at 5:43 PM, acanada <[email protected]> wrote:
>> Hello,
>> 
>> I'm very new to RDKit and the RDKit database cartridge. I'm not chemist so 
>> please my apologize for the simple question.
>> After reading the documentation it's clear to me how to create the 
>> emolecules database with the raw_data table and populate with the 
>> version.smi.gz file 
>> (http://downloads.emolecules.com/free/2014-06-01/version.smi.gz). Then I 
>> create the mols table that will have only the smiles accepted by RDKit. 
>> Great!
>> 
>> My question, if it has any sense:  Is there a how-to to create a sdf table 
>> populating it with the version.sdf.gz file 
>> (http://downloads.emolecules.com/free/2014-06-01/version.sdf.gz)?? Can you 
>> please point me where the instructions are?
>> Or what is the version.sdf.gz file used for?
>> 
>> Sorry for this basic questions and thank you for your time...
>> 
>> Andrés
>> **NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en su caso los 
>> ficheros adjuntos, pueden contener información protegida para el uso 
>> exclusivo de su destinatario. Se prohíbe la distribución, reproducción o 
>> cualquier otro tipo de transmisión por parte de otra persona que no sea el 
>> destinatario. Si usted recibe por error este correo, se ruega comunicarlo al 
>> remitente y borrar el mensaje recibido.
>> **CONFIDENTIALITY NOTICE** This email communication and any attachments may 
>> contain confidential and privileged information for the sole use of the 
>> designated recipient named above. Distribution, reproduction or any other 
>> use of this transmission by any party other than the intended recipient is 
>> prohibited. If you are not the intended recipient please contact the sender 
>> and delete all copies.
>> 
>> 
>> ------------------------------------------------------------------------------
>> Open source business process management suite built on Java and Eclipse
>> Turn processes into business applications with Bonita BPM Community Edition
>> Quickly connect people, data, and systems into organized workflows
>> Winner of BOSSIE, CODIE, OW2 and Gartner awards
>> http://p.sf.net/sfu/Bonitasoft
>> _______________________________________________
>> Rdkit-discuss mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>> 
> 
> 
> 
> **NOTA DE CONFIDENCIALIDAD** Este correo electrónico, y en su caso los 
> ficheros adjuntos, pueden contener información protegida para el uso 
> exclusivo de su destinatario. Se prohíbe la distribución, reproducción o 
> cualquier otro tipo de transmisión por parte de otra persona que no sea el 
> destinatario. Si usted recibe por error este correo, se ruega comunicarlo al 
> remitente y borrar el mensaje recibido.
> 
> **CONFIDENTIALITY NOTICE** This email communication and any attachments may 
> contain confidential and privileged information for the sole use of the 
> designated recipient named above. Distribution, reproduction or any other use 
> of this transmission by any party other than the intended recipient is 
> prohibited. If you are not the intended recipient please contact the sender 
> and delete all copies.
> 
> 
> ------------------------------------------------------------------------------
> Open source business process management suite built on Java and Eclipse
> Turn processes into business applications with Bonita BPM Community Edition
> Quickly connect people, data, and systems into organized workflows
> Winner of BOSSIE, CODIE, OW2 and Gartner awards
> http://p.sf.net/sfu/Bonitasoft_______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss



**NOTA DE CONFIDENCIALIDAD** Este correo electrÿnico, y en su caso los ficheros 
adjuntos, pueden contener informaciÿn protegida para el uso exclusivo de su 
destinatario. Se prohÿbe la distribuciÿn, reproducciÿn o cualquier otro tipo de 
transmisiÿn por parte de otra persona que no sea el destinatario. Si usted 
recibe por error este correo, se ruega comunicarlo al remitente y borrar el 
mensaje recibido.
**CONFIDENTIALITY NOTICE** This email communication and any attachments may 
contain confidential and privileged information for the sole use of the 
designated recipient named above. Distribution, reproduction or any other use 
of this transmission by any party other than the intended recipient is 
prohibited. If you are not the intended recipient please contact the sender and 
delete all copies.


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to