[Bio] / Sprout / ListRelations.pl Repository:
ViewVC logotype

View of /Sprout/ListRelations.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.4 - (download) (as text) (annotate)
Mon Feb 18 07:05:46 2008 UTC (12 years, 3 months ago) by parrello
Branch: MAIN
Changes since 1.3: +0 -0 lines
Removed some obsolete methods.

#!/usr/bin/perl -w

=head1 List Relations

This script creates a CSV checklist to help in loading an ERDB-style database. It
has two parameters: a database type and an output file name.

C<ListRelations> [I<options>] I<type> I<outputFile>

=over 4

=item type

Database type, which is currently either C<Sprout> or C<SimBlocks>.

=item outputFile

Name of the CSV file to be generated.


The currently-supported command-line options are as follows.

=over 4

=item trace

Numeric trace level. A higher trace level causes more messages to appear. The
default trace level is 2.



use strict;
use Tracer;
use DocUtils;
use TestUtils;
use Cwd;
use File::Copy;
use File::Path;
use ERDB;
use SimBlocks;
use SFXlate;

# Get the command-line options.
my ($options, @parameters) = Tracer::ParseCommand({ trace => 2 }, @ARGV);
# Set up tracing.
my $traceLevel = $options->{trace};
TSetup("$traceLevel errors Tracer DocUtils ERDB", "TEXT");
# Get the database type.
my $dbType = lc $parameters[0];
# Get the ERDB object.
my $erdb;
if ($dbType eq 'sprout') {
    my $sprout = SFXlate->new_sprout_only();
    $erdb = $sprout;
} elsif ($dbType eq 'simblocks') {
    $erdb = SimBlocks->new();
} else {
    Confess("Invalid database type $parameters[0].");
# Open the output file.
Open(\*CSVOUT, ">$parameters[1]");
# Get a list of the tables.
my @tables = $erdb->GetTableNames;
# Print a header.
print CSVOUT "\"FIG RDY\",\"DTX RDY\",\"LOADED\",\"TABLE NAME\"\n";
# Loop through the table names, printing them.
for my $table (@tables) {
    print CSVOUT "\" \",\" \",\" \",\"$table\"\n";
# Close the output file.
close CSVOUT;


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3