Selection through bond and fragment naming

Hi, I have a system from which I only have xyz coordinates. What I would like to do is to define myself residue attribute on different fragments of the molecules. Could you tell me how (or if there is a way to ): 1. expand a selection to bonding atoms (i.e. I click on one atom and expand selection through one bond after each actions) This would be of the easiest way for me to select the fragments I want to. 2. set a residue attribute to the given selected fragment. I think I remember how to do so in scripting, but what is the command line to do so? Kind regards, JD Dr. Jean-Didier Maréchal Lecturer The Computational Biotechnological Chemistry Team Unitat de Química Física Departament de Química Universitat Autònoma de Barcelona Edifici C.n. 08193 Cerdanyola (Barcelona) Tel: +34.935814936 e-mail: JeanDidier.Marechal@uab.es www: http://asklipio.qf.uab.es

Hi JD, If one fragment = one residue, all your problems are solved! Unfortunately, xyz may not have any notion of "residues," so that sounds like the hard part: either pre-processing to create PDB files in which each fragment is a residue, or making it happen within Chimera using python scripting. Tom Goddard may have an idea, as he recently added functionality that looks at connected groups of bonds. I can only describe the easy part, after each fragment is a residue: If you select part of a residue such as an atom or bond, then pressing keyboard up arrow or using command "select up" will expand the selection to the whole residue. Attributes are easily set for whole residues, for example with command "setattr" (one value at a time) or with "defattr" and an attribute definition file (multiple values at a fime). <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/setattr.html> <http://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/defattr.html> The first example attribute definition file defines a residue attribute. <http://www.cgl.ucsf.edu/chimera/docs/ContributedSoftware/defineattrib/defineattrib.html#attrfile> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Computer Graphics Lab (Chimera team) and Babbitt Lab Department of Pharmaceutical Chemistry University of California, San Francisco On Mar 11, 2011, at 7:42 AM, Jean Didier Pie Marechal wrote:
Hi, I have a system from which I only have xyz coordinates. What I would like to do is to define myself residue attribute on different fragments of the molecules. Could you tell me how (or if there is a way to ):
1. expand a selection to bonding atoms (i.e. I click on one atom and expand selection through one bond after each actions) This would be of the easiest way for me to select the fragments I want to. 2. set a residue attribute to the given selected fragment. I think I remember how to do so in scripting, but what is the command line to do so?
Kind regards,
JD

Hi JD, This sounds hard. When you open your atoms.xyz file you get a molecule with all atoms belonging to one residue. Your idea to select an atom and then press a key to extend the selection to the atoms connected one-bond away sounds useful. You could select an atom at the tip of the residue and then click the key several times until it reaches the backbone. We don't have that. There is a keyboard shortcut "sc" that selects all atoms that are connected by any number of bonds to the already selected atoms. I could add a keyboard shortcut that extends just one bond. Another idea is that you select one backbone bond between each pair of residues (ctrl-click then shift-ctrl-click) and delete all those bonds (Actions / Atoms&Bonds / delete). Then each residue is a separate connected set of atoms. Then the "sc" shortcut or a script that finds connected groups of atoms could help. But then you get to problem number 2, how to say those groups should each be a residue. As far as I know you cannot select atoms and then make them a separate residue in Chimera. Maybe you mean you will assign an atom attribute, write out those attributes and then process that result to make a PDB file? I'm assuming your goal is to turn this set of coordinates into a PDB file. You can set attributes of atoms in Chimera using for example setattr a rtype A123 sel to set an attribute named "rtype" to A123 for all currently selected atoms. What residue an atom belongs to in Chimera is not an attribute though. There is a separate residue object and I don't know of a way to place selected atoms in a newly made residue. Eric Pettersen would have the definitive answer on whether that is possible. Of course it is possible with Python. Tom
Hi,
I have a system from which I only have xyz coordinates. What I would like to do is to define myself residue attribute on different fragments of the molecules. Could you tell me how (or if there is a way to ):
1. expand a selection to bonding atoms (i.e. I click on one atom and expand selection through one bond after each actions) This would be of the easiest way for me to select the fragments I want to. 2. set a residue attribute to the given selected fragment. I think I remember how to do so in scripting, but what is the command line to do so?
Kind regards,
JD
Dr. Jean-Didier Maréchal Lecturer The Computational Biotechnological Chemistry Team Unitat de Química Física Departament de Química Universitat Autònoma de Barcelona Edifici C.n. 08193 Cerdanyola (Barcelona) Tel: +34.935814936 e-mail: JeanDidier.Marechal@uab.es www: http://asklipio.qf.uab.es
_______________________________________________ Chimera-users mailing list Chimera-users@cgl.ucsf.edu http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

On Mar 11, 2011, at 7:42 AM, Jean Didier Pie Marechal wrote:
Hi,
I have a system from which I only have xyz coordinates. What I would like to do is to define myself residue attribute on different fragments of the molecules. Could you tell me how (or if there is a way to ):
1. expand a selection to bonding atoms (i.e. I click on one atom and expand selection through one bond after each actions) This would be of the easiest way for me to select the fragments I want to.
Hi JD, My only idea as to how to do this is with a short Python script: from chimera.selection import currentAtoms, addCurrent addAtoms = set() for a in currentAtoms(): addAtoms.update(a.neighbors) addCurrent(addAtoms) You could then use the open command to run it: open <script folder location (e.g. ~marechal/scripts)>/expand.py which you could short to "xp" with the alias command: alias ^xp open blah-blah/expand.py
2. set a residue attribute to the given selected fragment. I think I remember how to do so in scripting, but what is the command line to do so?
So, do you really want to set a residue-level attribute, or do you want to organize the selected atoms into a residue? Setting a residue- level attribute for the atoms is easy: setattr r myAttrName my-attr-val sel Organizing the atoms into a residue again requires Python, and not as simple a script as for your first question, e.g.: # script designed to run under "runscript" command, therefore has an "arguments" variable available... try: rname, rnum = arguments except ValueError: raise chimera.UserError("must supply residue name and number arguments") try: rnum = int(rnum) except ValueError: raise chimera.UserError("residue number (second arg) must be an integer") atoms = chimera.selection.currentAtoms() if not atoms: raise chimera.UserError("No atoms selected") # make a new residue newRes = atoms[0].molecule.newResidue(rname, "A", rnum, ' ') # withdraw atoms from their current residues for a in atoms: a.residue.removeAtom(a) if len(a.residue.atoms) == 0: a.molecule.deleteResidue(a.residue) # add atoms to new residue for a in atoms: newRes.addAtom(a) So you would run this script with the command "runscript blah-blah/ newres.py TYR 1", which could again be shorted using aliasing: alias ^nr runscript blah-blah/newres.py $1 $2 --Eric Eric Pettersen UCSF Computer Graphics Lab http://www.cgl.ucsf.edu
participants (4)
-
Elaine Meng
-
Eric Pettersen
-
Jean Didier Pie Marechal
-
Tom Goddard