[Chimera-users] Writing the selection
meng at cgl.ucsf.edu
Tue Apr 19 12:03:19 PDT 2005
On Tuesday, April 19, 2005, at 11:34 AM, Charles Moad wrote:
> How can I write the current selection to a file from a script?
> "write sel filename.pdb" does not work.
Did you need the coordinates, or a text description of the
selection? A parseable text description of the selection can
be written to a file with
or the command writesel (new in the March snapshot, 1.2105).
The man page can be viewed at
As for the coordinates, we do not currently have a general way
of writing them out for just the selection (but it's on the "to do"
list). However, if you are on a UNIX system, you can save the
coordinates of the selection using the following procedure.
Chimera can send information on what atoms are displayed to the
system, and then the system command "cat" can send the information
to a file. In Chimera, if the atoms of interest are selected:
pdbrun nouser cat > ~homedir/myfile.pdb
(where "homedir" is your username) saves the displayed atoms to a PDB
file named myfile.pdb in your home directory. It is necessary to use
show (which undisplays everything else) since pdbrun includes all atoms
that are displayed. The coordinates are transformed, so will be
from the original coordinates if you have moved the view around. If you
want the untransformed coords, use the "reset" command before the
command. This process doesn't work on Windows as there is no cat
I hope this helps,
Elaine C. Meng, Ph.D. meng at cgl.ucsf.edu
UCSF Computer Graphics Lab and Babbitt Lab
Department of Pharmaceutical Chemistry
University of California, San Francisco
More information about the Chimera-users