From: A. H. <ang...@ua...> - 2011-09-15 22:27:12
|
Daniel, try this example http://biomodel.uah.es/Jmol/test-callbacks.htm |
From: Daniel C. <dan...@gm...> - 2011-09-16 09:22:52
|
Hi Angel, I'm trying but cannot make it work... I'm on php so there might be a quote problem somewhere... I get the error: testpage3.php:14Uncaught SyntaxError: Unexpected token ILLEGAL Please check again http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php which I have updated. Thanks! <http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php> El 16 de septiembre de 2011 00:37, Angel Herráez <ang...@ua...>escribió: > Daniel, try this example > > http://biomodel.uah.es/Jmol/test-callbacks.htm > > > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: A. H. <ang...@ua...> - 2011-09-16 09:29:30
|
Check your code: Error: unterminated string literal Archivo de origen: http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php Línea: 14, columna: 9 Código fuente: var t = " |
From: Daniel C. <dan...@gm...> - 2011-09-16 10:06:13
|
Ah ok I got the error and it is working now, thanks Angel! So I understand more or less what loadStructCallback and messageCallback, but I don't see what hoverCallback does... and how should I get messages for the residues selected using the checkboxes I put, also messages for the distances measures with the checkboxes on the right, and for the surfaces rendered? I start to understand how this works, but I'm still quite lost... Thanks again! Daniel El 16 de septiembre de 2011 11:27, Angel Herráez <ang...@ua...>escribió: > Check your code: > > Error: unterminated string literal > Archivo de origen: http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php > Línea: 14, columna: 9 > Código fuente: > var t = " > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > http://p.sf.net/sfu/rim-devcon-copy2 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: A. H. <ang...@ua...> - 2011-09-16 10:14:14
|
You have to read the documentation for callbacks, both in Jmol.js and in the scripting doc. And part may not be fully documented, so you have to test. Measurements are output as messages, so they are there already; you may need to parse the messages for a more descriptive output. Hover is an example, maybe you don't want it. |
From: Daniel C. <dan...@gm...> - 2011-09-16 12:05:20
|
I have read the documentation and have played around but can only get the information of the measurements with MeasureCallback; I don't seem to be able to get the information of residues selected and surfaces rendered... the only thing that can give me some information about that is when I use ScriptCallback along with *set debugScript TRUE, but it would require substantial parsing... is there any easier way?* El 16 de septiembre de 2011 12:12, Angel Herráez <ang...@ua...>escribió: > You have to read the documentation for callbacks, both in Jmol.js and > in the scripting doc. > And part may not be fully documented, so you have to test. > > Measurements are output as messages, so they are there already; you > may need to parse the messages for a more descriptive output. > > Hover is an example, maybe you don't want it. > > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > http://p.sf.net/sfu/rim-devcon-copy2 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: Daniel C. <dan...@gm...> - 2011-09-19 16:52:52
|
So is ScriptCallback the correct way to get the information of the residues selected and the surfaces rendered? 2011/9/16 Daniel Carbajo <dan...@gm...> > I have read the documentation and have played around but can only get the > information of the measurements with MeasureCallback; I don't seem to be > able to get the information of residues selected and surfaces rendered... > the only thing that can give me some information about that is when I use ScriptCallback > along with *set debugScript TRUE, but it would require substantial > parsing... is there any easier way?* > > El 16 de septiembre de 2011 12:12, Angel Herráez <ang...@ua...>escribió: > > You have to read the documentation for callbacks, both in Jmol.js and >> in the scripting doc. >> And part may not be fully documented, so you have to test. >> >> Measurements are output as messages, so they are there already; you >> may need to parse the messages for a more descriptive output. >> >> Hover is an example, maybe you don't want it. >> >> >> >> >> ------------------------------------------------------------------------------ >> BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> http://p.sf.net/sfu/rim-devcon-copy2 >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> > > |
From: A. H. <ang...@ua...> - 2011-09-19 17:13:23
|
> So is ScriptCallback the correct way to get the information of the > residues selected and the surfaces rendered? I'm not sure. Haven't tested this thoroughly. |
From: Paul P. <pau...@ac...> - 2011-09-19 18:08:40
|
To know which residues are selected, you should send the script command "show residue" or "show sequence" and parse the response. Le 19 sept. 2011 à 19:11, Angel Herráez a écrit : >> So is ScriptCallback the correct way to get the information of the >> residues selected and the surfaces rendered? > > I'm not sure. Haven't tested this thoroughly. > > > > ------------------------------------------------------------------------------ > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > Learn about the latest advances in developing for the > BlackBerry® mobile platform with sessions, labs & more. > See new tools and technologies. Register for BlackBerry® DevCon today! > http://p.sf.net/sfu/rim-devcon-copy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users |
From: Daniel C. <dan...@gm...> - 2011-09-20 09:08:46
|
Could you provide an example of that Paul? 2011/9/19 Paul Pillot <pau...@ac...> > To know which residues are selected, you should send the script command > "show residue" or "show sequence" and parse the response. > > Le 19 sept. 2011 à 19:11, Angel Herráez a écrit : > > >> So is ScriptCallback the correct way to get the information of the > >> residues selected and the surfaces rendered? > > > > I'm not sure. Haven't tested this thoroughly. > > > > > > > > > ------------------------------------------------------------------------------ > > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > > Learn about the latest advances in developing for the > > BlackBerry® mobile platform with sessions, labs & more. > > See new tools and technologies. Register for BlackBerry® DevCon > today! > > http://p.sf.net/sfu/rim-devcon-copy1 > > _______________________________________________ > > Jmol-users mailing list > > Jmo...@li... > > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: Paul P. <pau...@ac...> - 2011-09-20 09:56:17
|
I have a working example at the following page : http://librairiedemolecules.education.fr/outils/webapp_libmol/ Once the application is loaded, search for a random structure in the text slot (for example "globine") The structure will load and a new tab called "Séquence" should appear on top of the right panel. If you click on that tab, you'll see the sequences of all the chains with all the currently selected residues highlighted. You can click on whichever residue (or chain) you'd like to deselect or re-select it. In fact, each time this sequence widget is used, show residue commands are issued in order to update the display of the current selection in the sequences. (This widget also has an other interesting feature : it highlights in Jmol, the residue currently hovered on the sequence display. ) You can have access to the source code by rightclicking. I can't remember how I did the parsing of the currently selected residues ?! Maybe the following command would suit your needs : it gives an array with references to the currently selected residues : jmolScriptWaitAsArray("show residue")[0][0][3].split("|") Le 20 sept. 2011 à 11:08, Daniel Carbajo a écrit : > Could you provide an example of that Paul? > > 2011/9/19 Paul Pillot <pau...@ac...> > To know which residues are selected, you should send the script command "show residue" or "show sequence" and parse the response. > > Le 19 sept. 2011 à 19:11, Angel Herráez a écrit : > > >> So is ScriptCallback the correct way to get the information of the > >> residues selected and the surfaces rendered? > > > > I'm not sure. Haven't tested this thoroughly. > > > > > > > > ------------------------------------------------------------------------------ > > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA > > Learn about the latest advances in developing for the > > BlackBerry® mobile platform with sessions, labs & more. > > See new tools and technologies. Register for BlackBerry® DevCon today! > > http://p.sf.net/sfu/rim-devcon-copy1 > > _______________________________________________ > > Jmol-users mailing list > > Jmo...@li... > > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users |
From: Daniel C. <dan...@gm...> - 2011-09-20 10:26:41
|
Hi Paul thanks and compliments on your page! After having a look at the source code I am trying the following (which does not work): javascript function: function msgFn() { var x = jmolScriptWait('print script("show residue")'); var t = '\n' + document.getElementById('msg').value; document.getElementById('msg').value = x + t; } as initializing the applet: jmolSetCallback("MeasureCallback","distFn"); html: <textarea autocomplete="off" id="msg" cols="48" rows="6" wrap="off" style="resize:none;"></textarea> Am I on the right path? What could be failing? I would also like to include the temperature factor of the residue's C-alpha... any clue? Thanks a lot! Daniel 2011/9/20 Paul Pillot <pau...@ac...> > I have a working example at the following page : > http://librairiedemolecules.education.fr/outils/webapp_libmol/ > Once the application is loaded, search for a random structure in the text > slot (for example "globine") > The structure will load and a new tab called "Séquence" should appear on > top of the right panel. If you click on that tab, you'll see the sequences > of all the chains with all the currently selected residues highlighted. You > can click on whichever residue (or chain) you'd like to deselect or > re-select it. > In fact, each time this sequence widget is used, show residue commands are > issued in order to update the display of the current selection in the > sequences. > (This widget also has an other interesting feature : it highlights in Jmol, > the residue currently hovered on the sequence display. ) > You can have access to the source code by rightclicking. > I can't remember how I did the parsing of the currently selected residues > ?! > Maybe the following command would suit your needs : it gives an array with > references to the currently selected residues : jmolScriptWaitAsArray("show > residue")[0][0][3].split("|") > > Le 20 sept. 2011 à 11:08, Daniel Carbajo a écrit : > > Could you provide an example of that Paul? > > 2011/9/19 Paul Pillot <pau...@ac...> > >> To know which residues are selected, you should send the script command >> "show residue" or "show sequence" and parse the response. >> >> Le 19 sept. 2011 à 19:11, Angel Herráez a écrit : >> >> >> So is ScriptCallback the correct way to get the information of the >> >> residues selected and the surfaces rendered? >> > >> > I'm not sure. Haven't tested this thoroughly. >> > >> > >> > >> > >> ------------------------------------------------------------------------------ >> > BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA >> > Learn about the latest advances in developing for the >> > BlackBerry® mobile platform with sessions, labs & more. >> > See new tools and technologies. Register for BlackBerry® DevCon >> today! >> > http://p.sf.net/sfu/rim-devcon-copy1 >> > _______________________________________________ >> > Jmol-users mailing list >> > Jmo...@li... >> > https://lists.sourceforge.net/lists/listinfo/jmol-users >> >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > > http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > |
From: Paul P. <pau...@ac...> - 2011-09-20 11:31:22
|
Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit : > I am trying the following (which does not work): > > javascript function: > function msgFn() { > var x = jmolScriptWait('print script("show residue")'); > var t = '\n' + document.getElementById('msg').value; > document.getElementById('msg').value = x + t; > } > > > as initializing the applet: > jmolSetCallback("MeasureCallback","distFn"); > There is something weird here : you trigger the distFn() function when user make a measure. But you've defined au msgFn() function. So it can't be triggered by the measure Callback. You have to be clear about when you want to update the selected residues list. Is it when a user makes a measure ? is it when the user clicks on a link or a button ? You can also use your browser to debug your javascript to see if your functions work as expected. For example, you can open the javascript console and type in : msgFn() you'll see if the list of residues is correctly displayed. > I would also like to include the temperature factor of the residue's C-alpha... any clue? Just a clue... print {6}.temperature will provide you with the mean temperature factor for all residues numbered 6. There is a way to get the list for each residue but I haven't done that for a while and I can't remember what the proper syntax is. |
From: Daniel C. <dan...@gm...> - 2011-09-20 11:47:28
|
Ops sorry I copied the wrong line, it is: jmolSetCallback("MessageCallback","msgFn"); Which does not work either... So I want that the selected residue appears when I click on a jmol checkbox. Please check my example page: http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php 2011/9/20 Paul Pillot <pau...@ac...> > > Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit : > > > I am trying the following (which does not work): > > > > javascript function: > > function msgFn() { > > var x = jmolScriptWait('print script("show residue")'); > > var t = '\n' + document.getElementById('msg').value; > > document.getElementById('msg').value = x + t; > > } > > > > > > as initializing the applet: > > jmolSetCallback("MeasureCallback","distFn"); > > > There is something weird here : you trigger the distFn() function when user > make a measure. But you've defined au msgFn() function. So it can't be > triggered by the measure Callback. > You have to be clear about when you want to update the selected residues > list. Is it when a user makes a measure ? is it when the user clicks on a > link or a button ? > > You can also use your browser to debug your javascript to see if your > functions work as expected. For example, you can open the javascript console > and type in : msgFn() > you'll see if the list of residues is correctly displayed. > > > I would also like to include the temperature factor of the residue's > C-alpha... any clue? > Just a clue... print {6}.temperature will provide you with the mean > temperature factor for all residues numbered 6. There is a way to get the > list for each residue but I haven't done that for a while and I can't > remember what the proper syntax is. > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: Paul P. <pau...@ac...> - 2011-09-20 12:12:43
|
You probably don't need any messagecallback here. You can reflace your Jmol checkbox by any html object (a link for example) and attach to it an onclick event that would trigger your msgFn() function : <a href="#" onclick="msgFn()">Click me !</a> function msgFn() { var x = jmolScriptWaitAsArray("show residue")[0][0][3] document.getElementById('msg').value = x +"\n" + document.getElementById('msg').value; } Le 20 sept. 2011 à 13:47, Daniel Carbajo a écrit : > Ops sorry I copied the wrong line, it is: > jmolSetCallback("MessageCallback","msgFn"); > Which does not work either... So I want that the selected residue appears when I click on a jmol checkbox. Please check my example page: > http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php > > 2011/9/20 Paul Pillot <pau...@ac...> > > Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit : > > > I am trying the following (which does not work): > > > > javascript function: > > function msgFn() { > > var x = jmolScriptWait('print script("show residue")'); > > var t = '\n' + document.getElementById('msg').value; > > document.getElementById('msg').value = x + t; > > } > > > > > > as initializing the applet: > > jmolSetCallback("MeasureCallback","distFn"); > > > There is something weird here : you trigger the distFn() function when user make a measure. But you've defined au msgFn() function. So it can't be triggered by the measure Callback. > You have to be clear about when you want to update the selected residues list. Is it when a user makes a measure ? is it when the user clicks on a link or a button ? > > You can also use your browser to debug your javascript to see if your functions work as expected. For example, you can open the javascript console and type in : msgFn() > you'll see if the list of residues is correctly displayed. > > > I would also like to include the temperature factor of the residue's C-alpha... any clue? > Just a clue... print {6}.temperature will provide you with the mean temperature factor for all residues numbered 6. There is a way to get the list for each residue but I haven't done that for a while and I can't remember what the proper syntax is. > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users |
From: Daniel C. <dan...@gm...> - 2011-09-20 12:27:35
|
Ah ok, so while I try it let me ask you just one more thing... I label the residues using a complex function called "colorLabel" inside a file called myJMOLfunctions.spt, that you can access at: http://bl210.caspur.it/MODEL-DB/TEST/Jmol-12new/myJMOLfunctions.spt I am thinking that the easiest way would be to make the same label appear in the textbox by adding something similar to the following (after line 122 of the spt file): var textbox = "NAT - " + info + " %m_%c_%r " + desc + ":" + larcav var t = '\n' + document.getElementById('msg').value document.getElementById('msg').value = textbox + t Can I do that in a Jmol function? I guess not, right? If there is a way to do show it would be the easiest... 2011/9/20 Paul Pillot <pau...@ac...> > You probably don't need any messagecallback here. You can reflace your Jmol > checkbox by any html object (a link for example) and attach to it an onclick > event that would trigger your msgFn() function : > > <a href="#" onclick="msgFn()">Click me !</a> > > function msgFn() { > var x = jmolScriptWaitAsArray("show residue")[0][0][3] > document.getElementById('msg').value = x +"\n" + > document.getElementById('msg').value; > } > > Le 20 sept. 2011 à 13:47, Daniel Carbajo a écrit : > > Ops sorry I copied the wrong line, it is: > jmolSetCallback("MessageCallback","msgFn"); > Which does not work either... So I want that the selected residue appears > when I click on a jmol checkbox. Please check my example page: > http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php > > 2011/9/20 Paul Pillot <pau...@ac...> > >> >> Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit : >> >> > I am trying the following (which does not work): >> > >> > javascript function: >> > function msgFn() { >> > var x = jmolScriptWait('print script("show residue")'); >> > var t = '\n' + document.getElementById('msg').value; >> > document.getElementById('msg').value = x + t; >> > } >> > >> > >> > as initializing the applet: >> > jmolSetCallback("MeasureCallback","distFn"); >> > >> There is something weird here : you trigger the distFn() function when >> user make a measure. But you've defined au msgFn() function. So it can't be >> triggered by the measure Callback. >> You have to be clear about when you want to update the selected residues >> list. Is it when a user makes a measure ? is it when the user clicks on a >> link or a button ? >> >> You can also use your browser to debug your javascript to see if your >> functions work as expected. For example, you can open the javascript console >> and type in : msgFn() >> you'll see if the list of residues is correctly displayed. >> >> > I would also like to include the temperature factor of the residue's >> C-alpha... any clue? >> Just a clue... print {6}.temperature will provide you with the mean >> temperature factor for all residues numbered 6. There is a way to get the >> list for each residue but I haven't done that for a while and I can't >> remember what the proper syntax is. >> >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > > http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > |
From: Daniel C. <dan...@gm...> - 2011-09-21 09:09:49
|
Hello again everyone, I have already succeeded with all this except with one little thing where I need your advice... when I select a residue, a label appears on its C-alpha, and I want the same label to appear in the textbox. I highlight selected residues and write the labels via a function called colorLabel I execute like this from in php: '<script>jmolCheckbox("colorLabel(\'NAT\',\''.$prefix.'\',\'manual\',\''.$select_nat.'\',\'ONE\')", "DELcolorLabel(\'NAT\',\''.$select_nat.'\',\'ONE\')", "native");</script></td>'; So I have tried the following to get the label inside the textbox with no success: When initializing the applet: jmolSetCallback("MessageCallback","msgFn"); Javascript function: function msgFn() { var x = []; for (var i=0;i<arguments.length;i++) { x[i] = "" + arguments[i]; } var i = x[2].indexOf("colorLabel"); if (i!=-1){ var label = jmolEvaluate('select 2:A.CA and 1.1; var at={selected}; at.label'); var t = '\n' + document.getElementById('msg').value; document.getElementById('msg').value = label + t; } } But I only get "ERROR" inside the text box... How should it be? Thanks again! Daniel 2011/9/20 Daniel Carbajo <dan...@gm...> > Ah ok, so while I try it let me ask you just one more thing... I label the > residues using a complex function called "colorLabel" inside a file called > myJMOLfunctions.spt, that you can access at: > http://bl210.caspur.it/MODEL-DB/TEST/Jmol-12new/myJMOLfunctions.spt > I am thinking that the easiest way would be to make the same label appear > in the textbox by adding something similar to the following (after line 122 > of the spt file): > var textbox = "NAT - " + info + " %m_%c_%r " + desc + ":" + larcav > var t = '\n' + document.getElementById('msg').value > document.getElementById('msg').value = textbox + t > > Can I do that in a Jmol function? I guess not, right? If there is a way to > do show it would be the easiest... > > > > > 2011/9/20 Paul Pillot <pau...@ac...> > >> You probably don't need any messagecallback here. You can reflace your >> Jmol checkbox by any html object (a link for example) and attach to it an >> onclick event that would trigger your msgFn() function : >> >> <a href="#" onclick="msgFn()">Click me !</a> >> >> function msgFn() { >> var x = jmolScriptWaitAsArray("show residue")[0][0][3] >> document.getElementById('msg').value = x +"\n" + >> document.getElementById('msg').value; >> } >> >> Le 20 sept. 2011 à 13:47, Daniel Carbajo a écrit : >> >> Ops sorry I copied the wrong line, it is: >> jmolSetCallback("MessageCallback","msgFn"); >> Which does not work either... So I want that the selected residue appears >> when I click on a jmol checkbox. Please check my example page: >> http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php >> >> 2011/9/20 Paul Pillot <pau...@ac...> >> >>> >>> Le 20 sept. 2011 à 12:26, Daniel Carbajo a écrit : >>> >>> > I am trying the following (which does not work): >>> > >>> > javascript function: >>> > function msgFn() { >>> > var x = jmolScriptWait('print script("show residue")'); >>> > var t = '\n' + document.getElementById('msg').value; >>> > document.getElementById('msg').value = x + t; >>> > } >>> > >>> > >>> > as initializing the applet: >>> > jmolSetCallback("MeasureCallback","distFn"); >>> > >>> There is something weird here : you trigger the distFn() function when >>> user make a measure. But you've defined au msgFn() function. So it can't be >>> triggered by the measure Callback. >>> You have to be clear about when you want to update the selected residues >>> list. Is it when a user makes a measure ? is it when the user clicks on a >>> link or a button ? >>> >>> You can also use your browser to debug your javascript to see if your >>> functions work as expected. For example, you can open the javascript console >>> and type in : msgFn() >>> you'll see if the list of residues is correctly displayed. >>> >>> > I would also like to include the temperature factor of the residue's >>> C-alpha... any clue? >>> Just a clue... print {6}.temperature will provide you with the mean >>> temperature factor for all residues numbered 6. There is a way to get the >>> list for each residue but I haven't done that for a while and I can't >>> remember what the proper syntax is. >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> All the data continuously generated in your IT infrastructure contains a >>> definitive record of customers, application performance, security >>> threats, fraudulent activity and more. Splunk takes this data and makes >>> sense of it. Business sense. IT sense. Common sense. >>> http://p.sf.net/sfu/splunk-d2dcopy1 >>> _______________________________________________ >>> Jmol-users mailing list >>> Jmo...@li... >>> https://lists.sourceforge.net/lists/listinfo/jmol-users >>> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> >> http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> >> > |
From: A. H. <ang...@ua...> - 2011-09-21 09:31:06
|
Hello Daniel > Hello again everyone, I have already succeeded with all this Glad to know. You just need to persevere :) > when I select a > residue, a label appears on its C-alpha A label appears.... You mean you make it appear beciause you have scripted that label, right? So add another action to that function. > and I want the same label to > appear in the textbox. I highlight selected residues and write the > labels via a function called colorLabel I execute like this from in > php: > '<script>jmolCheckbox("colorLabel(\'NAT\',\''.$prefix.'\',\'manual\',\ > ''.$select_nat.'\',\'ONE\')", > "DELcolorLabel(\'NAT\',\''.$select_nat.'\',\'ONE\')", > "native");</script></td>'; I don't see there how you add the label. > var i = x[2].indexOf("colorLabel"); But I would not expect "colorLabel" to be a part of Jmol script, so it is not in the message reported. > if (i!=-1){ > var label = jmolEvaluate('select 2:A.CA and 1.1; var at={selected}; > at.label'); Two ideas here: 1. you are not getting the label. Maybe use "show at.label" or "print at.label" 2. it is likely that at is an atom set, so an array, not a single atom (even if it's formed by just one atom). So, at.label is not defined. Maybe "at[0].label". Anyway, you can first test that script in the console and it will be easier to see the errors. Say, you select manually or by a command at the console, then try your command select 2:A.CA and 1.1; var at={selected}; print at.label; print at[0].label; #whatever Hey!... "at" is a reserved word in JmolScript (meaning adenosine or thymidine). Use another name just to be safe. Maybe that's all and you don't need my other advice |
From: Daniel C. <dan...@gm...> - 2011-09-21 09:49:15
|
Hi Angel thanks for the fast response, I label the C-alpha atom of the residue selected with my function colorLabel, that you can access at: http://bl210.caspur.it/MODEL-DB/TEST/Jmol-12new/myJMOLfunctions.spt And actually the line I write in php "colorLabel('NAT','CAV','manual','2:A','ONE')" appears as a message (but not the output of that line, which is what I want)... So I try the following in the console with an error: select 2:A.CA and 1.1 ----> 1 átomos seleccionados catom={selected} show catom ----> catom = ({9}) show catom.label ----> ERROR en guión: el número de argumentos no es correcto ---- show catom . >> label << show catom[0].label ---> ERROR en guión: el número de argumentos no es correcto ---- show catom [ >> 1 << ] . label I do this after the label is present in the applet, which looks like "NAT - manual N_A_2 CAV:2" What is wrong there? ".label" should work, right? I use it in my function colorLabel, line 85, for example... Thanks again for your time Angel, Paul and everyone else, Daniel El 21 de septiembre de 2011 11:29, Angel Herráez <ang...@ua...>escribió: > Hello Daniel > > > > Hello again everyone, I have already succeeded with all this > > Glad to know. You just need to persevere :) > > > > when I select a > > residue, a label appears on its C-alpha > > A label appears.... You mean you make it appear beciause you have > scripted that label, right? So add another action to that function. > > > and I want the same label to > > appear in the textbox. I highlight selected residues and write the > > labels via a function called colorLabel I execute like this from in > > php: > > '<script>jmolCheckbox("colorLabel(\'NAT\',\''.$prefix.'\',\'manual\',\ > > ''.$select_nat.'\',\'ONE\')", > > "DELcolorLabel(\'NAT\',\''.$select_nat.'\',\'ONE\')", > > "native");</script></td>'; > > I don't see there how you add the label. > > > var i = x[2].indexOf("colorLabel"); > > But I would not expect "colorLabel" to be a part of Jmol script, so > it is not in the message reported. > > > if (i!=-1){ > > var label = jmolEvaluate('select 2:A.CA and 1.1; var at={selected}; > > at.label'); > > Two ideas here: > 1. you are not getting the label. Maybe use "show at.label" or "print > at.label" > 2. it is likely that at is an atom set, so an array, not a single > atom (even if it's formed by just one atom). So, at.label is not > defined. Maybe "at[0].label". Anyway, you can first test that script > in the console and it will be easier to see the errors. > Say, you select manually or by a command at the console, then try > your command > > select 2:A.CA and 1.1; > var at={selected}; > print at.label; > print at[0].label; > #whatever > > Hey!... "at" is a reserved word in JmolScript (meaning adenosine or > thymidine). Use another name just to be safe. Maybe that's all and > you don't need my other advice > > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: Daniel C. <dan...@gm...> - 2011-09-21 10:05:16
|
This is strange, now I'm trying in the console "select 2:A.CA and 1.1; catom={selected}; print catom.label" and it works... I get: 1 átomos seleccionados NAT - manual N_A_2 CAV:2 But still this does not work... var label = jmolEvaluate('select 2:A.CA and 1.1; catom={selected}; print catom.label'); 2011/9/21 Daniel Carbajo <dan...@gm...> > Hi Angel thanks for the fast response, I label the C-alpha atom of the > residue selected with my function colorLabel, that you can access at: > http://bl210.caspur.it/MODEL-DB/TEST/Jmol-12new/myJMOLfunctions.spt > And actually the line I write in php > "colorLabel('NAT','CAV','manual','2:A','ONE')" appears as a message (but not > the output of that line, which is what I want)... > So I try the following in the console with an error: > select 2:A.CA and 1.1 ----> 1 átomos seleccionados > catom={selected} > show catom ----> catom = ({9}) > show catom.label ----> > ERROR en guión: el número de argumentos no es correcto > ---- > show catom . >> label << > > show catom[0].label ---> > ERROR en guión: el número de argumentos no es correcto > ---- > show catom [ >> 1 << ] . label > > > I do this after the label is present in the applet, which looks like "NAT - > manual N_A_2 CAV:2" > > What is wrong there? ".label" should work, right? I use it in my function > colorLabel, line 85, for example... > Thanks again for your time Angel, Paul and everyone else, > Daniel > > > El 21 de septiembre de 2011 11:29, Angel Herráez <ang...@ua...>escribió: > > Hello Daniel >> >> >> > Hello again everyone, I have already succeeded with all this >> >> Glad to know. You just need to persevere :) >> >> >> > when I select a >> > residue, a label appears on its C-alpha >> >> A label appears.... You mean you make it appear beciause you have >> scripted that label, right? So add another action to that function. >> >> > and I want the same label to >> > appear in the textbox. I highlight selected residues and write the >> > labels via a function called colorLabel I execute like this from in >> > php: >> > '<script>jmolCheckbox("colorLabel(\'NAT\',\''.$prefix.'\',\'manual\',\ >> > ''.$select_nat.'\',\'ONE\')", >> > "DELcolorLabel(\'NAT\',\''.$select_nat.'\',\'ONE\')", >> > "native");</script></td>'; >> >> I don't see there how you add the label. >> >> > var i = x[2].indexOf("colorLabel"); >> >> But I would not expect "colorLabel" to be a part of Jmol script, so >> it is not in the message reported. >> >> > if (i!=-1){ >> > var label = jmolEvaluate('select 2:A.CA and 1.1; var at={selected}; >> > at.label'); >> >> Two ideas here: >> 1. you are not getting the label. Maybe use "show at.label" or "print >> at.label" >> 2. it is likely that at is an atom set, so an array, not a single >> atom (even if it's formed by just one atom). So, at.label is not >> defined. Maybe "at[0].label". Anyway, you can first test that script >> in the console and it will be easier to see the errors. >> Say, you select manually or by a command at the console, then try >> your command >> >> select 2:A.CA and 1.1; >> var at={selected}; >> print at.label; >> print at[0].label; >> #whatever >> >> Hey!... "at" is a reserved word in JmolScript (meaning adenosine or >> thymidine). Use another name just to be safe. Maybe that's all and >> you don't need my other advice >> >> >> >> >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2dcopy1 >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> > > |
From: A. H. <ang...@ua...> - 2011-09-21 10:57:42
|
> This is strange, now I'm trying in the console "select 2:A.CA and > 1.1; catom={selected}; print catom.label" and it works... Not strange; print works, show does not (for this issue) > But still this does not work... > var label = jmolEvaluate('select 2:A.CA and 1.1; catom={selected}; > print catom.label'); I think that you are misusing jmolEvaluate; probably it is not designed for a sequence of commands. I'm not sure, but maybe jmolScript('select 2:A.CA and 1.1; catom={selected}; var label = jmolEvaluate('catom.label'); (see http://jmol.sourceforge.net/jslibrary/#jmolEvaluate ) |
From: Daniel C. <dan...@gm...> - 2011-09-21 11:53:12
|
So I have tried several things but none of them work... jmolScript('select 2:A.CA <http://a.ca/> and 1.1; catom={selected}; var label = jmolEvaluate('catom.label'); does not work jmolScript('select 2:A.CA <http://a.ca/> and 1.1; catom={selected}; var label = jmolEvaluate('print catom.label'); does not work var label = jmolScript(\'print {2:A.CA/1.1}.label\'); does not work var label = jmolScript(\'{2:A.CA/1.1}.label\'); does not work var label = jmolEvaluate(\'print {2:A.CA/1.1}.label\'); does not work var label = jmolEvaluate(\'{2:A.CA/1.1}.label\'); does not work But on the console "print {2:A.CA/1.1}.label" works ok... El 21 de septiembre de 2011 12:55, Angel Herráez <ang...@ua...>escribió: > > This is strange, now I'm trying in the console "select 2:A.CA and > > 1.1; catom={selected}; print catom.label" and it works... > > Not strange; print works, show does not (for this issue) > > > But still this does not work... > > var label = jmolEvaluate('select 2:A.CA and 1.1; catom={selected}; > > print catom.label'); > > I think that you are misusing jmolEvaluate; probably it is not > designed for a sequence of commands. > > I'm not sure, but maybe > > jmolScript('select 2:A.CA and 1.1; catom={selected}; > > var label = jmolEvaluate('catom.label'); > > (see http://jmol.sourceforge.net/jslibrary/#jmolEvaluate ) > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: A. H. <ang...@ua...> - 2011-09-21 12:43:28
|
There are quote problems in there... jmolScript('select 2:A.CAand 1.1; catom={selected} '); var label = jmolEvaluate('catom.label'); jmolScript('select 2:A.CAand 1.1; catom={selected} '); var label = jmolEvaluate('print catom.label'); > var label = jmolScript(\'print {2:A.CA/1.1}.label\'); I don't think you can assign a jmoScript() to a variable. jmoScript() gets executed, does not return anything. > var label = jmolEvaluate(\'print {2:A.CA/1.1}.label\'); Don't put print there, just evaluate the expression |
From: Daniel C. <dan...@gm...> - 2011-09-21 12:56:00
|
I keep trying all those possibilities but none work... I escape the ' because I have the function inside an echo ' '; call in php... By the way http://bl210.caspur.it/MODEL-DB/TEST/testpage3.php should not need a password now. El 21 de septiembre de 2011 14:41, Angel Herráez <ang...@ua...>escribió: > There are quote problems in there... > > > jmolScript('select 2:A.CAand 1.1; catom={selected} '); > var label = jmolEvaluate('catom.label'); > > jmolScript('select 2:A.CAand 1.1; catom={selected} '); > var label = jmolEvaluate('print catom.label'); > > > var label = jmolScript(\'print {2:A.CA/1.1}.label\'); > I don't think you can assign a jmoScript() to a variable. jmoScript() > gets executed, does not return anything. > > > > var label = jmolEvaluate(\'print {2:A.CA/1.1}.label\'); > > Don't put print there, just evaluate the expression > > > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2dcopy1 > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > |
From: A. H. <ang...@ua...> - 2011-09-21 13:18:29
|
Daniel, I suggest that you do your testing in a simple page. Then move the working code to your development page. This works: jmolScript('select atomno=2; label interesting;'); jmolScript('catom={selected};'); alert(jmolEvaluate('catom.label');); see it at http://biomodel.uah.es/Jmol/test-callbacks.htm |