[Chimera-users] select zone & rename script

Michael Garton michael.garton at utoronto.ca
Tue Apr 29 07:34:33 PDT 2014

Hi all,

Can anyone show me a good way to select all residues that are <2Å from zinc atoms, then rename any selected CYS and HIS, to CYM and HIN respectively ... I'm trying to write a script to do this on ~300 files.


Here's what I have so far

import os
from chimera import runCommand as rc
from chimera import replyobj

# gather the names of .pdb files in the folder
file_names = [fn for fn in os.listdir(".") if fn.endswith(".pdb")]

# loop through the files, opening, processing, and closing each in turn
for fn in file_names:
    replyobj.status("Processing " + fn) # show what file we're working on

    rc("open " + fn)

    rc("select :ZNB zr<2")
    rc("writesel "reslist + fn")

    rc("close all")

rc("stop now")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140429/94bd0611/attachment.html>

More information about the Chimera-users mailing list