[Bioperl-l] Bio::Root::Exception when using Bio::Seq

Chris Fields cjfields at uiuc.edu
Tue Jun 20 17:55:28 UTC 2006


> -----Original Message-----
> From: Clarke, Wayne [mailto:ClarkeW at AGR.GC.CA]
> Sent: Tuesday, June 20, 2006 11:58 AM
> To: Chris Fields
> Cc: bioperl-l at lists.open-bio.org
> Subject: RE: [Bioperl-l] Bio::Root::Exception when using Bio::Seq
> 
> 
> The Bioperl version is 1.4, the OS is Redhat linux fedora core 4, the
> trace is
> STACK: Error::throw
> STACK: Bio::Root::Root::throw
> /usr/lib/perl5/site_perl/5.8.0/Bio/Root/Root.pm:328
> STACK: Bio::PrimarySeq::seq
> /usr/lib/perl5/site_perl/5.8.0/Bio/PrimarySeq.pm:267
> STACK: Bio::PrimarySeq::new
> /usr/lib/perl5/site_perl/5.8.0/Bio/PrimarySeq.pm:217
> STACK: Bio::Seq::new /usr/lib/perl5/site_perl/5.8.0/Bio/Seq.pm:498
> STACK: /home/wayne/bin/mast_fasta.pl:59
> 
> And the full script is attached.

Have you tried a newer version of Bioperl to see if it fixed the issue?  v.
1.5.1 has been out for a bit now and it's pretty stable.

> However I would like to clarify that the actual sequence is not ACTG*,
> this was a notation to represent that I had checked it to be sure that
> it was a valid DNA sequence but due to confidentiality I cannot disclose
> the actual sequence. I know this makes it more difficult and that I
> perhaps should have been clearer about this originally. 

That's not a problem.  We run into that here a bit.  Example data is fine.

> The $handle is a
> Bio::SeqIO object. When I use Data::Dumper I get a printout of the clone
> name
> 
> 'Clone_Name' => 'sJ1485'
>         };
> then the error message. I hope this is more helpful than my last
> message.
> 
> Thanks, Wayne

Make sure you aren't using bioperl-specific methods when you run
Data::Dumper on your hash or the script crashes.

Okay, I was able to reproduce your error using PrimarySeq from v. 1.4 (BTW,
the error message changes if you use a newer version of Bioperl but it is
still there).  See if you can follow me here...

I used this script:
-------------------------
use Bio::Seq;
use Bio::SeqIO;
use Data::Dumper;

my $hash = {'Clone'     => 'test',
            'Sequence'  => 'ACTG*'};

my $seqout = Bio::SeqIO->new (-format   => 'fasta',
                              -fh       => \*STDOUT);

print Dumper($hash);

my $seq = Bio::Seq->new(-seq            => $hash->{'Sequence'},
                        -display_id     => $hash->{'Clone'});

$seqout->write_seq($seq);
-------------------------

And everything works fine, with this output:

$VAR1 = {
          'Clone' => 'test',
          'Sequence' => 'ACTG*'
        };
>test
ACTG*

Changing the anonymous hash to this causes the crash and error.

my $hash = {'Clone'     => 'test',
            'Sequence'  => ['ACTG*']};

Gets this:

$VAR1 = {
          'Clone' => 'test',
          'Sequence' => [
                          'ACTG*'
                        ]
        };

-------------------- WARNING ---------------------
MSG: seq doesn't validate, mismatch is 1
---------------------------------------------------

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: Attempting to set the sequence to [ARRAY(0x2354b0)] which does not look
healthy
STACK: Error::throw
STACK: Bio::Root::Root::throw C:\Perl\src\bioperl\core/Bio/Root/Root.pm:328
STACK: Bio::PrimarySeq::seq C:\Perl\src\bioperl\core/Bio/PrimarySeq.pm:268
STACK: Bio::PrimarySeq::new C:\Perl\src\bioperl\core/Bio/PrimarySeq.pm:217
STACK: Bio::Seq::new C:\Perl\src\bioperl\core/Bio/Seq.pm:497
STACK: C:\Perl\Scripts\seq-test\test.pl:17
-----------------------------------------------------------

It could be that the sequence data is stored in another complex data type
(object, hash) that's causing the problem.  Looks like you retrieve your
hash from another method ('my $hash = $sth->fetchrow_hashref()'); you might
want to check that method to make sure you're getting the right kind of data
into your hash.
 
Chris






More information about the Bioperl-l mailing list