[Bioperl-guts-l] bioperl-live/Bio/DB/GFF/Adaptor dbi.pm,1.56,1.57

Lincoln Stein lstein at pub.open-bio.org
Wed Jul 6 19:46:52 EDT 2005


Update of /home/repository/bioperl/bioperl-live/Bio/DB/GFF/Adaptor
In directory pub.open-bio.org:/tmp/cvs-serv16705/Bio/DB/GFF/Adaptor

Modified Files:
	dbi.pm 
Log Message:
speculative changes to prevent some versions of mysql from "missing" features due to mysql floating point comparison problems


Index: dbi.pm
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/Bio/DB/GFF/Adaptor/dbi.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -C2 -d -r1.56 -r1.57
*** dbi.pm	20 Jun 2005 20:27:48 -0000	1.56
--- dbi.pm	6 Jul 2005 23:46:49 -0000	1.57
***************
*** 48,51 ****
--- 48,55 ----
  use constant DNA_CHUNK_SIZE  => 2000;
  
+ # for debugging fbin optimization
+ use constant EPSILON  => 1e-7;  # set to zero if you trust mysql's floating point comparisons
+ use constant OPTIMIZE => 1;     # set to zero to turn off optimization completely
+ 
  ##############################################################################
  
***************
*** 1941,1945 ****
    my $tier = $maxbin;
    while ($tier >= $minbin) {
!     my ($tier_start,$tier_stop) = (bin_bot($tier,$start),bin_top($tier,$stop));
      if ($tier_start == $tier_stop) {
        push @bins,'fbin=?';
--- 1945,1949 ----
    my $tier = $maxbin;
    while ($tier >= $minbin) {
!     my ($tier_start,$tier_stop) = (bin_bot($tier,$start)-EPSILON(),bin_top($tier,$stop)+EPSILON());
      if ($tier_start == $tier_stop) {
        push @bins,'fbin=?';
***************
*** 1961,1968 ****
    my ($start,$stop) = @_;
  
!   my ($bq, at bargs)   = $self->bin_query($start,$stop);
!   my ($iq, at iargs) = $self->overlap_query_nobin($start,$stop);
!   my $query = "($bq)\n\tAND $iq";
!   my @args  = (@bargs, at iargs);
  
    return wantarray ? ($query, at args) : $self->dbh->dbi_quote($query, at args);
--- 1965,1979 ----
    my ($start,$stop) = @_;
  
!   my ($query, at args);
!   my ($iq, at iargs)   = $self->overlap_query_nobin($start,$stop);
!   if (OPTIMIZE) {
!     my ($bq, at bargs)   = $self->bin_query($start,$stop);
!     $query = "($bq)\n\tAND $iq";
!     @args  = (@bargs, at iargs);
!   }
!   else {
!     $query = $iq;
!     @args  = @iargs;
!   }
  
    return wantarray ? ($query, at args) : $self->dbh->dbi_quote($query, at args);



More information about the Bioperl-guts-l mailing list