File: jmolclick.input

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (336 lines) | stat: -rw-r--r-- 9,635 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
!set ans_require=jmol
!reset nbsel, appletdir,nosel,Inputsize,appletType
!read lang/jmolclick.phtml.$lang

!set appletType=!getopt type in $(replyoption$i)
!set jmol_targ=!getopt target in $(replyoption$i)
!set appletdir=!getopt applet in $(replyoption$i)
!if $appletdir issametext imagedir
  !set appletdir=$imagedir
!endif
!default appletType=HTML5
!default appletdir=java/jmol
!default jmol_targ=0
!set jmol_target=jmolApplet_$jmol_targ
!set anstype=yes
!set anstyle=dprompt
!set oef_js_submit=finalise()
!if $wims_read_parm=def
  !exit
!endif
!!########################
!!########################

!set nbsel=!getopt nb_select in $(replyoption$i)

!!############################

!default nbsel=0
!!#### pas de message d'erreur si nbsel=0
!set nosel=!getopt noselect in $(replyoption$i)
!set nosel=!replace internal $	$ by = in $nosel
!default nosel=(none)
!if $nosel==\nosel
  !set nosel=(none)
!endif
!!############################

!set file1=!rows2lines $(replygood$i)
!set file1=!replace internal ; by $\
$ in $file1

!distribute line $file1 into rg
!set file1=!line 2 to -1 of $file1
!set file1=!replace internal $	$ by $\
$ in $file1
!!! tester si c'est un fichier  charger ou une variable
!set test_file=!linecnt $file1
!if $test_file=1 and | notin $file1
  !if __data isin __$file1
    !set temp=!record 0 of $file1
    !set file0=!replace internal / by , in $file1
    !readproc oef/togetfile.proc $(file0[-1]) new\
$temp
    !set file=$wims_ref_name?session=$session&+cmd=getfile&+special_parm=$(file0[-1])
  !else
    !set file=$file1
  !endif
!else
  !set file=jmol_$wims_nowseconds_$i
  !readproc oef/togetfile.proc $file new\
$file1
  !set file=$wims_ref_name?session=$session&+cmd=getfile&+special_parm=$file
!endif

!!############# traitement des options (qui se trouvent dans \embed)
!set oef_applet_option=!replace internal $	$ by $\
$ in $inputsize
!!set oef_applet_option=!nonempty lines $oef_applet_option
!set Inputsize=!line 1 of $oef_applet_option
!set test=!text remove 0123456789x in $Inputsize
!if $test issametext $empty
  !set Inputsize=!replace internal x by , in $Inputsize
  !set oef_applet_option=!line 2 to -1 of $oef_applet_option
  !set oef_applet_option=!declosing $oef_applet_option
  !distribute items $Inputsize into xsize,ysize
!endif
!distribute lines $oef_applet_option into ans_sc0,ans_sc1,ans_sc2
!!
!default Inputsize=400,400

!for j=0 to 2
  !set ans_sc$j=!trim  $(ans_sc$j)
  !if .spt__  isin $(ans_sc$j)__ and __data isin __$(ans_sc$j)
    !set temp=!record 0 of $(ans_sc$j)
    !set file0=!replace internal / by , in $(ans_sc$j)
    !readproc oef/togetfile.proc $(file0[-1]) new\
$temp
    !set ans_file$j=$wims_ref_name?session=$session&+cmd=getfile&+special_parm=$(file0[-1])
    !reset ans_sc$j
  !endif
  !if __http isin __$(ans_sc$j)
    !set ans_file$j=$(ans_sc$j)
    !reset ans_sc$j
  !endif
!next
!!###on garde les options pour le retour, variable de nom impose oef_answer_option$i
!set oef_answer_option$i=$Inputsize\
$file\
$ans_sc0$ans_file0\
$ans_sc2$ans_file2

!!############################ fin du traitement des options
!set test=!text remove 1234567890,| in $rg
!if $test issametext
  !set rg=!replace internal ||| by $\
 $ in $rg
  !set R_=
  !set rg_cnt=!linecnt $rg

  !for u_ = 1 to $rg_cnt
    !set l_=!line $u_ of $rg
    !set l_=!trim $l_
    !set l_=!nospace $l_
    !set l_=!replace internal , by $ $ or atomno= in atomno=$l_
    !set Rg=!append line $l_ to $Rg
  !next
  !set rg=!replace internal $\
