[chimerax-users] python loop with ChimeraX

Elaine Meng meng at cgl.ucsf.edu
Tue Jul 20 11:28:15 PDT 2021


One correction, the saved attribute file should have "defattr" filename extension instead of "txt", so my examples should instead be:

save /location/myfile.defattr  attrName r:area
save /location/myfile.defattr attrName r:area selectedOnly true

Sorry about that.
Elaine

> On Jul 20, 2021, at 11:23 AM, Elaine Meng via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
> 
> Hi Amith,
> Seems like two parts to this question:
> (A) what are the ChimeraX commands (which could be put into a .cxc file)?
> (B) how to loop over multiple inputs?  ...alluded to by "python loop" in your subject line... .cxc files only contain ChimeraX commands, not python.
> 
> I don't know python, so somebody else would need to address part B, but I can give some hints on part A.  However, depending on the solution to part B, you might instead choose to just make a python script instead of using ChimeraX commands directly.  The usual procedure is to figure out the commands first, often with some trial and error of simply typing them in to the command line.
> 
> Relevant ChimeraX commands are "measure sasa" to assign residue SASA values as an attribute and then "save" to write the file of attribute values. 
> 
> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
> <https://rbvi.ucsf.edu/chimerax/docs/user/commands/save.html#attributes>
> 
> I'm guessing you want the SASA of the residues but in the context of the complex, i.e. if they are completely buried in the interface between two proteins even though they would be on the surface of one protein by itself, you would still expect SASA zero.  In that case, you'd want the surface to enclose all the proteins in one blob, and then get the SASA of individual residues, and the command would be something like
> 
> measure sasa protein setAttribute true
> save /location/myfile.txt  attrName r:area
> 
> However, if you only want to specify certain residues instead of writing a file for all residues, you would need to use "select" command to select them and then save with the selectedOnly option, e.g. something like
> 
> select /A:24-53 /B:258
> save /location/myfile.txt  attrName r:area selectedOnly true
> 
> For part B you may need to embed these in some python script where it keeps closing the previous structure, opening a new structure, and substituting a different name for each save file.
> 
> I hope this helps,
> Elaine
> -----
> Elaine C. Meng, Ph.D.                       
> UCSF Chimera(X) team
> Department of Pharmaceutical Chemistry
> University of California, San Francisco
> 
>> On Jul 20, 2021, at 10:12 AM, Rangarajan, Amith via ChimeraX-users <chimerax-users at cgl.ucsf.edu> wrote:
>> 
>> Hi,
>> I am new to chimeraX , i want to loop through a set of biological assemblies  measuring SASA of  selecting residues and write them to a file. I need some help with starting on this .How to include this into the .cxc script? is there a example somewhere?
>> please share your tips and suggestions,
>> thanks everyone !
>> warm regards,
>> Amith
> 
> 
> _______________________________________________
> ChimeraX-users mailing list
> ChimeraX-users at cgl.ucsf.edu
> Manage subscription:
> https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users




More information about the ChimeraX-users mailing list