[Bioperl-l] SimpleAlign Question

Brian Osborne osborne1 at optonline.net
Tue Apr 11 03:32:59 UTC 2006


Iain,

You can pass a third argument to slice(), it tells the method to keep
sequences with no valid characters, e.g.:

$aln2 = $aln1->slice(22,33,1);

I'll document this a bit more...


Brian O.

On 4/8/06 12:29 PM, "Iain Wallace" <iain.m.wallace at gmail.com> wrote:

> 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
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l





More information about the Bioperl-l mailing list