[Chimera-users] Script

Elaine Meng meng at cgl.ucsf.edu
Wed Aug 19 13:45:50 PDT 2009

Hi Damien,
Eric's answer is perfect, I just wanted to add that you can try out  
each command by typing it into the Command Line (shown by choosing  
"Favorites... Command Line" from the menu).  In other words, a  
Chimera command script is just a text file containing the same lines  
that could be entered at the Command Line.

You can see a list of all commands by choosing "Help... User's Guide"  
from the menu and then clicking the "commands" link in the page that  
appears.  That commands index also has a section near the bottom  
entitled "Chimera Command Files" with links to several example files.

There are also many example commands in the tutorials (again under  
the Help menu).

Another kind of script is Python code, which is sometimes needed if  
there is no Chimera command for  what you want to do, or you need to  
loop through a large number of structures.

On Aug 19, 2009, at 11:22 AM, Eric Pettersen wrote:

> Hi Damien,
> 	You can use "open" with the full path to the file, or you can "cd"  
> to the folder and then just use the file's name.  See below...
> On Aug 19, 2009, at 6:44 AM, Damien Larivière wrote:
>> Dear all,
>> Sorry for this simple question : Is there an example of how to use a
>> command in a script ? For example, the command "open" is described in
>> the documentation but I confess (i'm not a programmer) that I do not
>> understand how to use it for opening a pdb file in a specific  
>> directory
>> : C:\Users\damien\Fondation\LifeExplorer\3D
>> models\FtsZ_ring\Bond_Set\Docking_Hex\Results_190809\dock0001.pdb
>> I would like to create a script that does :
>> 1/ Open a PDB file (dock0001.pdb)
> Either:
> 	open C:\Users\damien\ ... \Results_190809\dock001.pdb
> -or-:
> 	cd C:\Users\damien\ ... \Docking_Hex\Results_190809
> 	open dock001.pdb
> The latter might be better if you are going to save files and would  
> like them to go into that folder as well without specifying a big  
> long path.
>> 2/ open Tools - Structure analysis - Sequence
>> 3/ select residues 203 to 227 chain A
> sel :203-227.A
> ":203-227.A" is the "atom specifier" for residues 203 to 227 of  
> chain A.  There is an extensive explanation of atom specifiers  
> here: http://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/ 
> frameatom_spec.html
>> 4/ Actions Color Red
> color red sel
>> 5/ open Tools - Structure analysis - Sequence
>> 6/ select residues 54 to 87 chain A
> sel :54-87.A
>> 7/ Actions Color Magenta
> color magenta sel
> If the only reason you are making the selection is in order to  
> color it magenta (i.e. you aren't going to do any other operations  
> on it) then you could just cut out the selection step and:
> color magenta :54-87.A
> --Eric
>                         Eric Pettersen
>                         UCSF Computer Graphics Lab
>                         http://www.cgl.ucsf.edu
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users

More information about the Chimera-users mailing list