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

View of /FigKernelScripts/load_sims.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Wed Aug 17 13:29:22 2005 UTC (14 years, 7 months ago) by overbeek
Branch: MAIN
Changes since 1.4: +11 -1 lines
postgres fix for sims/closetab stuff


# -*- perl -*-

use FIG;
my $fig = new FIG;

use DBrtns;

$usage = "usage: load_sims SimsDir";
($dir = shift @ARGV)
    || die $usage;

my $dbf = $fig->{_dbf};

my $mediumint;
if ($dbf->{_dbms} eq 'mysql')
{
    $mediumint = "mediumint";
}
else
{
    $mediumint = "integer";
}

$dbf->drop_table( tbl => "condensed_sims" );
$dbf->create_table( tbl => 'condensed_sims',
		    flds => "g1 smallint, p1 $mediumint, g2 smallint, p2 $mediumint, iden real, psc real, paraN INTEGER",
		    type => 'InnoDB'
		  );
opendir(SIMS,$dir) || die "$dir does not exist";
@files = grep { $_ !~ /^\./ } readdir(SIMS);
closedir(SIMS);
foreach $file (@files)
{
    if (-s "$dir/$file")
    {
	print "Loading $dir/$file\n";
	$dbf->load_table( tbl => "condensed_sims",
			  file => "$dir/$file" );
    }
}
print "Creating index\n";
$dbf->create_index( idx  => "condensed_sims_ix",
		    tbl  => "condensed_sims",
		    type => "btree",
		    flds => "g1, p1" );

$dbf->vacuum_it("condensed_sims");


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3