first, I would use double quotes in PHP, not single. Makes life a lot
easier:
$content .= "<td><script>
jmolCheckbox(\"myfunction('$residue')\", .......... ";
On Mon, Apr 11, 2011 at 4:52 AM, Daniel Carbajo <daniel.carb...@gmail.com>wrote:
> Apart from the atoms[i].model problem, I always find trouble when passing
> the variables from php to a function...
> If I pass '104:A' like this:
> $content .= '<td><script>
> jmolCheckbox("myfunction(\' '.$residue.' \')", ..........
>
> How can I, inside the function, especify 104:A.ca as a variable that I can
> use in the function? I try this:
>
> function myfunction(res){
> var atoms="{" + res + ".ca}"
> var n = atoms.length
> var fileNameArray = getProperty("modelInfo.models.file")
> for (var i = 1; i <= n; i++) {
> atoms[i].label = "***%M - " + atoms[i].model + " - lig bin res
> %n_%c_%r temperature=%b"
> }
> }
>
> But this obviously does not work... so which should be the correct way to
> define "atoms" (104:A.ca) out of "res" (104:A)? Thanks!
> Daniel
>
>
>
If you really need to do that, you have to use script inline or select:
var atoms = "" + res + ".ca"
script inline "atoms = {" + atoms + "}"
# now atoms is that set of atoms
or select can take a string as a variable:
select @{"" + res + ".ca"}
var atoms = {selected}
>
>
>
>
>
>
>
> 2011/4/8 Daniel Carbajo <daniel.carb...@gmail.com>
>
>> I am close to it but a strange things happens; I apply this on console
>> when I have 3 proteins loaded (the native structure plus two homology
>> models):
>> var natmod = "MOD"
>> var desc = "SS"
>> var atoms = {104:A.ca}
>> var info = "lig bin res"
>>
>> var fileNameArray = getProperty("modelInfo.models.file")
>> var n = atoms.length
>> if (desc == "SS"){
>> var sarray = ["H","B","E","G","I","T","S","U"]
>> for (var i = 1; i <= n; i++) {
>> atoms[i].label = "***%M - " + atoms[i].model + " - " + info +
>> " %n_%c_%r " + desc + ":" + sarray[atoms[i].temperature]
>>
>> }
>> }
>> else{
>> for (var i = 1; i <= n; i++) {
>> atoms[i].label = "***%M - " + atoms[i].model + " - " + info +
>> " %n_%c_%r " + desc + ":%b"
>>
>> }
>> }
>> font label 14 serif bold
>> color label black
>>
>>
>> So I get correclty 3 atoms labeled, but atoms[i].model turns out to be 1
>> in all three situations, I get the following labels:
>>
>> ***1.1 - 1 - lig bin res PHE_A_104 SS:H
>> ***2.1 - 1 - lig bin res PHE_A_104 SS:H
>> ***3.1 - 1 - lig bin res PHE_A_104 SS:H
>>
>> And so when I extract the file name I get always the same... (by the way:
>> can I parse the file name removing everything before the last "/" and the
>> ".pdb" at the end?). What am I doing wrong? I do not get it...
>> Thanks!
>>
>
>
>
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107
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
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users