So I already solved everything! the final function looks like this:
function crossMeasure(atomListN, atomListM){
var lf = _lastframe
var sp = lf.split(".")
var n = sp[1]
if (n>1){
set measurementUnits angstroms
set measurements 3
font measure 16 serif bold
for (var i = 2; i <= n; i++) {
script inline @{"measure @{{" + atomListN + ".ca/1.1}} @{{" +
atomListM + ".ca/" + i + ".1}}"}
var modelfile=getProperty("modelInfo.models.file")[i]
var spfile = modelfile.split("/")
var modelname = spfile[spfile.length]
var spname = modelname.split("-")
var modelnum = spname[2]
var j = i-1
prompt "DISTANCE " + j + " --> " +
getProperty("measurementinfo[" + j + "].strMeasurement") + "\n\nAtom 1: " +
getProperty("measurementinfo[" + j + "].atoms[1].info") + " Coordinates: " +
getProperty("measurementinfo[" + j + "].atoms[1].coord") + " --> NATIVE
STRUCTURE\n" + "Atom 2: " + getProperty("measurementinfo[" + j +
"].atoms[2].info") + " Coordinates: " + getProperty("measurementinfo[" + j +
"].atoms[2].coord") + " --> MODEL " + modelnum
}
}
}
Thanks for everything!
Cheers,
Daniel
2011/4/11 Daniel Carbajo <daniel.carb...@gmail.com>
> Oh thanks a lot! But returning to the thread question (ie, how to echo,
> alert or prompt the distance results)...
> This is the best I came up with but it does not work, and I cannot figure
> out why:
>
> var atomListN='4:A'
> var atomListM='7:A'
> set measurementUnits angstroms
> set measurements 3
> font measure 16 serif bold
> var n = atomListM.length
> for (var i = 2; i <= n; i++) {
> script inline @{"measure @{{" + atomListN + ".ca/1.1}} @{{" + atomListM +
> ".ca/" + i + ".1}}"}
> var j = i-1
> prompt "DISTANCE: " + getProperty("measurementinfo[j].atoms[1].info") + "
> AND " + getProperty("measurementinfo[j].atoms[2].info") + " = " +
> getProperty("measurementinfo[j].strMeasurement")
> }
>
>
> measurementinfo[1] or whatever number works, but introducing the j does
> not... I tried with double and single quotes, without quotes and everything,
> I even tried to define j like @{i-1}
> So which is the problem here?
>
> I also have problem with atoms[i].model as I told you... It is always 1
> Thanks again!
> Daniel
>
>
>
>
>
>
>
>
> 2011/4/11 Robert Hanson <hans...@stolaf.edu>
>
>> 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
>>
>>
>
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now! http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users