[Chimera-users] select zone & rename script

Eric Pettersen pett at cgl.ucsf.edu
Tue Apr 29 14:44:23 PDT 2014


Hi Mike,
	The tricks you need to know are that:

1) You can use the '&' operator in an atom spec to get the intersection of two atom specs.  Therefore ":CYS & sel" will get all CYS residues in the current selection and only those residues, and:

2) You can use the 'setattr' command to change a residue's type.

Therefore, once you've used your zone command to select what you want, this command will rename selected CYS residues to CYM:

setattr r type CYM :CYS & sel

Similarly for HIS/HIN change:

setattr r type HIN :HIS & sel

Therefore you can insert these commands in your script to get the result you want.

--Eric

                        Eric Pettersen
                        UCSF Computer Graphics Lab
                        http://www.cgl.ucsf.edu

On Apr 29, 2014, at 7:34 AM, Michael Garton <michael.garton at utoronto.ca> wrote:

> 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.
> 
> Thanks!!
> Mike
> 
> 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")
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20140429/c601e738/attachment.html>


More information about the Chimera-users mailing list