[chimerax-users] Saving name attribute

Elaine Meng meng at cgl.ucsf.edu
Tue May 4 08:31:46 PDT 2021


Hi David,
I can't advise on Python specifically, but I can see from the documentation that the save attribute command does not take an atomspec directly (namely the "/A & protein" that you included):

<https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes>

You can limit the scope to specific models with the "models" option, and/or to selected atoms only with the "selectedOnly" option.  So to limit to a specific chain you would need to select it, and then use the "selectedOnly" option.  For example:

open 3eeb
sel /A & protein
save chainAnames.defattr attrName r:name format defattr selectedOnly true
~select

Probably would be best to try the commands out in the command line to make sure that they work before putting them into your python script.
I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.                       
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On May 4, 2021, at 4:06 AM, David Leeming <david.leeming at student.manchester.ac.uk> wrote:
> 
> Hi, 
> I'm attempting to use a python script to save the names of each residue in a protein 
> The code I have is as follows: 
> import chimerax, sys
> from chimerax.core.commands import run
> cwd = (str(sys.argv[0][:-17]))
> prot = "/A"
> run(session, "open 3GDM")
> run(session, "save " + str(cwd) + "/script_content/sasa/name.defattr " + str(prot) +  " & protein attrName r:name format defattr")
> 
> The command being input into the command line of ChimeraX by the script is as follows: 
> "save [file path]/name.defattr /A & protein attrName r:name format defattr" 
> 
> I've also tried using: 
> "save [file path]/name.defattr attrName r:name format defattr models /A & protein" 
> 
> However, both commands give me a file with all the residues and all the names contained within the model rather than just the chain I'm interested in. 
> 
> Could you advise on how I can better use this command to save a file with the residue positions and corresponding amino acid for each residue from a single chain only? 
> 
> I've attached the resultant file to this email. 
> Kind regards, 
> David 
> <name.defattr>



More information about the ChimeraX-users mailing list