[Bioperl-guts-l] bioperl-live/scripts/Bio-DB-GFF bulk_load_gff.PLS, 1.37, 1.38 fast_load_gff.PLS, 1.27, 1.28

Lincoln Stein lstein at pub.open-bio.org
Wed Mar 1 19:26:04 EST 2006


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

Modified Files:
	bulk_load_gff.PLS fast_load_gff.PLS 
Log Message:
fixed case-sensitive confusion in the two bulk loaders


Index: bulk_load_gff.PLS
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF/bulk_load_gff.PLS,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** bulk_load_gff.PLS	19 Jan 2006 16:10:21 -0000	1.37
--- bulk_load_gff.PLS	2 Mar 2006 00:26:01 -0000	1.38
***************
*** 488,493 ****
  
      my $fid     = $FID++;
!     my $gid     = $GROUPID{$group_class->[$i],$group_name->[$i]}      ||= $GID++;
!     my $ftypeid = $FTYPEID{$source,$method}          ||= $FTYPEID++;
  
      my $bin = bin($start,$stop,$db->min_bin);
--- 488,493 ----
  
      my $fid     = $FID++;
!     my $gid     = $GROUPID{lc join('',$group_class->[$i],$group_name->[$i])}  ||= $GID++;
!     my $ftypeid = $FTYPEID{lc join('',$source,$method)}                       ||= $FTYPEID++;
  
      my $bin = bin($start,$stop,$db->min_bin);
***************
*** 507,511 ****
      }
      else {
!       $FH{ FGROUP() }->print(    join("\t",$gid,$group_class->[$i],$group_name->[$i]),"\n")    unless $DONE{"G$gid"}++;
      }
      $FH{ FTYPE()  }->print(    join("\t",$ftypeid,$method,$source),"\n"                   ) unless $DONE{"T$ftypeid"}++;
--- 507,511 ----
      }
      else {
!       $FH{ FGROUP() }->print(    join("\t",$gid,$group_class->[$i],$group_name->[$i]),"\n") unless $DONE{"G$gid"}++;
      }
      $FH{ FTYPE()  }->print(    join("\t",$ftypeid,$method,$source),"\n"                   ) unless $DONE{"T$ftypeid"}++;
***************
*** 585,603 ****
    my $success = 1;
    my $TERMINATEDBY = $bWINDOWS ? q( LINES TERMINATED BY '\r\n') : ''; 
!   foreach (@files) {
!     my $table = function_to_table($_,$ADAPTOR);
      my $sql = join ('; ',
  		    "lock tables $table write",
  		    "delete from $table",
! 		    "load data $LOCAL infile '$tmpdir/$_.$$' replace into table $table $TERMINATEDBY",
! 		    "analyze table $table",
  		    "unlock tables");
      my $command = MYSQL . qq[$AUTH -s -e "$sql"];
      $command =~ s/\n/ /g;
      $success &&= system($command) == 0;
!     unlink "$tmpdir/$_.$$";
    }
    printf STDERR "Total load time %5.2fs\n",(time() - $start) if $timer;
!   warn "done...\n";
  
    if ($success) {
--- 585,614 ----
    my $success = 1;
    my $TERMINATEDBY = $bWINDOWS ? q( LINES TERMINATED BY '\r\n') : ''; 
!   for my $f (@files) {
!     my $table = function_to_table($f,$ADAPTOR);
!     warn "load data $LOCAL infile '$tmpdir/$f.$$' replace into table $table $TERMINATEDBY";
      my $sql = join ('; ',
  		    "lock tables $table write",
  		    "delete from $table",
! 		    "load data $LOCAL infile '$tmpdir/$f.$$' replace into table $table $TERMINATEDBY",
  		    "unlock tables");
      my $command = MYSQL . qq[$AUTH -s -e "$sql"];
      $command =~ s/\n/ /g;
      $success &&= system($command) == 0;
!     unlink "$tmpdir/$f.$$";
    }
    printf STDERR "Total load time %5.2fs\n",(time() - $start) if $timer;
!   print STDERR "done...\n";
! 
!   print STDERR "Analyzing/optimizing tables. You will see database messages...\n";
!   $start = time();
!   my $sql = '';
!   for my $f (@files) {
!     my $table = function_to_table($f,$ADAPTOR);
!     $sql       .= "analyze table $table;";
!   }
!   my $command = MYSQL . qq[$AUTH -N -s -e "$sql"];
!   $success &&= system($command) == 0;
!   printf STDERR "Optimization time time %5.2fs\n",(time() - $start);
  
    if ($success) {

Index: fast_load_gff.PLS
===================================================================
RCS file: /home/repository/bioperl/bioperl-live/scripts/Bio-DB-GFF/fast_load_gff.PLS,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** fast_load_gff.PLS	19 Jan 2006 16:10:21 -0000	1.27
--- fast_load_gff.PLS	2 Mar 2006 00:26:01 -0000	1.28
***************
*** 238,241 ****
--- 238,242 ----
    my $command =<<END;
  $MYSQL $AUTH
+ -N
  -s
  -e "lock tables $_ write; $delete; load data $local infile '$file' replace into table $_; unlock tables; $analyze"
***************
*** 357,362 ****
  
      my $fid     = $FID++;
!     my $gid     = $GROUPID{$group_class,$group_name} ||= $GID++;
!     my $ftypeid = $FTYPEID{$source,$method}          ||= $FTYPEID++;
  
      my $bin = bin($start,$stop,$db->min_bin);
--- 358,363 ----
  
      my $fid     = $FID++;
!     my $gid     = $GROUPID{lc join('',$group_class,$group_name)} ||= $GID++;
!     my $ftypeid = $FTYPEID{lc join('',$source,$method)}          ||= $FTYPEID++;
  
      my $bin = bin($start,$stop,$db->min_bin);
***************
*** 364,368 ****
      $FH{ FGROUP() }->print(    join("\t",$gid,$group_class,$group_name),"\n"              ) unless $DONE{"fgroup$;$gid"}++;
      $FH{ FTYPE()  }->print(    join("\t",$ftypeid,$method,$source),"\n"                   ) unless $DONE{"ftype$;$ftypeid"}++;
!     
      foreach (@$attributes) {
        my ($key,$value) = @$_;
--- 365,369 ----
      $FH{ FGROUP() }->print(    join("\t",$gid,$group_class,$group_name),"\n"              ) unless $DONE{"fgroup$;$gid"}++;
      $FH{ FTYPE()  }->print(    join("\t",$ftypeid,$method,$source),"\n"                   ) unless $DONE{"ftype$;$ftypeid"}++;
! 
      foreach (@$attributes) {
        my ($key,$value) = @$_;



More information about the Bioperl-guts-l mailing list