[Chimera-users] using IDLE
Eric Pettersen
pett at cgl.ucsf.edu
Wed Feb 6 14:33:51 PST 2008
Hi Ben,
IDLE is basically for interactive debugging or discovery of
information in the Python layer (the latter via the help()
function). For what you want to do you either want to write a
Chimera-command script (.cmd suffix) or a Python script (.py
suffix). Either kind can be run by opening the script with
File...Open or the "open" command or by supplying the filename as an
argument on the Chimera startup command line (the latter typically
used more in Linux or IRIX environments).
If what you want to do is no more complicated than what you
outlined, you can get away with using a Chimera-command script. In
particular you can use the "alias" command to construct a compound
command that takes arguments. For example:
alias ^process open $1.pdb; sel :HIS; del sel; write 0 $1.mod.pdb;
close 0
creates an alias named "process" that if you execute it as "process
1gcn" will open the file 1gcn.pdb, select the histidines, delete the
selected atoms, write the result to a file named 1gcn.mod.pdb, and
then close the opened model. Aliases are saved in sessions and can
be made available at startup. See the documention for the alias
command for details on that.
So you might make a command file like this:
alias ^process open $1.pdb; sel :HIS; del sel; write 0 $1.mod.pdb;
close 0
process 1gcn
process 3fx2
process 1www
...
You would have to use Python if you needed to loop through a range
of values in your script, or only execute certain commands if some
condition was true, or do something for which there is no equivalent
Chimera command. We having some basic information for getting
started in the Chimera Programmer's Guide: http://www.cgl.ucsf.edu/
chimera/docs/ProgrammersGuide/index.html
The programmer documentation isn't nearly as extensive as the user
documentation, so feel to ask questions -- either here or on the
chimera-dev mailing list.
--Eric
Eric Pettersen
UCSF Computer Graphics Lab
http://www.cgl.ucsf.edu
On Feb 6, 2008, at 12:41 PM, Ben Keshet wrote:
> Hi,
>
>
>
> I am interested in performing the same actions several times on
> several different structures. For example: open a file, select the
> histidines, delete them, save and close. Is IDLE the right tool
> for that? I opened the python shell (Tools-> General Controls->
> IDLE) but could not open files or manipulate them using the shell.
> I have no knowledge in python. What is the best way to write
> scripts to execute commands repeatedly? If IDLE is the tool, how
> can use it to do that? Is there a written source for that? Do I
> need to master python first?
>
>
>
> Many thanks,
>
> Ben
>
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20080206/61e0ea99/attachment.html>
More information about the Chimera-users
mailing list