[Bio] / FigKernelScripts / load_coupling.pl Repository:
ViewVC logotype

Diff of /FigKernelScripts/load_coupling.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3, Wed Jun 1 01:18:50 2005 UTC revision 1.6, Wed Aug 17 19:32:24 2005 UTC
# Line 2  Line 2 
2  # -*- perl -*-  # -*- perl -*-
3    
4  use FIG;  use FIG;
5    use Tracer;
6    
7  my $fig = new FIG;  my $fig = new FIG;
8    
9  # usage: load_coupling  # usage: load_coupling
10    
11  $pchD   = "$FIG_Config::fig/CouplingData/PCHs";  $pchD   = "$FIG_Config::data/CouplingData/PCHs";
12  $scores = "$FIG_Config::fig/CouplingData/scores";  $scores = "$FIG_Config::data/CouplingData/scores";
13    
14  use DBrtns;  use DBrtns;
15    
16  if (! ((-d $pchD) && (-s $scores))) { exit }  if (!(-d $pchD)) {
17        Trace("Coupling directory $pchD not found.") if T(1);
18        exit;
19    } elsif (!(-s $scores)) {
20        Trace("Coupling data file $scores not found.") if T(1);
21        exit;
22    }
23    Trace("Re-creating coupling table.") if T(2);
24    my $dbf = $fig->db_handle;
25    $dbf->reload_table('all', 'fc_pegs',
26                       "peg1 varchar(32), peg2 varchar(32), score integer",
27                       { fc_pegs_ix => "peg1, peg2" },
28                       $scores
29              );
30    
31  my $dbf = $fig->{_dbf};  Trace("Estimating size of PCH table.") if T(2);
32    
33  $dbf->drop_table( tbl => "fc_pegs" );  @files = grep { (-s $_) } map { "$pchD/$_" }  OpenDir($pchD, 1);
34  $dbf->create_table( tbl => 'fc_pegs',  
35                      flds => "peg1 varchar(32), peg2 varchar(32), score integer"  my($row_size, $max_rows) = $dbf->estimate_table_size(\@files);
36                    );  
37  $dbf->load_table( tbl => "fc_pegs",  Trace("Re-creating PCH table with row_size=$row_size max_rows=$max_rows.") if T(2);
38                    file => $scores );  
39  $dbf->create_index( idx  => "fc_pegs_ix",  $dbf->reload_table('all', "pchs",
40                      tbl  => "fc_pegs",                     "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),
41                      type => "btree",                         inden13 varchar(6), inden24 varchar(6), para3  integer, para4 integer, rep char(1)",
42                      flds => "peg1,peg2" );                      { pchs_ix => "peg1, peg2" }, undef, undef, undef, [$row_size, $max_rows]
   
 $dbf->vacuum_it("fc_pegs");  
   
 $dbf->drop_table( tbl => "pchs" );  
 $dbf->create_table( tbl => 'pchs',  
                     flds => "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),  
                              inden13 varchar(6), inden24 varchar(6), para3  integer, para4 integer, rep char(1)"  
43                    );                    );
44    
45  opendir(PCHD,$pchD) || die "could not open $pchD";  Trace("Reading PCH directory.") if T(2);
46  @files = grep { ($_ !~ /^\./) && (-s "$pchD/$_") } readdir(PCHD);  
47  foreach $file (@files)  foreach $file (@files) {
48  {      Trace("Loading PCH data from $file.") if T(3);
49      $dbf->load_table( tbl => "pchs",      $dbf->load_table( tbl => "pchs",
50                    file => "$pchD/$file" );                        file => $file );
51  }  }
52  $dbf->create_index( idx  => "pchs_ix",  Trace("Finishing PCH load.") if T(2);
53                      tbl  => "pchs",  $dbf->finish_load('all', 'pchs');
                     type => "btree",  
                     flds => "peg1,peg2" );  
   
 $dbf->vacuum_it("pchs");  
54    
55    Trace("Couplings loaded.") if T(2);

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3