[Chimera-users] Match->Align command line option?

Eric Pettersen pett at cgl.ucsf.edu
Wed Sep 12 14:10:51 PDT 2012

On Sep 12, 2012, at 11:16 AM, Chetanya Pandya wrote:

> Hello,
> I want to superimpose multiple structure sets and get the corresponding multiple sequence alignments using Chimera. I've been using the Match->Align option from the Tools menu. Now, I want to automate the process using the Python interface.
> Unfortunately, I'm unable to find a command line option which does this. Can you help me out with this?

Hi Chetanya,
	It's a little ambiguous if you are asking about a command version of Match->Align, or how to call it from Python.  The issue is moot though since there currently is no command version of Match->Align, so you have to call it from Python!  I don't know how familiar you are with Python or programming with Python, but the Chimera Programmer's Guide has some info to help.


If you don't know Python at all, follow the link in the Guide to the Python Tutorial and work through that, or at least the first few sections of that.  Then for some Chimera-specific info, look at some of the Examples and the "basic primer" linked on the page.
	Assuming you've written a script that has gotten to the stage where the structures are already open and superimposed, here's the info you'll need to use the Match->Align API:

1) Getting the list of open molecules:

from chimera import openModels, Molecule
mols = openModels.list(modelTypes=[Molecule])

2) Getting the list of chains to use.  This example code assumes they're chain A:

chains = [m.sequence('A') for m in mols]

3)  Call Match->Align to create the alignment.

from StructSeqAlign import makeAlignment
mav = makeAlignment(chains)

Note that the makeAlignment call will only return the Multalign Viewer instance starting with tomorrow's daily build (i.e. I made that change today!).  Also, the makeAlignment call has a lot of optional arguments to change the parameters used in computing the alignment (e.g. cutoff, iteration, reference chain).  Look at <your Chimera>/share/StructSeqAlign/__init__.py to see what the options are if you need to change the default behavior.  (On a Mac, "<your Chimera>" is Chimera.app/Contents/Resources).

4) Save the alignment to a FASTA format file (named "x.fa") and Quit the MAV instance:

f = open("x.fa", "w")
from MultAlignViewer.formatters.saveFASTA import save
save(f, mav, mav.seqs, mav.fileMarkups)

	I hope this helps.  Since this is pretty Python-intensive, I set followups to go to the chimera-dev mailing list rather than chimera-users.


                        Eric Pettersen
                        UCSF Computer Graphics Lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20120912/e56a0917/attachment.html>

More information about the Chimera-users mailing list