User:Karsten Theis/Sandbox 2: Difference between revisions

From Proteopedia
Jump to navigationJump to search
Karsten Theis (talk | contribs)
No edit summary
Karsten Theis (talk | contribs)
No edit summary
 
Line 18: Line 18:
<jmol>
<jmol>
   <jmolLink>
   <jmolLink>
     <script> script /images/6/65/UvrB_1d9z.spt
     <script> script /images/6/6b/Uvrb_fancy.spt
function selector(selections) {
x_min = 0.4 * _width
x_max = 0.6 * _width
y_min = 0.4 * _height
y_max = 0.6 * _height
focus = {clickable and (sy > y_min and sy < y_max  and sx > x_min and sx < x_max)}
minz = 0
best = 0
for (var j FROM [1,selections.length]) {
  a = selections[j] and focus
  if (a.length > 0) {
if ((best = 0) or (minz > a.sz)) {
best = j
minz = a.sz
}
  }
}
return best
}
 
selections = [{ATP}, {91-117}, {157-245}]
old_s = 0
times = 0
while (times < 2) {
  delay 2
  s = selector(selections)
  print s
  if (s > 0) {
    select @{selections[s]}
    selectionhalos on
    delay 5
  }
  if (s = old_s) {
    selectionhalos off
    hide not selected
    select none
    center visible
    times = times + 1
    delay 10
    hide none
    select none
    center visible
    zoom 100
    delay 5
    s = 0
  }
  old_s = s
}
print "script done"
     </script>
     </script>
     <text>UvrB selector test</text>
     <text>UvrB selector test</text>