[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.4, Mon Jun 20 20:09:58 2005 UTC revision 1.5, Wed Jun 22 21:23:43 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
# Line 11  Line 13 
13    
14  use DBrtns;  use DBrtns;
15    
16  if (! ((-d $pchD) && (-s $scores))) { die "Cannot find data at $pchD or $scores"; }  if (!(-d $pchD)) {
17        Trace("Coupling directory $pchD not found.") if T(1);
18  my $dbf = $fig->{_dbf};      exit;
19    } elsif (!(-s $scores)) {
20  $dbf->drop_table( tbl => "fc_pegs" );      Trace("Coupling data file $scores not found.") if T(1);
21  $dbf->create_table( tbl => 'fc_pegs',      exit;
22                      flds => "peg1 varchar(32), peg2 varchar(32), score integer"  }
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  $dbf->load_table( tbl => "fc_pegs",  Trace("Re-creating PCH table.") if T(2);
31                    file => $scores );  $dbf->reload_table('all', "pchs",
32  $dbf->create_index( idx  => "fc_pegs_ix",                     "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),
33                      tbl  => "fc_pegs",                         inden13 varchar(6), inden24 varchar(6), para3  integer, para4 integer, rep char(1)",
34                      type => "btree",                      { pchs_ix => "peg1, peg2" }
                     flds => "peg1,peg2" );  
   
 $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)"  
35                    );                    );
36    Trace("Reading PCH directory.") if T(2);
37  opendir(PCHD,$pchD) || die "could not open $pchD";  @files = grep { (-s "$pchD/$_") } OpenDir($pchD, 1);
38  @files = grep { ($_ !~ /^\./) && (-s "$pchD/$_") } readdir(PCHD);  foreach $file (@files) {
39  foreach $file (@files)      Trace("Loading PCH data from $file.") if T(3);
 {  
40      $dbf->load_table( tbl => "pchs",      $dbf->load_table( tbl => "pchs",
41                    file => "$pchD/$file" );                    file => "$pchD/$file" );
42  }  }
43  $dbf->create_index( idx  => "pchs_ix",  Trace("Finishing PCH load.") if T(2);
44                      tbl  => "pchs",  $dbf->finish_load('all', 'pchs');
                     type => "btree",  
                     flds => "peg1,peg2" );  
   
 $dbf->vacuum_it("pchs");  
45    
46    Trace("Couplings loaded.") if T(2);

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3