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

Annotation of /FigKernelScripts/load_coupling.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (view) (download) (as text)

1 : overbeek 1.1
2 :     # -*- perl -*-
3 :    
4 :     use FIG;
5 : parrello 1.5 use Tracer;
6 :    
7 : overbeek 1.1 my $fig = new FIG;
8 :    
9 : overbeek 1.3 # usage: load_coupling
10 : overbeek 1.1
11 : olson 1.4 $pchD = "$FIG_Config::data/CouplingData/PCHs";
12 :     $scores = "$FIG_Config::data/CouplingData/scores";
13 : overbeek 1.1
14 :     use DBrtns;
15 :    
16 : parrello 1.5 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 : olson 1.6
31 :     Trace("Estimating size of PCH table.") if T(2);
32 :    
33 :     @files = grep { (-s $_) } map { "$pchD/$_" } OpenDir($pchD, 1);
34 :    
35 :     my($row_size, $max_rows) = $dbf->estimate_table_size(\@files);
36 :    
37 :     Trace("Re-creating PCH table with row_size=$row_size max_rows=$max_rows.") if T(2);
38 :    
39 : parrello 1.5 $dbf->reload_table('all', "pchs",
40 :     "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),
41 :     inden13 varchar(6), inden24 varchar(6), para3 integer, para4 integer, rep char(1)",
42 : olson 1.6 { pchs_ix => "peg1, peg2" }, undef, undef, undef, [$row_size, $max_rows]
43 : parrello 1.5 );
44 : olson 1.6
45 : parrello 1.5 Trace("Reading PCH directory.") if T(2);
46 : olson 1.6
47 : parrello 1.5 foreach $file (@files) {
48 :     Trace("Loading PCH data from $file.") if T(3);
49 : overbeek 1.1 $dbf->load_table( tbl => "pchs",
50 : olson 1.6 file => $file );
51 : overbeek 1.1 }
52 : parrello 1.5 Trace("Finishing PCH load.") if T(2);
53 :     $dbf->finish_load('all', 'pchs');
54 : overbeek 1.1
55 : parrello 1.5 Trace("Couplings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3