Technical Support Forum Index
Technical Support Forum
Access ChemAxon scientists and developers here. For registration and login issues contact website support.

Support Ticket System is replacing forum

This forum was converted into a searchable archive. You cannot add posts here any more. For support please use our new Ticket System.

Create your first ticket
2d structure generation
To watch this topic for replies  Register (enables digests) or give email address:
This topic is locked: you cannot edit posts or make replies.
Display posts from previous:   
    View previous topic :: View next topic    
Author Message
osama

Joined: 16 May 2006
Posts: 36

View user's profile

Back to top
Link to postPosted: Sat Oct 28, 2006 9:52 amPost subject: 2d structure generation Reply with quote

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?
Bob

Joined: 15 Jun 2004
Posts: 2629

View user's profile

Back to top
Link to postPosted: Sun Oct 29, 2006 3:47 pmPost subject: Reply with quote

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);
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Mon Oct 30, 2006 9:24 amPost subject: Reply with quote

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.
osama

Joined: 16 May 2006
Posts: 36

View user's profile

Back to top
Link to postPosted: Thu Nov 02, 2006 12:45 pmPost subject: Reply with quote

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?
Bob

Joined: 15 Jun 2004
Posts: 2629

View user's profile

Back to top
Link to postPosted: Thu Nov 02, 2006 2:18 pmPost subject: Reply with quote

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.
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Thu Nov 02, 2006 5:15 pmPost subject: Reply with quote

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.
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Wed Nov 08, 2006 11:18 amPost subject: Reply with quote

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
osama

Joined: 16 May 2006
Posts: 36

View user's profile

Back to top
Link to postPosted: Fri Jan 11, 2008 5:38 pmPost subject: Reply with quote

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?
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Fri Jan 11, 2008 7:49 pmPost subject: Reply with quote

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
Jim

Joined: 05 Oct 2007
Posts: 11

View user's profile

Back to top
Link to postPosted: Tue Jan 15, 2008 5:00 pmPost subject: Structural Orientation information seems to be lost, though! Reply with quote

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.
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Tue Jan 15, 2008 5:15 pmPost subject: Reply with quote

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
Jim

Joined: 05 Oct 2007
Posts: 11

View user's profile

Back to top
Link to postPosted: Tue Jan 15, 2008 5:30 pmPost subject: Exactly my problem! Reply with quote

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
Jim

Joined: 05 Oct 2007
Posts: 11

View user's profile

Back to top
Link to postPosted: Wed Jan 16, 2008 2:15 amPost subject: Using data from cd_structure instead of cd_smiles? Reply with quote

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?
Szabolcs
ChemAxon personnel
Joined: 03 Jun 2004
Posts: 1924

View user's profile

Back to top
Link to postPosted: Wed Jan 16, 2008 11:00 amPost subject: Reply with quote

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
Jim

Joined: 05 Oct 2007
Posts: 11

View user's profile

Back to top
Link to postPosted: Fri Mar 07, 2008 5:40 pmPost subject: 2d structure generation - image options Reply with quote

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?
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Mon Mar 10, 2008 2:57 pmPost subject: Reply with quote

Currently, there is no image export option to control visibility of E/Z labels but we will complete it soon.
Tamas
ChemAxon personnel
Joined: 21 May 2004
Posts: 2171

View user's profile

Back to top
Link to postPosted: Mon Mar 10, 2008 4:01 pmPost subject: Reply with quote

Implemented. It will be available in next release (5.0.2).
This topic is locked: you cannot edit posts or make replies.
Page 1 of 1


To watch this topic for replies   Register (enables digests) or give email address  
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum