Marvin Space Implementation

User dfd663fd5c

24-11-2008 17:40:03

Dear all,





I am trying to implement an mspace applet to viex proteins from the pdb. I have tried to insert as the doc provides:


<script language="JavaScript" src="../../marvin/marvin.js"></script>


<script language="JavaScript">


<!--


mspace_name="MSpaceApplet";


mspace_begin(mspace_name,"../../marvin",400,400);





mspace_param("Background.Color","#ffffff");


mspace_param("ShowSurface","Connolly");


mspace_param("ShowSecondaryStructure","Ribbon");


mspace_param("SecondaryStructure.DrawType","Cartoon");





mspace_param("Molecule","http://www.rcsb.org/pdb/files/<%=pdbid%>.pdb");


mspace_end();


//-->


</script>





The applet works fine, but green lines are not working. The background is still black, and I don't get the surface and the second structure.





Did I wrote it in a wrong way?


Thank you in advance.

ChemAxon 909aee4527

25-11-2008 08:16:31

Dear Jamel,





the following code does the trick:


Code:



<head>


   <script LANGUAGE="javascript">


   function showSecondary()


   {


   document.MSpaceApplet.setProperty("ShowSurface","Connolly");


   document.MSpaceApplet.setProperty("ShowSecondaryStructure","Cartoon");


   document.MSpaceApplet.setProperty("Background.Color","#ffffff");


   }


   </script>


</head>





<body>


    <script language="JavaScript" src="../../marvin/marvin.js"></script>


    <script language="JavaScript">


    <!--


    mspace_name="MSpaceApplet";


    mspace_begin(mspace_name,"../../marvin",400,400);


    mspace_param("Molecule","http://www.rcsb.org/pdb/files/<%=pdbid%>.pdb");


    mspace_end();


    //-->


    </script>





   <script>


   showSecondary();


   </script>


</body>











Here is a similar temporary test applet in use: http://www.chemaxon.com/marvin/examples/applets/space/test.html





Kind regards,


Judit

User dfd663fd5c

25-11-2008 08:46:01

Thank you Judit for this quick and helpful reply.


Actually, I saw the applet examples but I was thinking that we can run modification on the mspace applet without any javascript code (like mview_param)


:)

User 111f46f5ab

05-02-2009 01:11:06

I am trying to get the MSpace applet to display a small molecule structure that has explicit hydrogens with the hydrogens visible.  It always comes up with the hydrogens hidden.





I have tried setting up a javascript function similar to the one you described for Jamel to tell MSpace to show the hydrogens:











Quote:



<html>


<head>


<title>University of Manitoba Department of Chemistry: CHEM 2220 Diels-Alder Animation</title>


  


<link href="../222style.css" rel="Stylesheet" type="text/css">


  


<script LANGUAGE="JavaScript" SRC="../marvin/marvin.js"></script>


  


<script LANGUAGE="JavaScript">


   function showHydrogens()


   {


   document.MSpaceApplet.setProperty("Ligand.Hydrogens","true")


   }


   </script>


</head>


<body>


<h5>The University of Manitoba Department of Chemistry</h5>


<h5>CHEM 2220: Introductory Organic Chemistry II - Reactivity and Synthesis</h5>


<h1>The Diels-Alder Cycloaddition Transition State</h1>


<table align=center width="800" border="0" cellpadding="2">


 


<tr>


   


<td width=200>


<p>In the box at the right, you can see the transition state for the


        reaction of <i>E</i>,<i>E</i>-2,4-hexadiene with acrylonitrile.  Notice that the dienophile is approaching the diene in an endo orientation.</p>


  


<p>For a short discussion of the Diels-Alder reaction, <a href="The_Diels-Alder_Reaction.pdf">click here</a>.</p>


    </td>


   


<td width=600>


<script LANGUAGE="JavaScript">


<!--


mspace_name="MSpaceApplet"; // naming the applet to allow JavaScript calls


mspace_begin(mspace_name,"../marvin", 600, 600); // arguments: NAME, CODEBASE, WIDTH, HEIGHT


mspace_param("progressbar","true");


mspace_param("selectionpanel","false");


mspace_param("menubar","true");