$ by ||| in $Rg
!endif
!set rg=!replace internal ||| by ',' in '$rg'

!!pas d'analyse!!
!if ?analyze isin $rg
  !set red=yellow
!else
  !set red=red
!endif
<input type="hidden" name="reply$i" id="Clickjmolreply" value="">
!if $jmol_targ=0
  !if $jquery_defined=yes
    <script src="$appletdir/JSmol.min.nojq.js"></script>
  !else
    <script src="$appletdir/JSmol.min.js"></script>
  !endif
  <script src="$appletdir/Jmol2.js"></script>
!endif
<script>
/*<![CDATA[*/
function finalise(){
var score=0;
var best=0;
var selgood='';
var selbad='';
 var  nbselected=0;
 var ch=analysesel();
 if(ch!=''){
 // jmolScriptWait('select '+ch+' ;');
  Jmol.script($jmol_target,'select '+ch+' ;');
  var nbselected = Jmol.getPropertyAsArray($jmol_target,'AtomInfo',ch).length;
  var tabrep=new Array()
tab_rg= new Array($rg);
//alert(tab_rg.join()+'     '+ch)
for(irep=0;irep<tab_rg.length;irep++){
  tabrep=analyserep(ch,tab_rg[irep],'$nbsel');
  if(score<=tabrep[3]){
   selgood=tabrep[0];
   selbad=tabrep[1];
   selforget=tabrep[2];
   score=tabrep[3];
   best=irep;
   feedback=selgood + '\n' + selbad  + '\n' + selforget
 }
}
  sc_in_out=affich_rep(selgood,selbad,selforget);

  var orient=Jmol.saveOrientation($jmol_target)
  orient=orient.replace(/1\.0/,"0")
  document.getElementById('Clickjmolreply').value=score+'\n'+ feedback +'\n'+sc_in_out+'\n'+orient;
  //alert (document.getElementById('Clickjmolreply').value) ;
 }else{
  document.getElementById('Clickjmolreply').value='';
 }
 !!#########
 if(nbselected==$nbsel || $nbsel==0){
  document.forms[0].submit();
 }else{
  if($nbsel==1){
   if(nbselected==0){
    alert('$ans_warning1');
   }else{
    alert('$ans_warning2');
   }
  }else{
   alert('$ans_warning3'+nbselected);
  }
  document.getElementById('Clickjmolreply').value='';
 }
}

function analyse(inout,nbsel) {
 var atingood = Jmol.getPropertyAsArray($jmol_target,'AtomInfo',inout[0]);
 var atoutgood = Jmol.getPropertyAsArray($jmol_target,'AtomInfo',inout[0]);

}

function analysesel(arg,arg2) {
 var atsel = Jmol.getPropertyAsArray($jmol_target,'AtomInfo','((selected) and not ($nosel))');
 if(atsel.length>0){
  var chaine='({'+atsel[0]._ipt;
  for(at=1;at<atsel.length;at++){
   chaine=chaine+ ' '+atsel[at]._ipt;
  }
  chaine=chaine+'})';
 }else{
  chaine='';
 }
 return chaine;
}

