Selections, Scripting and Command Language
440 likes | 500 Vues
Learn the basics of ICM script language including creating variables, making selections, conditional expressions, and loops. Dive into molecule structure display and ICM commands for scripting.
Selections, Scripting and Command Language
E N D
Presentation Transcript
ICM – The Basics # ICM The Basics aa=2.4 #You have just created a new ICM-shell variable aa and assigned a value of 2.4 to it. You can create a variable with a name which is not already in use in the ICM-shell, does not contain space or delimiters like ".","," and starts from a letter (e.g. 1aag is an illegal name, except for sequences). Let us go on: bb=2.*aa #Now you have created another ICM-shell variable bb and its value is probably 4.8. Find it out by typing: print " bb=", bb #or any of these commands: list "b*" list integers show bb
Basics (Contd) #The next step would be to type a conditional expression like: if (bb != 4.8) print "something went wrong" #or something even more elaborate: if (bb != 4.8) then print "something went wrong" else print "It really works" endif #You can always start a for-loop such as: cc={"sushi","sashimi","negi maki","toro","period."} for i=1,Nof(cc) # Nof returns the number of elements. # Index i runs from 1 to 5 print "*** I just like to eat ",cc[i] endfor
ICM Molecule Introduction display a_2. cpk # object selection (the second object) display a_1.1 ribbon green # molecule 1 from object 1 display a_1.2/his xstick # residue his12 shown as balls and sticks color a_/1.2/12/n* xstick blue # atoms: color nitrogens in blue prefix _ [ object(s) . ] molecule(s) / residue(s) / atom(s) or variable(s)
Making Selections The Prefix defines one of the three selection types: atoms, residues, molecules and objects ( a_.. ) free variables ( v_.. ) all variables ( V_.. )
Free and all variables Example: aa = v_//phi,psi # the backbone torsions unfix only aa unfix only v_/10:15/phi,psi
ICM Command Language Verbs: read, write delete rename show display undisplay color make set Nouns: object, sequence, alignment, map e.g. read object “…..ob” make sequence “ALKLPLKD” show sequence display ribbon
Scripting - An ICM script means a collection of ICM commands stored in a file which can be called from ICM-shell. call s_ScriptFileName [ only ] • invokes and executes an ICM-script file. End the script with the quit command, unless you want to continue to work interactively, or use it in other script. • option “only” allows you to suppress opening the script file if the call command is inside a block which is not executed. By default the script file is opened and loaded into the ICM history stack anyway, but the commands from the file are not executed. • Example: call _startup # execute commands from _startup file
Jump Controls • break <for-loop> or <while-loop> ... if ( <logical expression> ) break ... <end of loop>
Jump Controls • continue <for-loop> or <while-loop> ... if ( <logical expression> ) continue ... <end of loop>
Jump Controls • goto ... if ( <logical expression> ) goto <label> ... ... <label>: ...