mspace_param("molecule","http://umanitoba.ca/chemistry/courses/chem222/support/Diels-Alder_TS.mrv");


mspace_end();


//-->


</script>


<script>


   showHydrogens();


</script>


 


</tr>


</table>


<hr>


<p><a href="../support_stuff.html">Return to CHEM 2220 &quot;Useful Material&quot;


  page.</a></p>


</body>


</html>





However, when I load this page from our server it always hangs the browser after loading the page titles and before showing any of the other text or the MSpace window.  I have to kill the browser using the Task Manager.





What is wrong here?





Phil Hultin

ChemAxon 909aee4527

05-02-2009 10:55:53

Dear Phil,





we have tried the same code, and it works flawlessly on our server.


Does this also happen with a more basic example anyway?





Please open the Java Console from your browser (for example Tools>Java Console with Firefox), and visit the page on your server. Probably an error message will appear.





If not, then please press '3' in the console window before visiting the page, and you will see: Trace level set to 3: basic, net, security ... completed.





After that let's hope you'll be able to copy the appearing text before shutting down the browser :)





We are awaiting the result. Please also give us Java, Browser and System information.





Kind regards,


Judit

User 111f46f5ab

05-02-2009 15:16:25

I am using IE version 7.0.5730.13 under WindowsXP SP3.





When I first saw the problem I had Java Standard Edition 6 build 1.6.0_07-b06.  I did not get an error message.  The browser appears to be hung up waiting for something.  The console trace does not show anything at all.  It just sits there.





After your reply I went around our department and tried to load the page on other machines.  Another windows box with IE (Java version unknown) gave the same behaviour.  A Mac using Firefox also hung up like this, but the same Mac using Safari loaded the page properly.  Finally, I tried another Windows machine with Firefox and it loaded the page correctly, but the owner of the machine told me he had just installed the very latest Java.





So I went back to my computer and updated the Java to version 1.6.0.11-b03.  Now, I get slightly different behaviour on IE7.  The page loads and displays the applet (but not the hydrogens) and IE7 reports a Java error:





Line 9, character 4 Object does not support this property or method.





Line 9 character 4 is the beginning of the word "document", where we define the function to pass the display property to the applet.





The Java console appears to report perfectly normal execution - there are no errors reported there anyhow.





The URL for the page on our server is http://umanitoba.ca/chemistry/courses/chem222/Support/DielsAlderTSMarvin3.html





Thanks for your help.





Phil Hultin

ChemAxon 909aee4527

06-02-2009 09:23:07

The difference from our applet code is that we put the following line in the HTML body part instead of the head:











Code:



<script LANGUAGE="JavaScript" SRC="../marvin/marvin.js"></script>














I'm not sure if this can cause a problem though.





I could also suggest to remove the home_dir/chemaxon/lib/jogl-1.1.0-rc2 directory completely and try to load the page again.





We will test your page in the meanwhile on different machines here and come back soon.

User 111f46f5ab

06-02-2009 15:02:17

Judit: the problem is not solved by moving the call to marvin.js out of the head.  I have generally put this call in the head in other documents and had not problems.





I have done some debugging tests.  The problem focuses on the statement





Code:
document.MSpaceApplet.setProperty()






This is where it ALWAYS throws the "object does not support this property or method" error.





As far as I can see, either the name MSpaceApplet is NOT being recognized as a valid applet in this document OR the method "setProperty" is not being accepted as a valid method of this object.  I have changed the function so that I pass an explicit variable that contains the applet name:   





Code:
function showHydrogens(appName){


   alert('appName ='+appName+' mspace_name = '+mspace_name);


   document.applets[appName].setProperty("Ligand.Hydrogens","true");


   }








and this also throws the same error even though the "alert" tells me that the variable appName contains the string "MSpaceApplet".





When I change the function so that it refers to the applet by its number, the same problem arises:





Code:
document.applets[0].setProperty()






likewise does not work.





Finally, when I put an alert box into the function to see what the variable "mspace_name" contains, but do not pass anything explicitly, the result is NULL unless the function call in the main body of the HTML is BEFORE the mspace_end(); statement.  So, the following code returns a null string in the alert box:





