[Bio] / FortyEightMeta / remake_sims_tables.pl Repository:
ViewVC logotype

View of /FortyEightMeta/remake_sims_tables.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Mon Oct 20 16:14:09 2008 UTC (11 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: mgrast_dev_08112011, mgrast_dev_08022011, mgrast_dev_05262011, mgrast_dev_04082011, mgrast_version_3_2, mgrast_dev_12152011, mgrast_dev_06072011, mgrast_dev_10262011, mgrast_dev_02212011, mgrast_release_3_0, mgrast_dev_03252011, mgrast_rel_2008_1110_v2, mgrast_release_3_0_4, mgrast_release_3_0_2, mgrast_release_3_0_3, mgrast_release_3_0_1, mgrast_dev_03312011, mgrast_release_3_1_2, mgrast_release_3_1_1, mgrast_release_3_1_0, mgrast_dev_04132011, mgrast_dev_04012011, mgrast_rel_2008_1110, myrast_33, mgrast_dev_04052011, mgrast_dev_02222011, HEAD
Rebuild a job's database tables .

#
# recreate the sims tables for a job.
#

use strict;
use File::Basename;
use GenomeMeta;
use Job48;
use JobStage;
use SGE;
use FileHandle;
use FortyEightMeta::MGDB;


STDOUT->autoflush(1);

@ARGV == 1 or die "Usage: $0 job-dir\n";

my $jobdir = shift;

-d $jobdir or die "$0: job dir $jobdir does not exist\n";

my $STAGE = "reload_sims";
my $stage = new JobStage('Job48', $STAGE, $jobdir);
$stage or die "Cannot create job for $jobdir\n";

my $job_id = basename($jobdir);
my $job = $stage->job();

my $meta = $job->meta;

print "Reloading sims for $jobdir\n";

my $proc = "$jobdir/proc";
chdir($proc) or $stage->fatal("cannot chdir $proc: $!");

my $max_id_len = $stage->get_metadata("preprocess.max_contig_id_len");

if (!$max_id_len)
{
    die "couldn't find max_contig_id_len\n";
}

my $mgdb;
eval {
    $mgdb = new DBrtns($FIG_Config::mgrast_dbms, $FIG_Config::mgrast_db,
			  $FIG_Config::mgrast_dbuser, $FIG_Config::mgrast_dbpass,
			  $FIG_Config::mgrast_dbport, $FIG_Config::mgrast_dbhost,
			  $FIG_Config::mgrast_dbsock);
};
if ($@)
{
    $stage->fatal("cannot connect to database: $@");
}

$mgdb or $stage->fatal("Cannot open connection to database");

my ($table_name, $best_iden_name, $best_psc_name) = FortyEightMeta::MGDB::create_sims_db($mgdb, $stage->job->id(), $max_id_len);

$stage->set_metadata("db.table_name", $table_name);
$stage->set_metadata("db.best_by_iden_table_name", $best_iden_name);
$stage->set_metadata("db.best_by_psc_table_name", $best_psc_name);

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3