[Bioperl-l] Bio::SimpleAlign problems

Jason Stajich jason at cgt.duhs.duke.edu
Mon Sep 8 15:31:52 EDT 2003


You need to specify the format with the -format flag, otherwise it tries
to guess based on the extension - .aln maps to clustalw I think.

$str = Bio::AlignIO->new(-file => 'testaln.aln',
                         -format=>'clustalw');
..

or
$str = Bio::AlignIO->new(-file => 'testaln.phy',
                         -format=>'phylip');

or
$str = Bio::AlignIO->new(-file => 'testaln.msf',
                         -format=>'msf');



If someone wanted to contribute something new to these modules a little
method which would guess the format by peeking at the first few lines and
could.  The Root::IO->_pushback makes this really easy to do without
worrying about reopening the file/dealing with file streams

-jason

On Mon, 8 Sep 2003, Peter Stogios wrote:

> Hello,
>
> I would like some help with Bio::SimpleAlign and Bio::AlignIO.
>
> I am trying to do some VERY simple tasks but the AlignIO module is being
> difficult in reading alignment files.  It does not seem to read many
> formats correctly.
>
> I am using the sample code included at the SimpleAlign documentation page.
> The code of interest is:
>
> $str = Bio::AlignIO->new('-file' => 'testaln.aln');
> $aln = $str->next_aln();
> print $aln->no_residues, "\n";
> print $aln->no_sequences, "\n";
>
> I have tried loading ClustalX format version 1.81, ClustalW version 1.5,
> MSF format, and PHYLIP format, without having success.  I am sure the
> alignment files are in their correct formats, since other programs can
> read them.
>
> Can someone please inform me what is the preferred format for reading by
> AlignIO and SimpleAlign?  Also, should I specify the format of the
> alignment in the Bio::AlignIO-->new line?
>
> Thank you very much in advance,
>
> Peter Stogios
>
>

--
Jason Stajich
Duke University
jason at cgt.mc.duke.edu


More information about the Bioperl-l mailing list