[Biojava-l] How to read a protein clustal alignment?

Thomas Down td2@sanger.ac.uk
Mon, 1 Oct 2001 16:23:36 +0100

On Mon, Oct 01, 2001 at 12:15:37PM -0300, Damian D'Onia wrote:
> Hi,
>          I'm trying to read a clustal file (.ALN) that contains protein 
> sequences. Now I have a subclass of DefaultHandler which can read DNA 
> sequences from .aln files, but I don't know how to fill a SymbolList from 
> String.
> But, ProteinTools don't have a method like createDNA.

What version of BioJava are you using?  Certainly, the current
CVS version has a method ProteinTools.createProtein(String), which
seems to do what you want.

However, it would seem cleaner to remove references to particular
alphabets from your code completely.  You can do something like:

  Alphabet alpha = DNATools.getDNA();
  SymbolParser parser = alpha.getParser("token");
  SymbolList sl = parser.parse(someString);

This is effectively what's happening inside DNATools.createDNA,
and means you can just parameterize your code with a particular
Alphabet object.

Hope this helps,