[Bioperl-l] Cannot guess alphabet error

Jason Stajich jason.stajich at duke.edu
Thu Sep 22 23:12:21 EDT 2005


 From Bio::PrimarySeq

Title   : seq
Usage   : $string    = $obj->seq()
Function: Returns the sequence as a string of letters. The
            case of the letters is left up to the implementer.
            Suggested cases are upper case for proteins and lower  
case for
            DNA sequence (IUPAC standard), but you should not rely on  
this.
Returns : A scalar
Args    : Optionally on set the new value (a string). An optional second
            argument presets the alphabet (otherwise it will be  
guessed).
            Both parameters may also be given in named paramater style
            with -seq and -alphabet being the names.

You can pass in the alphabet as a second option:
$myseq->seq('---','dna');


On Sep 22, 2005, at 10:35 PM, Wes Barris wrote:

> Jason Stajich wrote:
>
>
>> use Bio::LocatableSeq for building alignments - these can be  
>> '---'  seqs.  You'll see these are required when adding sequences  
>> to a  BIo::SimpleAlign object for writing out to msf.
>>
>
> Actually, I am.  In order to make the sample code a simple as  
> possible,
> I changed it to PrimarySeq.  This code also produces the error:
>
> #!/usr/bin/perl -w
> use strict;
> use Bio::LocatableSeq;
> my $myseq = new Bio::LocatableSeq(-seq=>'AGCT', -id=>'myseq', - 
> alphabet=>'dna');
> $myseq->alphabet('dna');
> $myseq->seq('----');
>
>
>
>
>> On Sep 22, 2005, at 10:14 PM, Wes Barris wrote:
>>
>>> Hi,
>>>
>>> The following code produces the error shown.  What is the correct  
>>> way
>>> to set the alphabet of a primary (or locatable) seq?
>>>
>>> #!/usr/bin/perl -w
>>> use strict;
>>> use Bio::PrimarySeq;
>>> my $myseq = new Bio::PrimarySeq(-seq=>'AGCT', -id=>'myseq', -  
>>> alphabet=>'dna');
>>> $myseq->alphabet('dna');
>>> $myseq->seq('----');
>>>
>>>
>>> ------------- 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.5/Bio/PrimarySeq.pm:837
>>> STACK Bio::PrimarySeq::seq /usr/lib/perl5/site_perl/5.8.5/Bio/  
>>> PrimarySeq.pm:279
>>> STACK toplevel /home/wes/soft/ace/test.pl:6
>>>
>>> It might seem to be a silly thing to want to do (setting a   
>>> sequences to
>>> a series of dashes).  My reason for wanting to do this is  
>>> involves the
>>> creation of an alighment (msf) file.
>>>
>>> I am using a fresh version of bioperl-live, perl 5.8.5, Linux  
>>> RHEL  4.1.
>>> -- 
>>> Wes Barris
>>> E-Mail: Wes.Barris at csiro.au
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at portal.open-bio.org
>>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>>
>> -- 
>> Jason Stajich
>> Duke University
>> http://www.duke.edu/~jes12
>>
>
>
> -- 
> Wes Barris
> E-Mail: Wes.Barris at csiro.au
>

--
Jason Stajich
Duke University
http://www.duke.edu/~jes12




More information about the Bioperl-l mailing list