function analyserep(repetu,repgood,nbsel){
 yy=Jmol.scriptWait($jmol_target,'print ('+repgood+')');
 var tyy=new Array()
 tyy=yy.split(",");
 repgood2=tyy[tyy.length-1];
 if(repgood2.substr(0,2)=="({"){repgood=repgood2.substr(0,repgood2.length-1)}
 var atominfo=new Array()
 atomgood=Jmol.getPropertyAsArray($jmol_target,"atominfo", repgood);
 atometu=Jmol.getPropertyAsArray($jmol_target,"atominfo", repetu);
 atom_good=Jmol.getPropertyAsArray($jmol_target,"atominfo", "(("+repgood+") AND ("+repetu+"))");
 atom_bad=Jmol.getPropertyAsArray($jmol_target,"atominfo", "(("+repetu+") AND (NOT ("+repgood+")))");
 atom_forget=Jmol.getPropertyAsArray($jmol_target,"atominfo", "(("+repgood+") AND (NOT ("+repetu+")))");
natgood=atomgood.length;
if ($nbsel>0) { natgood=nbsel}
nat_good=atom_good.length;
nat_bad=atom_bad.length;
 var selbad='({';
 for(i=0;i<atom_bad.length;i++){
  selbad=selbad+' '+atom_bad[i]._ipt;
 }
 selbad=selbad+'})';
 var selgood='({';
 for(i=0;i<atom_good.length;i++){
  selgood=selgood+' '+atom_good[i]._ipt;
 }
 selgood=selgood+'})';
 var selforget='({';
 for(i=0;i<atom_forget.length;i++){
  selforget=selforget+' '+atom_forget[i]._ipt;
 }
 selforget=selforget+'})';

!if split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i) or eqweight iswordof $(replyoption$i)
  !if eqweight iswordof $(replyoption$i)
    coeff=1
  !else
    coeff=2
  !endif
!else
  coeff=0
!endif
if( coeff==0 ) {
  if (nat_bad == 0 && nat_good == natgood ) { score=10 } else  {score=0}
 }
 else {
    score=Math.max(0, Math.min(1,(nat_good-coeff*nat_bad)/natgood));
 }


 var tabret=new Array(selgood,selbad,selforget,score)
 return tabret;
}

function affich_rep(selgood,selbad,selforget){
 chscript='define ~good '+selgood+';select ~good; halos 25%;color halos green;';
 chscript=chscript+'define ~bad '+selbad+';select ~bad; halos 25%;color halos $red;';
 chscript=chscript+'define ~forget '+selforget+';select ~forget; halos 25%;color halos orange;';
 return chscript;
}
/*]]>*/
</script>

!if $ans_file0!=$empty
  !set ans_sc0=script "$ans_file0";
!endif
!if $ans_file1!=$empty
  !set ans_sc1=script "$ans_file1";
!endif

!set oef_answer_option$i=$Inputsize\
$file\
$ans_sc0\
$ans_sc2
!if __@ isin __$file
  !set file=!char 2 to -1 of $file
  !set dollar=1
  !set appletType=HTML5
!endif
<script>
/*<![CDATA[*/
function mycallback(){
Jmol.script($jmol_target,'pic={atomIndex = _atomPicked}; if(pic.selected==1){select selected and not pic and not {$nosel}}else{select selected or ( pic and not {$nosel})};message "";')
}
var s = document.location.search;
jmol_isReady = function(applet) {
	Console.log(applet._id + " is ready");
}
var Info = {
	width: $xsize,
	height: $ysize,
	debug: false,
	color: "white",
	addSelectionOptions: false,
	serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/jsmol.php",
	use: "$appletType",
	j2sPath: "$appletdir/j2s",
	jarPath: "$appletdir",
	jarFile: "JmolApplet.jar",
	isSigned: false,
	memoryLimit: 512,
	readyFunction: jmol_isReady,
	disableJ2SLoadMonitor: false,
  disableInitialConsole: true
}
Jmol.getApplet("$jmol_target", Info)
var sc0='$ans_sc0';
var sc1='$ans_sc1';
!if $dollar==1
  var jscr='set loadFormat "https://cactus.nci.nih.gov/chemical/structure/%FILE/file?format=sdf&get3d=True";load "=$file";';
!else
  var jscr='load $file;';
!endif
    jscr= jscr +'selectionhalos on;select none; color selectionHalos blue;';
    jscr= jscr +'set antialiasdisplay on; \n';
    jscr= jscr +'set frank on;set DisablePopupMenu TRUE;hover off; \n';
    jscr= jscr +'set picking;console off;\n';
    jscr= jscr +'set pickcallback "mycallback";\n';
    jscr= jscr +'function getnosel(){\n';
    jscr= jscr +' varnosel={$nosel};\n';
    jscr= jscr +' return @varnosel ;\n';
    jscr= jscr +'}\n';
    jscr= jscr + sc0;
    jscr= jscr + sc1;
Jmol.script($jmol_target,jscr);
/*]]>*/
</script>
!!#####