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

Annotation of /FigKernelScripts/load_coupling.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (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 :     Trace("Re-creating PCH table.") if T(2);
31 :     $dbf->reload_table('all', "pchs",
32 :     "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),
33 :     inden13 varchar(6), inden24 varchar(6), para3 integer, para4 integer, rep char(1)",
34 :     { pchs_ix => "peg1, peg2" }
35 :     );
36 :     Trace("Reading PCH directory.") if T(2);
37 :     @files = grep { (-s "$pchD/$_") } OpenDir($pchD, 1);
38 :     foreach $file (@files) {
39 :     Trace("Loading PCH data from $file.") if T(3);
40 : overbeek 1.1 $dbf->load_table( tbl => "pchs",
41 : parrello 1.5 file => "$pchD/$file" );
42 : overbeek 1.1 }
43 : parrello 1.5 Trace("Finishing PCH load.") if T(2);
44 :     $dbf->finish_load('all', 'pchs');
45 : overbeek 1.1
46 : parrello 1.5 Trace("Couplings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3