[Chimera-users] easy way to make alignments in chimera

Eric Pettersen pett at cgl.ucsf.edu
Fri Jun 13 10:19:02 PDT 2014


Hi Michael,
	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.
	Here's the tricky code to find the MAV instance:

def findMAV():
	from chimera.extension import manager
	from MultAlignViewer.MAViewer import MAViewer
	mavs = [inst for inst in manager.instances if isinstance(inst, MAViewer)
	if not mavs:
		raise AssertionError("No MAV instances")
	return mavs[-1]
mav = findMAV()

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.
	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().
	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.

--Eric

On Jun 13, 2014, at 12:53 AM, Michał Kadlof <ramidas at gmail.com> wrote:

> Hello,
> 
> 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.
> 
> I did:
> Favourites -> sequence
> then selected first one out of two, and then edit -> Add sequence -> from structure tab
> 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.
> 
> Is there a way to do this by script?
> 
> <image.png>
> 
> --
> yours sincerely
> Michael Kadlof
> University of Warsaw
> 
> 
> 2014-05-21 22:01 GMT+02:00 Eric Pettersen <pett at cgl.ucsf.edu>:
> On May 21, 2014, at 3:54 AM, Michał Kadlof <ramidas at gmail.com> wrote:
> 
>> Hello,
>> 
>> 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.
> 
> Hi Michał,
> 	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:
> 
> http://www.cgl.ucsf.edu/chimera/docs/ProgrammersGuide/basicPrimer.html
> 
> 	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.
> 	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:
> 
> from StructSeqAlign import makeAlignment
> seqs = makeAlignment(chains, makeMAV=False)
> class fakeMAV:
> 	fileAttrs = {}
> from MultAlignViewer.formatters import saveStockholm
> f = open("output.sto", "w")
> saveStockholm.save(f, fakeMAV(), seqs, {})
> f.close()
> 
> 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).
> 	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):
> 
> from chimera import openModels, Molecule
> models = openModels.list(modelTypes=[Molecule])
> if models[0].id == 0:
> 	m0, m1 = models
> else:
> 	m1, m0 = models
> chains = [m0.sequence('A'), m1.sequence('B')]
> 
> --Eric
> 
>                         Eric Pettersen
>                         UCSF Computer Graphics Lab
>                         http://www.cgl.ucsf.edu
> 
> 
> 
> _______________________________________________
> Chimera-users mailing list
> Chimera-users at cgl.ucsf.edu
> http://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/20140613/6dcaff89/attachment.html>


More information about the Chimera-users mailing list