From: Robert H. <ha...@st...> - 2014-01-15 16:45:12
|
You are almost there. drop the PRINT command part: Jmol.evaluate(jmolApplet, "{atomNo=" + atomNo + "}.label"); or Jmol.evaluate(jmolApplet, "@" + atomNo + ".label"); Note that you can use label() or label("..some format stuff here...") Bob On Wed, Jan 15, 2014 at 3:49 AM, Roberto Mosca <rob...@gm...> wrote: > Thanks Robert, > > but how to you retrieve it then programmatically? The instruction > > Jmol.evaluate(jmolApplet, "print {atomNo=" + atomNo + "}.label"); > > does not work. > > Let me know. > > Best, > Roberto > > > On Wed, Jan 15, 2014 at 6:58 AM, Robert Hanson <ha...@st...> wrote: > >> atom properties are numbers, not strings. You will have to set the atom >> label instead of a property if you want a string. >> >> >> On Tue, Jan 14, 2014 at 1:19 PM, Rolf Huehne <rh...@fl...>wrote: >> >>> On 01/14/2014 06:14 PM, Roberto Mosca wrote: >>> > Dear Alexander and Rolf, >>> > >>> > thanks for your help! I tried the instruction >>> > >>> > Jmol.evaluate(jmolApplet, "print {atomNo=" + atomNo + "}.property_pp"); >>> > >>> > in the following code: >>> > >>> > function pickResidue(jmolObj,msg,atomNo) { >>> > var pp = Jmol.evaluate(jmolApplet, "print {atomNo=" + atomNo + >>> > "}.property_pp"); >>> > } >>> > >>> > >>> > after setting the property with the following script: >>> > >>> > set frank off >>> > delete NOT :A >>> > cartoon ONLY >>> > color [xFADACB] >>> > background hover [xFCD6E2] >>> > color hover [xD60B51] >>> > font hover 12 sanserif >>> > hover %[label] >>> > set hoverDelay 0.01 >>> > select 35; color [xbe1622]; spacefill 70% >>> > set hoverLabel "P35"; >>> > data "property_pp" >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > Q13253_35 >>> > end "property_pp" >>> > >>> > set PickCallback "pickResidue" >>> > >>> > >>> > And the variable pp has the value "ERROR" after executing it. Any idea >>> why >>> > it is so? Or how to debug it? >>> > >>> One problem here will be that you didn't set the 'property_pp' to the >>> correct atom. You would either need "select atomNo=35" or the shortcut >>> "@35". >>> And since you selected only a single atom the 'data' section would >>> presumably only need a single "Q13253_35" line. >>> >>> But there seems to be a more general problem. I wasn't able to assign a >>> string to a property in Jmol 14.0.1, just numbers. >>> >>> After applying the following commands (PDB entry 1OTZ loaded) the result >>> is "PP:35.0": >>> select atomno=35; >>> data "property_pp" >>> test 35 >>> end "property_pp" >>> print "PP:" + {atomNo=35}.property_pp; >>> >>> If "test 35" is replaced with "test_35" the result is "PP:NaN". >>> >>> The result is the same if I try to set the property directly using this >>> command: >>> >>> {atomNo=35}.property_pp = "test 35"; >>> >>> But you should be able to overcome this limitation (or bug?) by storing >>> the hoverlabel in your own global array, e.g.: >>> >>> ----- Jmol script ------ >>> my_labels = []; >>> my_labels[35] = "test 35"; >>> ------------------------ >>> >>> ----- Javascript ------- >>> Jmol.evaluate(jmolApplet, "print my_labels[" + atomNo + "]"); >>> ------------------------ >>> >>> Regards, >>> Rolf >>> -- >>> >>> Rolf Huehne >>> Postdoc >>> >>> Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI) >>> Beutenbergstrasse 11 >>> 07745 Jena, Germany >>> >>> Phone: +49 3641 65 6205 >>> Fax: +49 3641 65 6210 >>> E-Mail: rh...@fl... >>> Website: http://www.fli-leibniz.de >>> >>> Scientific Director: Prof. Dr. K. Lenhard Rudolph >>> Head of Administration: Dr. Daniele Barthel >>> Chairman of Board of Trustees: Dennys Klein >>> >>> VAT No: DE 153 925 464 >>> Register of Associations: No. 230296, Amtsgericht Jena >>> Tax Number: 162/141/08228 >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >>> Learn Why More Businesses Are Choosing CenturyLink Cloud For >>> Critical Workloads, Development Environments & Everything In Between. >>> Get a Quote or Start a Free Trial Today. >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> Jmol-users mailing list >>> Jmo...@li... >>> https://lists.sourceforge.net/lists/listinfo/jmol-users >>> >> >> >> >> -- >> Robert M. Hanson >> Larson-Anderson Professor of Chemistry >> St. Olaf College >> Northfield, MN >> http://www.stolaf.edu/people/hansonr >> >> >> If nature does not answer first what we want, >> it is better to take what answer we get. >> >> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 >> >> >> >> ------------------------------------------------------------------------------ >> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> Learn Why More Businesses Are Choosing CenturyLink Cloud For >> Critical Workloads, Development Environments & Everything In Between. >> Get a Quote or Start a Free Trial Today. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> _______________________________________________ >> Jmol-users mailing list >> Jmo...@li... >> https://lists.sourceforge.net/lists/listinfo/jmol-users >> >> > > > -- > La chiocciol@ > http://lachiocciola.tumblr.com/ > > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > -- Robert M. Hanson Larson-Anderson Professor of Chemistry St. Olaf College Northfield, MN http://www.stolaf.edu/people/hansonr If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 |