Automate calculation and saving of residues' structural attributes

Hello! I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files. I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?) But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation). Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed. I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list). Thank you so much, André.

Hi André, i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon. I quickly wrote a script, which performs a chimerax task independently, by just running python code. First: a chimerax script file with the desired commands: script.cxc: open 7ott surface #1 mearuse area #1 exit Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line. Second: a python script, which execute this script in chimerax and fetches the output: test.py: import subprocess import os cwd = os.getcwd() chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc" cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True) stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str) This just runs a subprocess and fetches the output to a string, which you can than further analyse. Best Christian Dr. rer. nat. Christian Tüting Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files. I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?) But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation). Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed. I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list). Thank you so much, André.

Hi Christian, Thank you so much for your solution! That indeed helps a lot, since it shows me how to execute ChimeraX scripts independently and directly from Python! Now, do you know which commands I should use to calculate the following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi? I do it manually in Chimera (haven't figured out how to do the same in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this: attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ... Thus, that's what I wanted to do: figure out which commands I should use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!). Once again, thank you for your help! Best, André. Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting < christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.

Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa> For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html> So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX. In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue> kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle_hydrophobicity.cxc> ...or you can just assign it directly yourself by lookup table. The values along with some alternative hydrophobicity scales (lookup tables) are summarized here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html> I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since it shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <christian.tueting@biochemtech.uni-halle.de> escreveu: Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Elaine, Thank you so much for your very helpful answer! Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates. Once again, thank you very much! Best, André. Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: < https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle_hydrophobicity.cxc
...or you can just assign it directly yourself by lookup table. The values along with some alternative hydrophobicity scales (lookup tables) are summarized here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since it shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting < christian.tueting@biochemtech.uni-halle.de> escreveu: Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Andre, I checked what you want to calculate. For me, I didn't even know that there is something called SES, I only worked with SAS(A) so far. As far as I see, you need a reference for the SES, to calculate the relative exposure? But for the rest, I think you can go for a python only solution, which is way faster, than starting chimera(x) for each calculation: dihedrals: calculatable from coordinates (so from pdb) bfactor: directly in pdb file kdh: value based on residue type (also in pdb) sasa: calculatable from coordinates So I wrote a piece of code, which will calculate these from a input pdb file and save the values in a dataframe. Here is the code: https://paste.ofcode.org/gCH5HDVtkg4DD3fcdqKfRZ (link will be expire in 1 week). I also attach the file to this mail. The code was tested for the pdb file 1trn (hardcoded in the file), which contains mutliple chains and heteroatoms and unusual residues, and as far as I can see, the results looks correct. In principle, it's a function, which just need to full path to the pdb file. For the dependencies, it uses pandas and biopython. Additionally: For the SES calculation, if this could be calculated from the reference and the SASA, it should be easy to implement. If you have a reference for this, I might also include this for you. Best Christian ps. the code is not optimized, e.g., the load pdb module from biopython is used twice. So the code could be also furhter optimized to be faster. Also the manually read-in of the pdb file could be most likely done by biopython and not manually, like I did :D
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer! Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates. Once again, thank you very much! Best, André. Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle_hydrophobicity.cxc
...or you can just assign it directly yourself by lookup table. The values along with some alternative hydrophobicity scales (lookup tables) are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I h> Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, f> > this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Christian, Just FYI and for the others on the list... People would like to have a lookup table of "completely exposed" reference values for SAS (not SES) for each of the standard amino acids because that is the only type of area that can be calculated in ChimeraX. ChimeraX calculates the residue SAS in the context of the specific structure, and then if there were a reference "completely exposed" value, you would divide by that to get % exposed. It's just a normalization factor for the size of the residue. We already have reference values for SES (which could be used in Chimera because Chimera can calculate SES). We just don't have them for SAS. There is a diagram showing the difference between SAS and SES here: <https://rbvi.ucsf.edu/chimerax/docs/user/commands/surface.html> Best, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 24, 2022, at 4:28 AM, Christian Tüting via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Andre,
I checked what you want to calculate. For me, I didn't even know that there is something called SES, I only worked with SAS(A) so far. As far as I see, you need a reference for the SES, to calculate the relative exposure?
But for the rest, I think you can go for a python only solution, which is way faster, than starting chimera(x) for each calculation:
dihedrals: calculatable from coordinates (so from pdb) bfactor: directly in pdb file kdh: value based on residue type (also in pdb) sasa: calculatable from coordinates
So I wrote a piece of code, which will calculate these from a input pdb file and save the values in a dataframe. Here is the code: https://paste.ofcode.org/gCH5HDVtkg4DD3fcdqKfRZ (link will be expire in 1 week).
I also attach the file to this mail.
The code was tested for the pdb file 1trn (hardcoded in the file), which contains mutliple chains and heteroatoms and unusual residues, and as far as I can see, the results looks correct. In principle, it's a function, which just need to full path to the pdb file.
For the dependencies, it uses pandas and biopython.
Additionally:
For the SES calculation, if this could be calculated from the reference and the SASA, it should be easy to implement. If you have a reference for this, I might also include this for you.
Best Christian
ps. the code is not optimized, e.g., the load pdb module from biopython is used twice. So the code could be also furhter optimized to be faster. Also the manually read-in of the pdb file could be most likely done by biopython and not manually, like I did :D
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer!
Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates.
Once again, thank you very much!
Best, André.
Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle_hydrophobicity.cxc
...or you can just assign it directly yourself by lookup table. The values along with some alternative hydrophobicity scales (lookup tables) are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I h> Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, f> > this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
<analysis.py>_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi all, Christian, thank you so much for your answer! I considered using biopython, but, as you pointed out, I also couldn't find a way to calculate SESA (areaSES), which is why I switched to Chimera, which allows such a calculation. As Elaine explained, SESA is the solvent-excluded surface aerea, and the diagram she referenced is quite useful to understand their difference. As far as I could find out, there's not an immediate way to get SESA from SASA --- a specific algorithm is used to do so. I still think that I'll be able to run Chimera from python in the --nogui mode, so that it won't be necessary to implement such an algorithm, But, if I do, I'll post it here. Elaine and Christian, thank you again for your replies and valuable help! Best, André. Em seg., 24 de jan. de 2022 às 13:42, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi Christian, Just FYI and for the others on the list...
People would like to have a lookup table of "completely exposed" reference values for SAS (not SES) for each of the standard amino acids because that is the only type of area that can be calculated in ChimeraX. ChimeraX calculates the residue SAS in the context of the specific structure, and then if there were a reference "completely exposed" value, you would divide by that to get % exposed. It's just a normalization factor for the size of the residue.
We already have reference values for SES (which could be used in Chimera because Chimera can calculate SES). We just don't have them for SAS.
There is a diagram showing the difference between SAS and SES here: <https://rbvi.ucsf.edu/chimerax/docs/user/commands/surface.html>
Best, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 24, 2022, at 4:28 AM, Christian Tüting via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Andre,
I checked what you want to calculate. For me, I didn't even know that there is something called SES, I only worked with SAS(A) so far. As far as I see, you need a reference for the SES, to calculate the relative exposure?
But for the rest, I think you can go for a python only solution, which is way faster, than starting chimera(x) for each calculation:
dihedrals: calculatable from coordinates (so from pdb) bfactor: directly in pdb file kdh: value based on residue type (also in pdb) sasa: calculatable from coordinates
So I wrote a piece of code, which will calculate these from a input pdb file and save the values in a dataframe. Here is the code: https://paste.ofcode.org/gCH5HDVtkg4DD3fcdqKfRZ (link will be expire in 1 week).
I also attach the file to this mail.
The code was tested for the pdb file 1trn (hardcoded in the file), which contains mutliple chains and heteroatoms and unusual residues, and as far as I can see, the results looks correct. In principle, it's a function, which just need to full path to the pdb file.
For the dependencies, it uses pandas and biopython.
Additionally:
For the SES calculation, if this could be calculated from the reference and the SASA, it should be easy to implement. If you have a reference for this, I might also include this for you.
Best Christian
ps. the code is not optimized, e.g., the load pdb module from biopython is used twice. So the code could be also furhter optimized to be faster. Also the manually read-in of the pdb file could be most likely done by biopython and not manually, like I did :D
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer!
Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates.
Once again, thank you very much!
Best, André.
Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle_hydrophobicity.cxc
...or you can just assign it directly yourself by lookup table. The values along with some alternative hydrophobicity scales (lookup tables) are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I h> Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
> André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to calculate and save to .txt files some structural properties of residues (namely: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, f> > this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
<analysis.py>_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi All, Andre and I continued this conversation in private, as this was not Chimera related anymore. Somehow, we have a question regarding the calculation of the of the SES and SAS. In principle, I looked into the calcsurf.py file in the chimera folder, and figured out, that this calculation is done by msms with a probe radius of 1.4 and a density of 2 and noh. So I copied the code into my workflow and tested this with a xyzr file, generated by the pdb_to_xyzr shell script from msms, and got the same results, as if I am running directly msms from command line. So far not suprisingly. But when we take the same pdb file, the msms code itself gives slightly different values than chimera. Often, it's not siginificant, but Andre benchmarked this, and sometimes the difference is more than 1.2 fold. So this let us come to the conclusion, that chimera somehow calculates a different xyzr file, compared to what the shell script is doing. I was not able to find the code for caluclating the xyzr file. Another explanation is, that chimera treats the results a bit differently. msms results ses and sas per atom, we "just" summed them per residue to get the per residue value. But I don't think, that this is done differently here. So our questions are: (a) is the radius definition different in chimera from what is given with the msms software ( https://ccsb.scripps.edu/msms/downloads/; there is a shellscript and, more importantly a text file, which defines the radius of each atom, with a lot of special cases ). (b) is the structure somehow "filtered" prior to surface calculation. E.g. are waters, ions, ligands considered part of the structure, of are they excluded, as this might introduce also some differences (c) or can you help us find the actual code for this in chimera, than I will be able to anwser the question myself Thanks in advance. Christian
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer! Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates. Once again, thank you very much! Best, André. Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle> values along with some alternative hydrophobicity scales (lookup tables)
are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to> > areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Christian, I guess this is a Chimera question now, so I set the "reply to" to chimera-users in case this generates further messages. The following pertains to Chimera. I believe it uses the MSMS code without modification to do the actual calculation, so it might be needless work to run all this benchmarking. Nevertheless I can understand why you want to figure out the cause of any differences. (a) I would expect differences in VDW radii to be a major factor. The Chimera default radii are described/listed in the User Guide, see this and links therein: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/vdwrad.html> You could try assigning the MSMS-provided radii within Chimera before performing the area calculation in Chimera. See the bottom section of the help page URL above for possible ways of assigning different VDW radius values. (b) secondarily, it depends how you use the command... if you just used Chimera command "surface" it would automatically just surface the macromolecules and try to omit waters, ligands, etc. However, you can use "surfcat" command to define whatever sets of atoms you like for subsequent "surface" calculations. Chimera surface command <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/surface.html> Chimera surfcat command <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/msms.html> (c) dealing with the code is beyond my skill set, so if you still need pointers to look therein, somebody else would have to advise. I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Feb 3, 2022, at 12:33 AM, Christian Tüting via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi All,
Andre and I continued this conversation in private, as this was not Chimera related anymore.
Somehow, we have a question regarding the calculation of the of the SES and SAS.
In principle, I looked into the calcsurf.py file in the chimera folder, and figured out, that this calculation is done by msms with a probe radius of 1.4 and a density of 2 and noh. So I copied the code into my workflow and tested this with a xyzr file, generated by the pdb_to_xyzr shell script from msms, and got the same results, as if I am running directly msms from command line. So far not suprisingly.
But when we take the same pdb file, the msms code itself gives slightly different values than chimera. Often, it's not siginificant, but Andre benchmarked this, and sometimes the difference is more than 1.2 fold.
So this let us come to the conclusion, that chimera somehow calculates a different xyzr file, compared to what the shell script is doing. I was not able to find the code for caluclating the xyzr file. Another explanation is, that chimera treats the results a bit differently. msms results ses and sas per atom, we "just" summed them per residue to get the per residue value. But I don't think, that this is done differently here.
So our questions are: (a) is the radius definition different in chimera from what is given with the msms software ( https://ccsb.scripps.edu/msms/downloads/; there is a shellscript and, more importantly a text file, which defines the radius of each atom, with a lot of special cases ). (b) is the structure somehow "filtered" prior to surface calculation. E.g. are waters, ions, ligands considered part of the structure, of are they excluded, as this might introduce also some differences (c) or can you help us find the actual code for this in chimera, than I will be able to anwser the question myself
Thanks in advance.
Christian
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer!
Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates.
Once again, thank you very much!
Best, André.
Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle> values along with some alternative hydrophobicity scales (lookup tables)
are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file is generated directly -- if the needed information appear in the stdout_as_str string, just like in the example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to> > areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' properties (I took a look in ChimeraX Recipes (https://rbvi.github.io/chimerax-recipes/), but I couldn't find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users

Hi Elaine, the benchmarking is in principle the code of Andre and I, vs. the caluclation performed by chimera. And this includes also the xyzr conversion. And thank you for the information regarding the VDW radii. I will check these values and compare them to the msms provided data. But I am pretty sure, that we will find the key here for the differences we observe. Thanks a lot. Best Christian
Elaine Meng <meng@cgl.ucsf.edu> 02/03/22 7:47 PM >>> Hi Christian, I guess this is a Chimera question now, so I set the "reply to" to chimera-users in case this generates further messages. The following pertains to Chimera.
I believe it uses the MSMS code without modification to do the actual calculation, so it might be needless work to run all this benchmarking. Nevertheless I can understand why you want to figure out the cause of any differences. (a) I would expect differences in VDW radii to be a major factor. The Chimera default radii are described/listed in the User Guide, see this and links therein: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/vdwrad.html> You could try assigning the MSMS-provided radii within Chimera before performing the area calculation in Chimera. See the bottom section of the help page URL above for possible ways of assigning different VDW radius values. (b) secondarily, it depends how you use the command... if you just used Chimera command "surface" it would automatically just surface the macromolecules and try to omit waters, ligands, etc. However, you can use "surfcat" command to define whatever sets of atoms you like for subsequent "surface" calculations. Chimera surface command <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/surface.html> Chimera surfcat command <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/msms.html> (c) dealing with the code is beyond my skill set, so if you still need pointers to look therein, somebody else would have to advise. I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Feb 3, 2022, at 12:33 AM, Christian Tüting via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi All,
Andre and I continued this conversation in private, as this was not Chimera related anymore.
Somehow, we have a question regarding the calculation of the of the SES and SAS.
In principle, I looked into the calcsurf.py file in the chimera folder, and figured out, that this calculation is done by msms with a probe radius of 1.4 and a density of 2 and noh. So I copied the code into my workflow and tested this with a xyzr file, generated by the pdb_to_xyzr shell script from msms, and got the same results, as if I am running directly msms from command line. So far not suprisingly.
But when we take the same pdb file, the msms code itself gives slightly different values than chimera. Often, it's not siginificant, but Andre benchmarked this, and sometimes the difference is more than 1.2 fold.
So this let us come to the conclusion, that chimera somehow calculates a different xyzr file, compared to what the shell script is doing. I was not able to find the code for caluclating the xyzr file. Another explanation is, that chimera treats the results a bit differently. msms results ses and sas per atom, we "just" summed them per residue to get the per residue value. But I don't think, that this is done differently here.
So our questions are: (a) is the radius definition different in chimera from what is given with the msms software ( https://ccsb.scripps.edu/msms/downloads/; there is a shellscript and, more importantly a text file, which defines the radius of each atom, with a lot of special cases ). (b) is the structure somehow "filtered" prior to surface calculation. E.g. are waters, ions, ligands considered part of the structure, of> (c) or can you help us find the actual code for this in chimera, than I will be able to anwser the question myself
Thanks in advance.
Christian
André <andre.jfmdm@gmail.com> 01/21/22 7:06 PM >>> Hi Elaine,
Thank you so much for your very helpful answer!
Yeah, Tom told me before that it wouldn't be possible to directly calculate SESA and relSESA with ChimeraX. So, I'll probably have to stick with Chimera. I've just discovered the "list" command (functional in Chimera), and I think that with it I'll be able to easily get all the attributes by using the --nogui startup. I'll work on it in the following days, then I'll come back with updates.
Once again, thank you very much!
Best, André.
Em sex., 21 de jan. de 2022 às 13:55, Elaine Meng <meng@cgl.ucsf.edu> escreveu:
Hi André, Although it displays an SES, ChimeraX does not calculate SES areas, only SAS areas (command "measure sasa" which also assigns a residue attribute). <https://rbvi.ucsf.edu/chimerax/docs/user/commands/measure.html#sasa>
For Chimera, another group had provided SES reference areas for the exposed state represented by G-X-G tripeptides, but I don't know of a similar SAS reference area set for ChimeraX that could be used to calculate relative exposure, sorry. In case others are interested, the Chimera relative exposure calculation giving relSESA is described here: <https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/surfnorm.html>
So depending on the importance of SESA and relSESA, you may need to use Chimera, or at least some method outside of ChimeraX.
In both ChimeraX and Chimera, bfactor is read from the input PDB file, and phi and psi are calculated automatically for peptide/protein structures when they are read in. ChimeraX atom and residue attributes: <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#atom> <https://rbvi.ucsf.edu/chimerax/docs/user/attributes.html#residue>
kdHydrophobicity is not a calculation, but a simple lookup table by amino acid type. You may not need either program to "calculate" it, but it is automatically assigned in Chimera. It can be assigned in ChimeraX by running this comand script: <
https://rbvi.ucsf.edu/chimerax/docs/user/kyte-doolittle> values along with some alternative hydrophobicity scales (lookup tables)
are summarized here:
<https://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/midas/hydrophob.html>
I hope this helps, Elaine ----- Elaine C. Meng, Ph.D. UCSF Chimera(X) team Department of Pharmaceutical Chemistry University of California, San Francisco
On Jan 21, 2022, at 7:28 AM, André via ChimeraX-users < chimerax-users@cgl.ucsf.edu> wrote:
Hi Christian,
Thank you so much for your solution! That indeed helps a lot, since
it
shows me how to execute ChimeraX scripts independently and directly from Python!
Now, do you know which commands I should use to calculate the
following structural attributes for all residues: areaSAS, areaSES, relSESA, bfactor, kdhydro, phi, psi?
I do it manually in Chimera (haven't figured out how to do the same
in ChimeraX yet), by following the route: Tools -> Structure Analysis -> Render by Attribute -> File -> Save Attributes -> Attribute to Save, which allows each attribute of residues to be saved as txt files, which contain the residue number and respective attribute, for all residues in the protein. For example, the file for areaSAS looks like this:
attribute: areaSAS recipient: residues :1.B 116.71626508235931 :2.B 118.39353680610657 ...
Thus, that's what I wanted to do: figure out which commands I should
use to get the same result as the manual route above (although it is not really necessary that the txt file> example you showed, I'd be able to parse it to a file, and the problem would be solved!).
Once again, thank you for your help!
Best, André.
Em sex., 21 de jan. de 2022 às 09:56, Christian Tüting <
christian.tueting@biochemtech.uni-halle.de> escreveu:
Hi André,
i am pretty sure, that my solution is very crude and that there are better ways of doing it (like importing chimerax in the python code directly). I guess, you'll get more anwsers soon.
I quickly wrote a script, which performs a chimerax task independently, by just running python code.
First: a chimerax script file with the desired commands:
script.cxc: open 7ott surface #1 mearuse area #1 exit
Note: the exit command is needed, otherwise the subprocress will idle in the chimerax cmd line.
Second: a python script, which execute this script in chimerax and fetches the output:
test.py:
import subprocess import os
cwd = os.getcwd()
chimerax = "/Applications/ChimeraX_Daily.app/Contents/MacOS/ChimeraX" scriptfile = f"{cwd}/script.cxc"
cmd = [chimerax, "--nogui",scriptfile] p = subprocess.run(" ".join(cmd),shell = True,capture_output=True)
stdout_as_str = p.stdout.decode("utf-8") print(stdout_as_str)
This just runs a subprocess and fetches the output to a string, which you can than further analyse.
Best Christian
Dr. rer. nat. Christian Tüting
Kastritis Laboratory for Biomolecular Research Cryo-Electron Microscopy & Computational Structural Biology ________________________________________________ Martin-Luther-Universität Halle-Wittenberg Biozentrum, Room A.2.19 IWE ZIK HALOmem NWG III "Kryo-Elektronenmikroskopie an Membranproteinkomplexen" Weinbergweg 22, 06120 Halle tel: +49 345 5524985 web (Lab): https://blogs.urz.uni-halle.de/kastritislab/ web (HALOmem): https://www.halomem.de/en/
André via ChimeraX-users <chimerax-users@cgl.ucsf.edu> 01/21/22 1:29 PM >>> Hello!
I'm working on an automated pipeline (in Python) for the structural analysis of proteins. In particular, I'm using Chimera to> > areaSES, relSESA, bfactor, kdhydro, phi, psi). These files are the inputs of the pipeline. However, currently the files are exported manually, and, for the purpose of building a fully automated pipeline, it would be great to also automate this step of calculating the attributes and exporting their respective files.
I searched a lot, and tried some ways to achieve such an automation (using Chimera), but nothing worked. And I also considered using ChimeraX. In particular, I went through ChimeraX Programming Manual ( https://www.cgl.ucsf.edu/chimerax/docs/devel/index.html#), but, if I understood correctly, I'd only be able to import chimerax and use its functions in the Python interpreter within ChimeraX (Tools >> General >> Shell). At first, I'd like to import chimerax as a module in a Python interpreter outside of ChimeraX, so that manually opening ChimeraX wouldn't be necessary in order to save the files with the residues' attributes. But, from some other threads in the mailing list, I found that it wouldn't be possible (right?)
But I also found out that I could write a .py script which calculates and exports the files with the residues' properties, and then run it with ChimeraX application from the command-line, something like: *chimerax --nogui myscript.py* If that works, I think that my automation problem would be solved! The only problem is that I really couldn't figure out the Python code to calculate and export the aforementioned residues' >>> find what I need, nor more detailed documentation).
Given that, I'd like to know if anyone has done something like this, and/or have any guidance on how I could proceed.
I really appreciate any help you can provide! (And thanks to Tom Goddard for suggesting moving the discussion here to the ChimeraX mailing list).
Thank you so much, André.
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
_______________________________________________ ChimeraX-users mailing list ChimeraX-users@cgl.ucsf.edu Manage subscription: https://www.rbvi.ucsf.edu/mailman/listinfo/chimerax-users
participants (3)
-
André
-
Christian Tüting
-
Elaine Meng