viewing SDF tags in a molecule table

User b02de6878c

29-06-2009 13:35:18

Hi,


I was trying to modify an example for viewing molecule table loaded from an SDF file:


http://www.chemaxon.com/marvin/examples/applets/view/sdtable.html


I'd like to show molecule name (first line of SDF file) and some SDF tags along with chemical structures but I couldn't figure out how to read SDF tags in javascript. I looked at getMProperty() method but that can only be envoked once the "MView" object is constructed, at which point it's too late to display something in it.


Another related problem I came across in this example is that labels disappear when the molecule table is scrolled. I saw a related post about this problem in the forum but could not see whether a solution was posted.


Any help appreciated...


Thanks!
Viktor

ChemAxon 7c2d26e5cf

30-06-2009 14:46:55

I recommend the following solution.


Use the existing SD file example (that you have linked below), just modify it a bit. Retrieve SD property of the each record on server side and insert it into the applet code ( mview_param("cell...") ).


You can use the MolImporter API from the Marvin Beans package to do it. If you use JSP, you can integrate it into the applet code.


<%
try {
MolImporter importer = new MolImporter(sdfile);
Molecule m = null;
for(int i = 0; (m = importer.read()) != null; i++) {
String propvalue = m.getProperty(propname);
out.println("mview_param(\"cell"+Integer.toString(i)+"\", \"||"+propvalue+"\");\n");
}
} catch(Exception e) {}
%>

User b02de6878c

30-06-2009 18:35:04

Hi Tamas,


thanks for your reply! Unfortunately, I am not a Java programmer so your solution may be a bit over my head. I thought that since MView plugin knows about SDF tags (and I assume it does know because when I click on a molecule in a table, it opens a new window and along with the molecule it displays all SDF tags with their values) it would have a way to expose them somehow in the applet. So I will probably read an SDF on a server (using a cgi script), populate the labels and then create an MView applet. Unfortunately, this way I have to read SDF twice, once for getting the properties (SDF tags) and second time in the MView applet.


Also, as much as I really love the molecule table view in MView applet, I keep having problems with my labels disappearing when I scroll the table. Is this a problem with my script or is it a known problem?


I appreciate your help, thanks a bunch!


-Viktor


 

ChemAxon 7c2d26e5cf

03-07-2009 11:57:16

Currently, the MarvinView application is more sophisticated than the MarvinView applet. In the application, you can customize the rendering style of the molecule table at runtime. I suggest to use MarvinView application via Java WebStart where you can use these extra features of MarvinView.


http://www.chemaxon.com/marvin/examples/webstart/index.html


http://www.chemaxon.com/marvin/examples/webstart/example-jws-view.html


About scrolling issue: please send us an example where labels disappearing issue occurs to be able to check it.

User b02de6878c

04-07-2009 03:03:13

Hi Tamas,


thanks for your suggestions. I tried the CGI route and it works quite well (first I extract SDF tags on the server side and then create a page with mview applet with already known SDF tags as labels).


As for the problem regarding the labels when the molecule table is scrollable, the example on your webpage that I referred to previously should demonstrate it quite well:


http://www.chemaxon.com/marvin/examples/applets/view/sdtable.html


When you scroll the table, the numeric labels ("1" to "8" for 8 molecules in a table) will disappear and never appear again even if one scrolls back to the beginning of the table. I have tried WindowsXP/IE6/IE7/Firefox3.5 as well as SuSE or Ubuntu Linux/Firefox3.0, all reproducing the problem. I have also created my own mview applet (using Marvin 5.2.2) with scrollable molecule table and it has the same issue. If I use multiple labels per cell they all disappear so something in the scrollable table is causing the problem. Please do let me know if you cannot reproduce this or if you need more information about it...


Thanks!
-Viktor


 


 

ChemAxon 7c2d26e5cf

07-07-2009 09:31:41

Thanks for reporting this issue. We are checking it.