Code:



   function showHydrogens(){


   alert('mspace_name = '+mspace_name);


   document.applets[mspace_name].setProperty("Ligand.Hydrogens","true");


   }


mspace_name = "MSpaceApplet"; // naming the applet to allow JavaScript calls


mspace_begin(mspace_name,"../marvin", 600, 600); // arguments: NAME, CODEBASE, WIDTH, HEIGHT


mspace_param("progressbar","true");


mspace_param("selectionpanel","false");


mspace_param("menubar","true");


mspace_param("molecule","[url=http://umanitoba.ca/chemistry/courses/chem222/support/Diels-Alder_TS.mrv]http://umanitoba.ca/chemistry/courses/chem222/support/Diels-Alder_TS.mrv[/url]");





mspace_end();





showHydrogens();











But if I move the showHydrogens(); statement to the line before mspace_end();, then the alert box returns the string "MSpaceApplet".





What do you make of this?

ChemAxon 909aee4527

09-02-2009 14:18:59

Dear Phil,





thank you for the thorough tests!





We managed to reproduce the problem, and it is present with our public examples too, for example: http://www.chemaxon.com/marvin/examples/applets/space/secondary.html





Strangely, using a form makes it work, see the options of this example: http://www.chemaxon.com/marvin/examples/applets/space/drawtypes.html





We need some more time to investigate it.

User 111f46f5ab

09-02-2009 14:53:13

Good to hear you have found the same problem - I was beginning to wonder what was so strange about our system that we would have a problem nobody else could reproduce ;-).





With all this fuss about getting a structure to display hydrogens, one thing occurs to me.  It is evident that the development of Marvin is being driven by pharma and by biosciences, which is of course understandable.  Thus, your emphasis has been on tools that protein people want.





But as a traditional organic chemist, I have two questions about the choices you have made:Philosophically I have a problem when a program for displaying experimental data will only show the data in an unedited form when you select an "option". (admittedly, protons are not precisely "experimental data" if the structure comes from X-ray diffraction - and computational results are not precisely "experimental" either if it comes to that!)





As a teacher, I don't want to have to explain to students why they have to look under the "ligand" DrawType to set up changes to the molecules they are studying.  They are not interested in a discussion of organic chemistry as it relates to chemical biology in order to remember why "ligand" means "small organic molecule", and they are very likely to just skip using Marvin altogether if they don't find what they need easily.





Just a thought...





P.

ChemAxon efa1591b5a

11-02-2009 11:13:32

Hi Phil,





Regarding your questions...





1. What else than atoms present in the structure file are displayed in marvinspace? I'm afraid I don't quite understand your comment about experimental data. Could you elaborate this topic please?





2. If the structure has a proper name in the structure file (either in mol2, mol, sdf, mrv etc) then that name is displayed in the selection panel on the right hand side. The name 'ligand' is used only when no explicit name is available. I admit, that the Ligand menu item in the Display pull down menu can be confusing  when working with small molecules and not complexes.





However, your students can use the selection panel: right click on the small molecule's name and a pop up menu appears, in which there is a Properties->Draw type submenu. Does this help at all?





Thank you very much for your useful comments. We will work on the technical problems you encountered.





Kind regards,


Miklos

User 111f46f5ab

11-02-2009 14:53:12

I was simply noting that it appears that the default behaviour for MSpace is NOT to show hydrogens even when they are explicitly present in the structure file.





I know that protein people tend not to want to clutter up their structures with hydrogens which after all are only implied but not directly detected in x-ray structures.  But if the hydrogens are explicitly coded in the structure file, why does MSpace not show them by default?  Why do I have to go in to the DrawType menu at all to get them displayed?





This whole line of inquiry about writing code to get MSpace to show hydrogens arose because I was getting only the "heavy atoms" when loading a structure file.  But I do think that if the H atoms are present they should be displayed and the option should be to NOT display them rather than vice versa.





P.

ChemAxon efa1591b5a

17-02-2009 14:33:06

Right, I see now what you mean.





Ok. will change the default behaviour of mspace: if hydrogen atoms are present in the input file then those are displayed by default. Is that o.k.?














Best





Miklos

User 111f46f5ab

17-02-2009 15:06:21

Great.  That is perfect and I think it makes a lot of sense.