[Bioperl-l] Use of uninitialized value in length at Bio/DB/SeqFeature/Store/DBI/mysql.pm line 1062
Dan Bolser
dan.bolser at gmail.com
Sat Mar 26 20:11:27 EDT 2011
Hi all,
I'm not sure why, but the code in Bio/DB/SeqFeature/Store/DBI/mysql.pm uses:
if (length $source_tag) {
within the '_types_sql' function to test if $source_tag is defined
(and has a length). This obviously fails when $source_tag it isn't
defined, and I see the above error message from my script when I call
the 'features' function (as shown below).
>From tests (thanks to rbuels in #bioperl) it seems the value of $type
is simply 'fwd link intensity', so:
($primary_tag,$source_tag) = split ':',$type,2;
on line 1047 leaves $source_tag undefined.
Here is my proposed fix:
diff --git a/Bio/DB/SeqFeature/Store/DBI/mysql.pm b/Bio/DB/SeqFeature/Sto
index 00103c2..dfc70c0 100644
--- a/Bio/DB/SeqFeature/Store/DBI/mysql.pm
+++ b/Bio/DB/SeqFeature/Store/DBI/mysql.pm
@@ -1057,8 +1057,8 @@ sub _types_sql {
($primary_tag,$source_tag) = split ':',$type,2;
}
- if (length $source_tag) {
- if (length($primary_tag)) {
+ if (defined $source_tag && length $source_tag) {
+ if (defined $primary_tag && length($primary_tag)) {
push @matches,"tl.tag=?";
push @args,"$primary_tag:$source_tag";
}
which seems to work. I'd write some tests, but an old bug that I can't
track down prevents me from running tests on this package
(http://bugzilla.open-bio.org/show_bug.cgi?id=2899).
Cheers,
Dan.
Here are some snippets of code to give context:
my $intensities = Bio::DB::SeqFeature::Store->
new( -adaptor => 'DBI::mysql',
-dsn => 'db:mysql.server.ac.uk',
-user => 'me',
-pass => 'secret',
-verbose => $verbose,
);
my @fwd_intensity = $intensities->
features( -seqid => 'some-id', -type => 'fwd link intensity',
-start => 10,
-end => 200,
);
More information about the Bioperl-l
mailing list