[Chimera-users] Scripting Question

Eric Pettersen pett at cgl.ucsf.edu
Thu Jul 30 16:44:34 PDT 2020


Hi Harrison,
	Elaine covered the writesel issue.  Sounds like you are proficient with Python, so here's a short script that writes the percentage of residues that are helix each frame to a file:

outf = open("/Users/myself/location/helix_percent.txt", "w")
from chimera import openModels, Molecule
m = openModels.list(modelTypes=[Molecule])[0]
for i, cs in enumerate(m.coordSets):
	m.activeCoordSet = cs
	numHelix = 0
	for r in m.residues:
		if r.isHelix:
			numHelix += 1
	print>>outf, "frame %d, %.1f%% helix" % (I, numHelix * 100.0 / len(m.residues))
outf.close()

You can use Chimera's Python shell (Tools→General Controls→IDLE) to nose around, use dir() on things to find attributes, and to try things out.  Feel free to ask more questions if needed.

--Eric

	Eric Pettersen
	UCSF Computer Graphics Lab


> On Jul 30, 2020, at 10:07 AM, Helmick, Harrison Dale Brent <hhelmick at purdue.edu> wrote:
> 
> To the Chimera Team, 
> 
> Hello, my name is Harrison Helmick, and I am a PhD student in Purdue University's department of food science. I hope that you all are doing well. 
> I am interested in developing more relationships between bioinformatic models and end use properties of foods, helping us understand and predict characteristics like emulsification, gelling, denaturation, etc. 
> I have been using Chimera to run molecular dynamic simulations, as well as analyze the protein structures and compare those to experimental properties. I'd like to see if there are predictable functional differences based on intermediate steps of denaturation of common seed storage proteins used in food. I have found Chimera to be super interesting and helpful in terms of my learning so far. 
> One of the characteristics I'd like to quantify is the change in secondary structure over the course of denaturation. I would like to have a script that returns the number of residues that are identified as the basic secondary structures so that I can graph the relative proportion of these structures of the course of the simulation. I'd also like to see which helices and strands are being degraded first, and I will compare that to their relative surface accessibility. 
> The way I have gone about this is to use the Chimera command per frame scripts KSDSSP, sel hex, and writesel to attempt to generate files for each frame. With a short python code, we could loop over the files to see which residue numbers disappear first and the progression of the destruction of helices, strands, etc. I haven't been able to get the dynamic file writing to work though, so I always write over the original file instead of saving it as a new one. 
> While I could probably figure out the dynamic file writing, this seems inefficient, and I was wondering if you all had a better script this process. 
> 
> Thank you, 
> 
> ​--
> Harrison Helmick
> Graduate Research Assistant, Ross Fellowship
> Kokini Lab, Purdue University
> Philip E. Nelson Hall of Food Science
> 745 Agriculture Mall Dr.
> West Lafayette, IN 47907-2009
> _______________________________________________
> Chimera-users mailing list: Chimera-users at cgl.ucsf.edu <mailto:Chimera-users at cgl.ucsf.edu>
> Manage subscription: https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users <https://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20200730/7de0cc58/attachment.html>


More information about the Chimera-users mailing list