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

Annotation of /FigKernelScripts/load_coupling.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : olson 1.7 #
2 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 : overbeek 1.1
19 :     # -*- perl -*-
20 :    
21 :     use FIG;
22 : parrello 1.5 use Tracer;
23 :    
24 : overbeek 1.1 my $fig = new FIG;
25 :    
26 : overbeek 1.3 # usage: load_coupling
27 : overbeek 1.1
28 : olson 1.4 $pchD = "$FIG_Config::data/CouplingData/PCHs";
29 :     $scores = "$FIG_Config::data/CouplingData/scores";
30 : overbeek 1.1
31 :     use DBrtns;
32 :    
33 : parrello 1.5 if (!(-d $pchD)) {
34 :     Trace("Coupling directory $pchD not found.") if T(1);
35 :     exit;
36 :     } elsif (!(-s $scores)) {
37 :     Trace("Coupling data file $scores not found.") if T(1);
38 :     exit;
39 :     }
40 :     Trace("Re-creating coupling table.") if T(2);
41 :     my $dbf = $fig->db_handle;
42 :     $dbf->reload_table('all', 'fc_pegs',
43 :     "peg1 varchar(32), peg2 varchar(32), score integer",
44 :     { fc_pegs_ix => "peg1, peg2" },
45 :     $scores
46 :     );
47 : olson 1.6
48 :     Trace("Estimating size of PCH table.") if T(2);
49 :    
50 :     @files = grep { (-s $_) } map { "$pchD/$_" } OpenDir($pchD, 1);
51 :    
52 :     my($row_size, $max_rows) = $dbf->estimate_table_size(\@files);
53 :    
54 :     Trace("Re-creating PCH table with row_size=$row_size max_rows=$max_rows.") if T(2);
55 :    
56 : parrello 1.5 $dbf->reload_table('all', "pchs",
57 :     "peg1 varchar(32), peg2 varchar(32), peg3 varchar(32), peg4 varchar(32),
58 :     inden13 varchar(6), inden24 varchar(6), para3 integer, para4 integer, rep char(1)",
59 : olson 1.6 { pchs_ix => "peg1, peg2" }, undef, undef, undef, [$row_size, $max_rows]
60 : parrello 1.5 );
61 : olson 1.6
62 : parrello 1.5 Trace("Reading PCH directory.") if T(2);
63 : olson 1.6
64 : parrello 1.5 foreach $file (@files) {
65 :     Trace("Loading PCH data from $file.") if T(3);
66 : overbeek 1.1 $dbf->load_table( tbl => "pchs",
67 : olson 1.6 file => $file );
68 : overbeek 1.1 }
69 : parrello 1.5 Trace("Finishing PCH load.") if T(2);
70 :     $dbf->finish_load('all', 'pchs');
71 : overbeek 1.1
72 : parrello 1.5 Trace("Couplings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3