<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; "><div><div>On May 21, 2014, at 3:54 AM, Michał Kadlof <<a href="mailto:ramidas@gmail.com">ramidas@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hello,<div><br></div><div>I would like to ask if there is any quick way to make aligment (with secondary structure score included) beetwen two homologous protein structures, and save them in Stockholm format (information about missing residues is needed). I have houndreds of such pairs, and it would be very helpfull to do it by script for headless Chimera.</div></div></blockquote><br></div><div>Hi Michał,</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Well, depending on your definition of "quick", the answer is a qualified yes. The first thing would be to look through this primer for looping through data files and doing things with them in Chimera:</div><div><br></div><div><a href="http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html</a></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>The second thing to know is that you can superimpose two structures (with secondary structures considered) with the "matchmaker" (or "mm") command. Type "help matchmaker" in Chimera's command line to see the help page with the command's options.</div><span class="Apple-tab-span" style="white-space:pre"> </span>The tricky part is running Match->Align to generate an alignment based on the superposition without using the graphical interface, and then saving the results in Stockholm format. You will need to use the Python interface to Match->Align, basically:<div><br></div><div>from StructSeqAlign import makeAlignment</div><div>seqs = makeAlignment(chains, makeMAV=False)</div><div>class fakeMAV:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>fileAttrs = {}</div><div>from MultAlignViewer.formatters import saveStockholm</div><div>f = open("output.sto", "w")</div><div>saveStockholm.save(f, fakeMAV(), seqs, {})</div><div>f.close()</div><div><br></div><div>Note that makeAlignment() has additional optional arguments for changing the alignment parameters from their defaults. If you look at the code I think they're reasonably self-explanatory (e.g. circular=True/False).</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>So the main question is what is the 'chains' argument to the makeAlignment() call? Well, it's a list of the chains you want in the alignment. Let's say you want to match chain A from model 0 to chain B of model 1. You'd need code like this (which assumes you have just those two models open):</div><div><br></div><div>from chimera import openModels, Molecule</div><div>models = openModels.list(modelTypes=[Molecule])</div><div>if models[0].id == 0:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>m0, m1 = models</div><div>else:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>m1, m0 = models</div><div>chains = [m0.sequence('A'), m1.sequence('B')]</div><div><br></div><div>--Eric</div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>Eric Pettersen</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> <span class="Apple-converted-space"> </span></span>UCSF Computer Graphics Lab</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="5" style="font: 16.0px Helvetica"><span class="Apple-converted-space"> </span><a href="http://www.cgl.ucsf.edu">http://www.cgl.ucsf.edu</a></font></p><br class="Apple-interchange-newline"></span>
</div>
<br></body></html>