2d structure generation

User ddf03b522f

28-10-2006 08:52:08

Is their any functionality to generate a 2d image e.g. jpg, gif or png image dynamically for dipiction on a web page from a mofile file or smile string stored in a database. I am currently using marvin view to display images of molecules however these applets take much longer to load than a simple 2d structure. Does jchem provide any functionality to do this an example of similar software to do this is Oghams 2d chemical structure and layout rendering suit?

User 870ab5b546

29-10-2006 14:47:49

We use a MolConverter object to create a JPEG from the MRV or MOL source.





String mol; // contains a string representation of the molecule


InputStream ip = new ByteArrayInputStream(mol.getBytes());


DataOutputStream op = new DataOutputStream(new FileOutputStream(imgfile));


String convertParams = "jpeg:mono,H_heteroterm,wireframe,#ffffff"; // you can use other parameters here, instead


MolConverter mcv = new MolConverter(ip, op, convertParams, false);

ChemAxon 7c2d26e5cf

30-10-2006 08:24:49

Exactly.


Bob, thanks for the answer.


MolConverter API is part of both Marvin Beans and JChem package.


I suggest to see also the SimpleConverter example in the Marvin Beans package. This example uses the MolImporter class to read structure and Molecule.toBinFormat to export it in image. It can be an alternative solution to image generation.


The Image generation example can be also useful for you.

User ddf03b522f

02-11-2006 11:45:52

Is there an ASP version of the generate_image.jsp script?





Also i have marvin_all directory stored on the server. Where in this directory do i need to save this file to make it work?

User 870ab5b546

02-11-2006 13:18:44

I'm pretty sure you can save the file wherever you want, as long as the page that displays it knows where to find it. We include the path name in the file name.





I'll leave the ASP question to the experts.

ChemAxon 7c2d26e5cf

02-11-2006 16:15:01

Quote:
Is there an ASP version of the generate_image.jsp script?
No, we haven't got an ASP example for image generation.


If somebody has got an ASP example for it and he would like to share it with others, he can upload it into the Contributed Software -> Contribution to the community section of the forum. We would be grateful.

ChemAxon 7c2d26e5cf

08-11-2006 10:18:39

By the way, there is .NET support in Marvin that can be useful to ASP developers.


http://www.chemaxon.com/marvin/doc/dev/dotnet.html

User ddf03b522f

11-01-2008 16:38:15

do you have a php version of generate_image.jsp to depict molecules as gifs or jpegs or is there any othe method than using jsp?

ChemAxon 7c2d26e5cf

11-01-2008 18:49:09

No, we don't have any php example.





The Marvin Beans API can not export molecule into GIF format but supports several other image formats: PNG, JPEG, SVG, PDF, etc. The Marvin Beans API requires Java.


Since JSP can access directly java methods, it is the easiest way to do image generation via the Marvin Beans API on a web server.


I recommend you to integrate JSP pages (for image generation) into your PHP site. You need only a servlet container (like Apache Tomcat) to run JSP pages.





I don't know how you can access Java methods from PHP.


If you can access .NET from PHP, the Marvin .NET support can be a good solution for you.


http://www.chemaxon.com/marvin/help/developer/dotnet.html

User 1cab753e44

15-01-2008 16:00:02

We use essentially the method for creating jpg images of molecules but we have found that when we create the mol object using cd_smiles from our jchem molecule table the spacial orientation (how the molecule was drawn upon registration) is lost. Is there a way to create the molecule other than via the smiles to maintain spacial orientation?





eg:


We create the Molecule object via this call


chemaxon.struc.Molecule mol = MolImporter.importMol(SMILES);





Tamas wrote:
Exactly.


Bob, thanks for the answer.


MolConverter API is part of both Marvin Beans and JChem package.


I suggest to see also the SimpleConverter example in the Marvin Beans package. This example uses the MolImporter class to read structure and Molecule.toBinFormat to export it in image. It can be an alternative solution to image generation.


The Image generation example can be also useful for you.

ChemAxon 7c2d26e5cf

15-01-2008 16:15:52

SMILES does not store coordinates.


I can recommend Mdl molfile or "mrv" formats that are more descriptive than SMILES.


Mdl molfile is supported by several chemical drawing tools.


"mrv" is ChemAxon own format, it can store also display information.


Molfiles and compressed molfiles


Marvin Documents (mrv)


You can read more Marvin supported formats in the following document: File Formats in Marvin

User 1cab753e44

15-01-2008 16:30:48

Is there a way to perform this process armed only with the cd_id from the JChem molecule table so that I will have all the coordinate information?
Tamas wrote:
SMILES does not store coordinates.


I can recommend Mdl molfile or "mrv" formats that are more descriptive than SMILES.


Mdl molfile is supported by several chemical drawing tools.


"mrv" is ChemAxon own format, it can store also display information.


Molfiles and compressed molfiles


Marvin Documents (mrv)


You can read more Marvin supported formats in the following document: File Formats in Marvin

User 1cab753e44

16-01-2008 01:15:20

Creating the jpg image from a smiles string is quite easy following the examples - but what about being able to create the image from the Blob object inside the cd_structure column? Since the orientation information is lost with smiles, I am hoping to produce the image from the cd_structure column which should have orientation information (sdf,mrv,mol, however it is encoded).





I have been "playing around" with trying pulling the Blob out of the cd_structure column, taking the blob and getting the byte array from it, then encoding the byte array into a hex String, URL encoding it and passing it as a GET parameter embedded as an img tag like the examples...





Do you think this is a reasonable course of action before I "sink" too much time into it?

ChemAxon a3d59b832c

16-01-2008 10:00:15

Jim,





That is the right thing to do, just use the cd_structure column for display. This column of the JChem table always contains the original, imported structure.





See also this new convenience function in JChem 5.0:


http://www.chemaxon.com/jchem/doc/api/chemaxon/jchem/db/JChemSearch.html#getHitsAsMolecules(int[],%20chemaxon.util.HitColoringAndAlignmentOptions,%20java.util.ArrayList,%20java.util.ArrayList)








Best regards,


Szabolcs

User 1cab753e44

07-03-2008 16:40:42

I am poking around the format options for images and I don't see any way to on the "E/Z Labels" when rendering a molecule as an image.





I am looking at:


http://www.chemaxon.com/marvin/help/formats/images-doc.html





Am I missing something that is obvious or is this option not available?

ChemAxon 7c2d26e5cf

10-03-2008 13:57:35

Currently, there is no image export option to control visibility of E/Z labels but we will complete it soon.

ChemAxon 7c2d26e5cf

10-03-2008 15:01:27

Implemented. It will be available in next release (5.0.2).