[Bioperl-l] SeqIO fails on masked sequences

Wes Barris wes.barris at csiro.au
Thu Dec 16 17:27:23 EST 2004


Nathan Haigh wrote:
> When I use the script you supplied, I get the exception shown below.
> 
> I'll try to get to the bottom of this.
> 
> In the meantime, what OS are you both using and what version of Bioperl?
> 
> Nathan

Hi Nathan,

I am using bioperl-live (as of about a month ago).  I too remember
this working properly back with bioperl-1.4.

Redhat 8 and Redhat 9.

> 
> 
> ------------- EXCEPTION: Bio::Root::Exception -------------
> MSG: Got a sequence with no letters in it cannot guess alphabet []
> STACK: Error::throw
> STACK: Bio::Root::Root::throw I:/Programming/Perl/perl5.8.0/site/lib/Bio/Root/Root.pm:328
> STACK: Bio::PrimarySeq::_guess_alphabet I:/Programming/Perl/perl5.8.0/site/lib/Bio/PrimarySeq.pm:837
> STACK: Bio::Seq::SeqFastaSpeedFactory::create I:/Programming/Perl/perl5.8.0/site/lib/Bio/Seq/SeqFastaSpeedFactory.pm:134
> 
> STACK: Bio::SeqIO::fasta::next_seq I:/Programming/Perl/perl5.8.0/site/lib/Bio\SeqIO\fasta.pm:141
> STACK: test.pl:9
> -----------------------------------------------------------
> 
> 
>>-----Original Message-----
>>From: bioperl-l-bounces at portal.open-bio.org [mailto:bioperl-l-bounces at portal.open-bio.org] On Behalf Of Marc Logghe
>>Sent: 16 December 2004 09:27
>>To: Wes Barris
>>Cc: Bioperl Mailing List
>>Subject: RE: [Bioperl-l] SeqIO fails on masked sequences
>>
>>Hi Wes,
>>
>>
>>>>Guess you can do it by setting the alphabet explicitely:
>>>>$seq_in->alphabet('dna'); # or 'rna' or 'protein'
>>>
>>>Sorry, that does not work.  I tried this and got the same error:
>>
>>Yeah, some strange things seem to happen. You can set it this way but it is not taken into account anyhow by Bio::SeqIO::fasta:
> 
> when
> 
>>it is set and there is a sequence found, it is boldly set to undef !!!
>>In object creation the type is guessed anyhow and in your case it ends up as protein because of the X's. It would end up as dna if
> 
> it
> 
>>were N's, though.
>>
>>
>>
>>>>Indirectly, you can do it also by setting the alphabet for
>>>
>>>the factory object and passing the factory object with the
>>>Bio::SeqIO constructor.
>>>
>>>Would you provide an example?
>>
>>Think that did not make sense, sorry for that.
>>
>>On the other hand I was not able to mimick your problem generating the error. I got no errors, only the fact that the alphabet was
> 
> reset
> 
>>to 'protein'. Initially I got a similar error but that was caused by the fact that $format was not set yet and I did not run using
> 
> the strict
> 
>>pragma.
>>
>>The script I used to find that out:
>>
>>#!/usr/bin/perl
>>use strict;
>>use Bio::SeqIO;
>>use Data::Dumper;
>>
>>my $format = 'fasta';
>>
>>
>>my $seq_in  = Bio::SeqIO->new(-format=>$format, -fh => \*DATA);
>>$seq_in->alphabet('dna');
>>my $seq_out = Bio::SeqIO->new(-format=>$format, -fh => \*STDOUT);
>>$seq_out->alphabet('dna');
>>my $seq = $seq_in->next_seq;
>>
>>print Data::Dumper->Dump([$seq],['seq']);
>>$seq_out->write_seq($seq);
>>
>>__DATA__
>>
>>>test
>>
>>XXXXXXXXXXXXXXXXXXXXXXXXX
>>
>>
>>I am afraid I can not be of more help here.
>>Cheers,
>>Marc
>>
>>
>>
>>_______________________________________________
>>Bioperl-l mailing list
>>Bioperl-l at portal.open-bio.org
>>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>---
>>avast! Antivirus: Inbound message clean.
>>Virus Database (VPS): 0451-1, 14/12/2004
>>Tested on: 16/12/2004 10:00:11
>>avast! is copyright (c) 2000-2003 ALWIL Software.
>>http://www.avast.com
>>
>>
> 
> 
> ---
> avast! Antivirus: Outbound message clean.
> Virus Database (VPS): 0451-1, 14/12/2004
> Tested on: 16/12/2004 10:30:08
> avast! is copyright (c) 2000-2003 ALWIL Software.
> http://www.avast.com
> 
> 
> 


-- 
Wes Barris
E-Mail: Wes.Barris at csiro.au


More information about the Bioperl-l mailing list