[Bioperl-l] problem using 'add_sub_SeqFeature' on home-made blast parsed data in mysql table

Marcus Claesson m.claesson at student.ucc.ie
Thu Nov 4 05:49:50 EST 2004


Hi!

I'm trying to make a Bio::Graphics overview of some blastx outputs that
are parsed and inserted in a Mysql table. It works fine if I treat every
HSP as a separate hit, but I want to use 'add_sub_SeqFeature' to include
additional HSPs as subfeatures in the same track.

This is how the blastx data is structured in the table (sbj_name left
out for clarity):

sbj_hit	hsp	e_value	score	q_begin	q_end	frame
5922    1       4e-31   363     163     532     1
5922    2       5e-31   362     534     864     2
6912    1       6e-27   327     310     828     0
6913    1       6e-27   327     142     828     1
6915    1       6e-27   327     187     864     2

As you can see the first hit has two HSPs so I want to add the hsp=2 row
as a subfeature. But when I run my script below I get this error
message:
Can't call method "isa" on unblessed reference at
/usr/lib/perl5/site_perl/5.8.0/Bio/SeqFeature/Generic.pm line 760,
<DATA> line 191.
This only happens when the result of the sql query contains more than
one HSP.

Any ideas of how to make it work?

Regards,
Marcus

Here's the script:

use Bio::Graphics;
use Bio::SeqFeature::Generic;
use DBI;

my $panel = Bio::Graphics::Panel->new(-length    => 10000,
                                       -width     => 600,
                                       -pad_left  => 10,
                                       -pad_right => 10,
                                      );
$panel->add_track(arrow =>Bio::SeqFeature::Generic->new(-start =>0,
							-end   =>10000),
                  -glyph   => 'arrow',
                  -tick    => 2,
                  -fgcolor => 'black',
                  -double  => 1);
my $track = $panel->add_track(-glyph        => 'graded_segments',
                              -label        => 1,
			      -strand_arrow => 1,
                              -connector    => 'dashed',
                              -bgcolor      => 'blue');

$dbh = DBI->connect($dsn,$user);
$sql = "SELECT sbj_name,sbj_count,hsp_count,e_value,score,query_begin,
query_end,frame FROM table";
$sth = $dbh->prepare($sql);
$sth->execute();
$set = $sth->fetchall_arrayref({});

$old_sbj_count = 0;
foreach $row (@{$set}) {
    my $feature = Bio::SeqFeature::Generic->new(
			-display_name => $row->{sbj_name},
			-start   => $row->{query_begin},
			-end     => $row->{query_end});

# This is where the error occur. I don't know if $row is the right way
to pass the additional HSP data.
    if ($old_sbj_count eq $row->{sbj_count}) {
	$feature->add_sub_SeqFeature($row,'EXPAND');
    }
    $old_sbj_count = $row->{sbj_count};

    $track->add_feature($feature);
}

print $panel->png;





More information about the Bioperl-l mailing list