[Bioperl-guts-l] [14790] bioperl-live/trunk/Bio: fixed a display bug that appeared when feature start=stop=0

Lincoln Stein lstein at dev.open-bio.org
Wed Aug 6 16:25:03 EDT 2008


Revision: 14790
Author:   lstein
Date:     2008-08-06 16:25:03 -0400 (Wed, 06 Aug 2008)

Log Message:
-----------
fixed a display bug that appeared when feature start=stop=0

Modified Paths:
--------------
    bioperl-live/trunk/Bio/DB/SeqFeature/Store/DBI/mysql.pm
    bioperl-live/trunk/Bio/DB/SeqFeature/Store/berkeleydb.pm
    bioperl-live/trunk/Bio/DB/SeqFeature/Store/memory.pm
    bioperl-live/trunk/Bio/DB/SeqFeature/Store.pm
    bioperl-live/trunk/Bio/Graphics/FeatureBase.pm
    bioperl-live/trunk/Bio/Graphics/Glyph.pm
    bioperl-live/trunk/Bio/Graphics/Panel.pm

Modified: bioperl-live/trunk/Bio/DB/SeqFeature/Store/DBI/mysql.pm
===================================================================
--- bioperl-live/trunk/Bio/DB/SeqFeature/Store/DBI/mysql.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/DB/SeqFeature/Store/DBI/mysql.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -454,6 +454,13 @@
   shift->{is_temp};
 }
 
+sub attributes {
+    my $self = shift;
+    my $dbh  = $self->dbh;
+    my $a    = $dbh->selectcol_arrayref('SELECT tag FROM attributelist');
+    return @$a;
+}
+
 sub _store {
   my $self    = shift;
 

Modified: bioperl-live/trunk/Bio/DB/SeqFeature/Store/berkeleydb.pm
===================================================================
--- bioperl-live/trunk/Bio/DB/SeqFeature/Store/berkeleydb.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/DB/SeqFeature/Store/berkeleydb.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -583,7 +583,7 @@
 
   for my $tag ($obj->get_all_tags) {
     for my $value ($obj->get_tag_values($tag)) {
-      my $key = "\L${tag}:${value}\E";
+      my $key = "${tag}:${value}";
       $self->update_or_delete($delete,$db,$key,$id);
     }
   }
@@ -913,6 +913,13 @@
   $self->update_filter($filter,\@results);
 }
 
+sub attributes {
+    my $self = shift;
+    my $index = $self->index_db('attributes');
+    my %a     = map {s/:.+$//; $_=> 1} keys %$index;
+    return keys %a;
+}
+
 sub filter_by_attribute {
   my $self = shift;
   my ($attributes,$filter) = @_;

Modified: bioperl-live/trunk/Bio/DB/SeqFeature/Store/memory.pm
===================================================================
--- bioperl-live/trunk/Bio/DB/SeqFeature/Store/memory.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/DB/SeqFeature/Store/memory.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -390,6 +390,11 @@
   return @types_found;
 }
 
+sub attributes {
+    my $self = shift;
+    return keys %{$self->{_index}{attribute}};
+}
+
 sub filter_by_attribute {
   my $self = shift;
   my ($attributes,$filter) = @_;

Modified: bioperl-live/trunk/Bio/DB/SeqFeature/Store.pm
===================================================================
--- bioperl-live/trunk/Bio/DB/SeqFeature/Store.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/DB/SeqFeature/Store.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -1330,6 +1330,23 @@
   $self->_end_reindexing;
 }
 
+=head2 attributes
+
+ Title   : attributes
+ Usage   : @a = $db->attributes
+ Function: Returns list of all known attributes
+ Returns : Returns list of all known attributes
+ Args    : nothing
+ Status  : public
+
+=cut
+
+sub attributes {
+    my $self = shift;
+    shift->throw_not_implemented;
+}
+
+
 =head2 start_bulk_update,finish_bulk_update
 
  Title   : start_bulk_update,finish_bulk_update

Modified: bioperl-live/trunk/Bio/Graphics/FeatureBase.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/FeatureBase.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/Graphics/FeatureBase.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -101,7 +101,7 @@
   $self->{source}  = $arg{-source} || $arg{-source_tag} || '';
   $self->{score}   = $arg{-score}   if exists $arg{-score};
   $self->{start}   = $arg{-start};
-  $self->{stop}    = $arg{-end} || $arg{-stop};
+  $self->{stop}    = exists $arg{-end} ? $arg{-end} : $arg{-stop};
   $self->{ref}     = $arg{-seq_id} || $arg{-ref};
   for my $option (qw(class url seq phase desc attributes primary_id)) {
     $self->{$option} = $arg{"-$option"} if exists $arg{"-$option"};
@@ -418,6 +418,11 @@
     return $self->attributes('Note');
 }
 
+sub aliases {
+    my $self  = shift;
+    return $self->attributes('Alias');
+}
+
 sub low {
   my $self = shift;
   return $self->start < $self->end ? $self->start : $self->end;

Modified: bioperl-live/trunk/Bio/Graphics/Glyph.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Glyph.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/Graphics/Glyph.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -175,7 +175,7 @@
       : $self->panel->offset - 1;
   } else {
     $self->{stop} = defined $self->{feature}->end
-      ?  $self->{feature}->end
+      ? $self->{feature}->end
       : $self->panel->offset+$self->panel->length+1;
   }
 

Modified: bioperl-live/trunk/Bio/Graphics/Panel.pm
===================================================================
--- bioperl-live/trunk/Bio/Graphics/Panel.pm	2008-08-06 15:56:25 UTC (rev 14789)
+++ bioperl-live/trunk/Bio/Graphics/Panel.pm	2008-08-06 20:25:03 UTC (rev 14790)
@@ -200,7 +200,7 @@
       ? $pr - ($length - ($_- 1)) * $scale
 	: ($_-$offset-1) * $scale;
     $val = int($val + 0.5 * ($val<=>0));
-    $val = -1 if $val < 0;
+    $val = -1    if $val < 0;
     $val = $pr+1 if $val > $pr;
     push @result,$val;
   }




More information about the Bioperl-guts-l mailing list