Just to follow up on the Python question here, a model can have multiple sequences (one per chain), so your code should be:

from chimera import openModels
all_mods = chimera.openModels.list(modelTypes=[chimera.Molecule])
with open('output.fasta', 'w') as ofh:
     for mod in all_mods:
         for seq in mod.sequences():
             ofh.write('>%s.%s\n%s' % (mod.name, seq.chainID, seq)


What you were trying to use, mod.sequence, is a method that takes a chain ID as an argument and returns the Sequence object corresponding to that chain ID (e.g. mod.sequence(‘A’) returns the Sequence for chain A).

—Eric

On Jul 10, 2018, at 4:48 AM, Healey, Joe <J.R.J.Healey@warwick.ac.uk> wrote:

Hi Chimera Team,

I've been experiencing issues with the "Align Chains" tools that connect to Clustal and Muscle - I think ostensibly this might be because the servers are no longer available or something.

I'm happy to make the alignments myself, but to do this I'd like to try and simply export the sequences of all open models to a fasta file or similar. I know this can be done manually sequence-by-sequence thtrough the GUI.

Could you tell me what the python (or chimera syntax) would be to do this if it's possible?

I'm envisaging something to the effect of this, but I can't quite get what I need back in terms of the sequence (it returns a `bound object'?):

```
from chimera import openModels
all_mods = chimera.openModels.list(modelTypes=[chimera.Molecule])
with open('output.fasta', 'w') as ofh:
     for mod in all_mods:
         ofh.write('>%s\n%s' % (mod.name, mod.sequence)
```

Thanks,

Joe Healey

                                       
M.Sc. B.Sc. (Hons) MRSB
PhD Student
MOAC CDT, Senate House
University of Warwick
Coventry
CV47AL
Mob: +44 (0) 7536 042620  |  
Email: J.R.J.Healey@warwick.ac.uk

Jointly working in:
Waterfield Lab (WMS Microbiology and Infection Unit)
and the Gibson Lab (Warwick Chemistry)

Twitter: @JRJHealey  |  Website: MOAC Page | ORCID: orcid.org/0000-0002-9569-6738
_______________________________________________
Chimera-users mailing list: Chimera-users@cgl.ucsf.edu
Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users