[Bioperl-l] SimpleAlign /Bio::AlignIO; POD code doesn't work for me

Kevin Lam Koiyau ULNJUJERYDIX at spammotel.com
Tue Jun 13 21:10:04 EDT 2006


>
> Hi,
>
> Two queries with respect to SimpleAlign. I am using the following code
> based on the POD.
>
> my $in  = Bio::AlignIO->newFh(-file => $file, -format => 'fasta');
> my $out = Bio::AlignIO->newFh('-format' => 'clustalw');
> print $out $_ while <$in>;
>
> 1) is it possible to set set_displayname_flat() globally without doing
> $_->set_displayname_flat() per alignment.
>
> 2) My input files have an ID and description line for each seq in the
> alignment. When the file is converted I loose the description line. I
> know I can get the description of the sequences (e.g.
> $aln->get_seq_by_pos(2)->description()).
> How could I export the complete fasta defline including the
> description (I realize that general clustal format has a limit on the
> number of characters, but still).
>
> Regards,
> Bernd
> _______________________________________________
>
I might be totally wrong here but what I understand about the FASTA format
is that the first word  (ie no spaces) is the only true name of the seq. So
anything other than the first word is discarded. putting underscores for me
works.

on a sidenote does ur 3rd line work?
it doesn't on my 1.5rc1
I had to add the bold line which was missing in the POD doc.
dont' think it was the use strict pragma
    open MYIN,"<$file" or die "Can't open input alignment";
    open MYOUT, ">$file2" or die "can't write to output";
    my $in  = Bio::AlignIO->newFh(-fh     => \*MYIN,
                               -format => 'fasta');
    my $out = Bio::AlignIO->newFh(-fh     =>  \*MYOUT,
                               -format => 'clustalw');
    print $out $_ while <$in>;

Cheers
kevin


More information about the Bioperl-l mailing list