<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; ">Hi Michael,<div><span class="Apple-tab-span" style="white-space:pre"> </span>If you don't superimpose the structures then Match->Align won't give a very good result. As per it's name, Match->Align takes "matched" (superimposed) structures and produces an alignment based on that superimposition. What you are doing now is basically identical to running MatchMaker with your first sequence as the reference sequence. If that's what you want to do then just run MatchMaker (using the matchmaker command for instance) and make sure it creates an MAV instance (i.e. add "show true" to the command arguments), find the MatchMaker instance (details below) and use it to save the Stockholm file.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Here's the tricky code to find the MAV instance:</div><div><br></div><div>def findMAV():</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>from chimera.extension import manager</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>from MultAlignViewer.MAViewer import MAViewer</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>mavs = [inst for inst in manager.instances if isinstance(inst, MAViewer)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if not mavs:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>raise AssertionError("No MAV instances")</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>return mavs[-1]</div><div>mav = findMAV()</div><div><br></div><div>Then you use basically the same code I gave before for saving the Stockholm file except that 'seqs' is just 'mav.seqs' and you don't have to construct a fakeMAV instance, just use the actual MAV instance you have.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>You probably want to close each pair of structures after getting the alignment so that there's no chance that findMAV will return the wrong instance (I don't think it will anyway). If it is a problem to do so, then make the MAV quit instead by calling mav.Quit().</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>This whole process will only work with the graphical user interface available (i.e. not in the "headless" version of Chimera) since it needs the MAV dialog, whereas the process I gave the last time could be run in the headless version.</div><div><br></div><div>--Eric</div><div><br></div><div><div><div>On Jun 13, 2014, at 12:53 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>thank you for your answer, but I'm not sure if this is what I need. When I did it by mouse clicking I did my alignments without superimposing structures.</div><div><br></div><div>
I did:</div><div>Favourites -> sequence</div><div>then selected first one out of two, and then edit -> Add sequence -> from structure tab</div><div>here selected second structure, and checked "Include secondary structure score (30%)", and apply. The final alignment is much better in my case, than those made by match -> align. Results in printscreen below.</div>
<div><br></div><div>Is there a way to do this by script?</div><div><br></div><div><span><image.png></span><br></div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">
--</div><div style="font-family:arial,sans-serif;font-size:13px">yours sincerely</div><div style="font-family:arial,sans-serif;font-size:13px">Michael Kadlof</div><div style="font-family:arial,sans-serif;font-size:13px">University of Warsaw</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-05-21 22:01 GMT+02:00 Eric Pettersen <span dir="ltr"><<a href="mailto:pett@cgl.ucsf.edu" target="_blank">pett@cgl.ucsf.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div class=""><div>On May 21, 2014, at 3:54 AM, Michał Kadlof <<a href="mailto:ramidas@gmail.com" target="_blank">ramidas@gmail.com</a>> wrote:</div><br><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 style="white-space:pre-wrap"> </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" target="_blank">http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html</a></div><div><br></div><div><span style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </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 style="white-space:pre-wrap"> </span>m0, m1 = models</div>
<div>else:</div><div><span style="white-space:pre-wrap"> </span>m1, m0 = models</div><div>chains = [m0.sequence('A'), m1.sequence('B')]</div><div><br></div><div>--Eric</div><br><div>
<span style="border-collapse: separate; border-spacing: 0px; font-family: Helvetica; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; "><div style="margin: 0px; ">
<font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> <span> </span></span>Eric Pettersen</font></div><div style="margin: 0px; "><font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> <span> </span></span>UCSF Computer Graphics Lab</font></div><div style="margin: 0px; "><font face="Helvetica" size="5" style="font:16.0px Helvetica"><span> </span><a href="http://www.cgl.ucsf.edu/" target="_blank">http://www.cgl.ucsf.edu</a></font></div>
<br></span>
</div>
<br></div></blockquote></div><br></div></div>
_______________________________________________<br>Chimera-users mailing list<br><a href="mailto:Chimera-users@cgl.ucsf.edu">Chimera-users@cgl.ucsf.edu</a><br>http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users<br></blockquote></div><br></div></body></html>