
How can I write the current selection to a file from a script? "write sel filename.pdb" does not work. Thanks, Charlie

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.
Hi Charlie, 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 Actions... Write or the command writesel (new in the March snapshot, 1.2105). The man page can be viewed at http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/writesel.html 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: show sel 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 different from the original coordinates if you have moved the view around. If you want the untransformed coords, use the "reset" command before the "pdbrun" command. This process doesn't work on Windows as there is no cat command. I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html

I don't need coords, just knowledge of which residues are selected, hence writesel should suffice. Thanks as always, Elaine Meng wrote:
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.
Hi Charlie, 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 Actions... Write or the command writesel (new in the March snapshot, 1.2105). The man page can be viewed at http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/writesel.html
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: show sel 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 different from the original coordinates if you have moved the view around. If you want the untransformed coords, use the "reset" command before the "pdbrun" command. This process doesn't work on Windows as there is no cat command.
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. meng@cgl.ucsf.edu UCSF Computer Graphics Lab and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco http://www.cgl.ucsf.edu/home/meng/index.html
participants (2)
-
Charles Moad
-
Elaine Meng