<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Hi Elaine, </div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
<br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Thanks so much for your advice! Works perfectly now I really appreciated the response! </div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
<br>
</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
Kind regards,</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);" dir="auto">
David </div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
Get <a href="https://aka.ms/AAb9ysg">Outlook for Android</a></div>
<div id="id-ef8ce711-9b48-4d1d-a66e-b9b5973ae721" class="ms-outlook-mobile-reference-message">
<div style="font-family: sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><br>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg"><strong>From:</strong> Elaine Meng <meng@cgl.ucsf.edu><br>
<strong>Sent:</strong> Tuesday, 4 May 2021, 16:31<br>
<strong>To:</strong> David Leeming<br>
<strong>Cc:</strong> chimerax-users@cgl.ucsf.edu<br>
<strong>Subject:</strong> Re: [chimerax-users] Saving name attribute<br>
</div>
<br>
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi David,<br>
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):<br>
<br>
<<a href="https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes">https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes</a>><br>
<br>
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:<br>
<br>
open 3eeb<br>
sel /A & protein<br>
save chainAnames.defattr attrName r:name format defattr selectedOnly true<br>
~select<br>
<br>
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.<br>
I hope this helps,<br>
Elaine<br>
-----<br>
Elaine C. Meng, Ph.D. <br>
UCSF Chimera(X) team<br>
Department of Pharmaceutical Chemistry<br>
University of California, San Francisco<br>
<br>
> On May 4, 2021, at 4:06 AM, David Leeming <david.leeming@student.manchester.ac.uk> wrote:<br>
> <br>
> Hi, <br>
> I'm attempting to use a python script to save the names of each residue in a protein
<br>
> The code I have is as follows: <br>
> import chimerax, sys<br>
> from chimerax.core.commands import run<br>
> cwd = (str(sys.argv[0][:-17]))<br>
> prot = "/A"<br>
> run(session, "open 3GDM")<br>
> run(session, "save " + str(cwd) + "/script_content/sasa/name.defattr " + str(prot) + " & protein attrName r:name format defattr")<br>
> <br>
> The command being input into the command line of ChimeraX by the script is as follows:
<br>
> "save [file path]/name.defattr /A & protein attrName r:name format defattr" <br>
> <br>
> I've also tried using: <br>
> "save [file path]/name.defattr attrName r:name format defattr models /A & protein"
<br>
> <br>
> 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.
<br>
> <br>
> 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?
<br>
> <br>
> I've attached the resultant file to this email. <br>
> Kind regards, <br>
> David <br>
> <name.defattr><br>
</div>
</span></font><br>
</div>
</body>
</html>