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

View of /FigKernelScripts/load_coupling.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (download) (as text) (annotate)
Mon Dec 5 18:56:37 2005 UTC (14 years ago) by olson
Branch: MAIN
CVS Tags: caBIG-05Apr06-00, caBIG-13Feb06-00
Changes since 1.6: +17 -0 lines
Add license words.

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#


# -*- perl -*-

use FIG;
use Tracer;

my $fig = new FIG;

# usage: load_coupling

$pchD   = "$FIG_Config::data/CouplingData/PCHs";
$scores = "$FIG_Config::data/CouplingData/scores";

use DBrtns;

if (!(-d $pchD)) {
    Trace("Coupling directory $pchD not found.") if T(1);
    exit;
} elsif (!(-s $scores)) {
    Trace("Coupling data file $scores not found.") if T(1);
    exit;
}
Trace("Re-creating coupling table.") if T(2);
my $dbf = $fig->db_handle;
$dbf->reload_table('all', 'fc_pegs',
                   "peg1 varchar(32), peg2 varchar(32), score integer",
                   { fc_pegs_ix => "peg1, peg2" },
                   $scores
          );

Trace("Estimating size of PCH table.") if T(2);

@files = grep { (-s $_) } map { "$pchD/$_" }  OpenDir($pchD, 1);

my($row_size, $max_rows) = $dbf->estimate_table_size(\@files);

Trace("Re-creating PCH table with row_size=$row_size max_rows=$max_rows.") if T(2);

$dbf->reload_table('all', "pchs",
                   "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)",
                    { pchs_ix => "peg1, peg2" }, undef, undef, undef, [$row_size, $max_rows]
          );

Trace("Reading PCH directory.") if T(2);

foreach $file (@files) {
    Trace("Loading PCH data from $file.") if T(3);
    $dbf->load_table( tbl => "pchs",
                      file => $file );
}
Trace("Finishing PCH load.") if T(2);
$dbf->finish_load('all', 'pchs');

Trace("Couplings loaded.") if T(2);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3