<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I guess I’m going to provide “hints” again rather than full-blown code segments…<div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 25, 2017, at 12:18 PM, Oliver Clarke <<a href="mailto:olibclarke@gmail.com" class="">olibclarke@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Hi,<br class=""><br class="">I’d like to do the following (presumably with a python script):<br class=""><br class="">For each pair of Calphas in two identical structures A and B:<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>Get list of other Calphas within distance cutoff of Calpha(0) for each conformation (say 10 Å);<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>For each Calpha in list:<br class=""><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space:pre"> </span>Calc distance difference diff_dist between Calpha(0—>A), Calpha(0—>B)<span class="Apple-tab-span" style="white-space:pre"> </span><br class=""><span class="Apple-tab-span" style="white-space:pre"> </span>average(diff_dist) over list and assign to attribute<br class=""><br class="">So more or less, I think I need to <br class=""><br class="">(1) iterate through all Calphas of the first structure (this part I get); <br class=""><br class="">(2) check if there is an equivalent Calpha in the second structure (same residue number and chain I guess?); <br class=""></div></div></blockquote><div><br class=""></div>If your input files are basically identical except for coordinate positions, then the list of atoms in each structure will be in the same order. Therefore, if <i class="">a1</i> is an atom in structure <i class="">mol1</i>, you can get it’s position in the atom list with:</div><div><br class=""></div><div><i class="">index = mol1.atoms.index(a1)</i></div><div><i class=""><br class=""></i></div><div>and get the equivalent atom from another structure with:</div><div><br class=""></div><div><i class="">a2 = mol2.atoms[index]</i></div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div class=""><br class="">(3) get a list of nearby Calphas, merged between structures (not exactly sure about this but I think I found something in an example I can adapt) <br class=""></div></div></blockquote><div><br class=""></div>Well, the simplest way is to brute force the distance check, but that might be too slow — depending on how many C-alphas we’re talking about. In my code I typically use AdaptiveTree to form a 3D-space-partiioning search tree that can used repeatedly and cuts down the search tremendously. Assuming you had all your C-alpha atom in a list called <i class="">calphas</i>, you would set up the tree with:</div><div><br class=""></div><div><i class="">from chimera.CGLutil import AdaptiveTree</i></div><div><i class="">coordData = [[c.x, c.y, c.z] for c in [a.xformCoord() for a in calphas]]</i></div><div><i class="">tree = AdaptiveTree(coordData, calphas, 5.0)</i></div><div><br class=""></div><div>then you would search for C-alphas within 10.0 of <i class="">calpha0</i> with:</div><div><br class=""></div><div>crd = calpha0.xformCoord()</div><div>nearby = tree.searchTree([crd.x, crd.y, crd.z], 10.0)</div><div><br class=""></div><div><i class="">nearby</i> will be a list of atoms that <i class="">might</i> be within 10 angstroms — some will be slightly beyond 10 so you will have to filter this much smaller list yourself.</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class="">(4) calculate distances, then difference-distances between the paired structures, from each target Calpha;<br class=""></div></div></blockquote><div><br class=""></div>FYI, the distance between two atoms is <i class="">a1.xformCoord().distance(a2.xformCoord())</i></div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">(5) assign the averaged difference distance to an attribute (I think I can figure out this bit)<br class=""></div></div></blockquote><div><br class=""></div>I think you can too. :-)</div><div><br class=""></div><div>—Eric</div><div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><br class="">Any suggestions much appreciated (or if anyone can point me towards similar scripts I can adapt the would also be most welcome!)<br class=""><br class="">The intent of this is to generate an attribute representing local structural flexibility (independent of displacement) - to capture changes in the local arrangements of atoms, decoupled from rigid displacements of domains. The idea is this may be useful for highlighting hinge regions and regions that have undergone plastic deformation, without pre-aligning structures.<br class=""><br class="">Cheers<br class="">Oli<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">Chimera-users mailing list: <a href="mailto:Chimera-users@cgl.ucsf.edu" class="">Chimera-users@cgl.ucsf.edu</a><br class="">Manage subscription: <a href="http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users" class="">http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users</a><br class=""><br class=""></div></div></blockquote></div><br class=""></div></body></html>