[Bioperl-l] SimpleAlign Question

Iain Wallace iain.m.wallace at gmail.com
Sat Apr 8 16:29:08 UTC 2006


Hi all,

I am trying to extract slices out of an alignment, but sometimes the
slice I am trying to take contains a sequence that has no residues. I
would still like to add this sequence, unfortunately I am getting this
error

------------- EXCEPTION  -------------
MSG: Got a sequence with no letters in it cannot guess alphabet []
STACK Bio::PrimarySeq::_guess_alphabet
/usr/lib/perl5/site_perl/5.8.0/Bio/PrimarySeq.pm:837
STACK Bio::PrimarySeq::seq /usr/lib/perl5/site_perl/5.8.0/Bio/PrimarySeq.pm:279
STACK Bio::SimpleAlign::slice
/usr/lib/perl5/site_perl/5.8.0/Bio/SimpleAlign.pm:794

Is there a simple way I can override this behaviour, which I think is
just validating the sequence before it adds it to the alignment.

The code I am usinge is below followed by a test alignment,

Thanks for any help

Iain
--script
use strict;

use Bio::AlignIO;
#read in the initial alignment from the command line.

my $in = $ARGV[0];

my $alignio = Bio::AlignIO->new(-file=> $in);
my $out = Bio::AlignIO->new(-file=> ">test.fasta");

       my $aln = $alignio->next_aln;
       my $new_aln = new Bio::SimpleAlign;
       $new_aln=$aln->slice(1,10);
       $out->write_aln($new_aln);

--sample file

>1huma/1-7
APMGSDP---
>1b3aa/1-5
-PYSS-D---
>2eot/1-5
-----GPASV
>1rhpa/1-1
---------D
>1mgsa/1-6
----ASVATE
>1mi2a/1-6
----AVVASE
>1roda/1-4
------SAKE
>1il8a/1-3
-------AKE
>1sdf/1-6
----KPVSLS




More information about the Bioperl-l mailing list