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

View of /Sprout/DeleteGenomes.pl

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.2 - (download) (as text) (annotate)
Tue Oct 3 02:48:59 2006 UTC (13 years, 3 months ago) by parrello
Branch: MAIN
Changes since 1.1: +2 -1 lines
Fixed default trace level.

#!/usr/bin/perl -w

=head1 Delete Genomes from Sprout

This method deletes genomes from the Sprout database. Simply list the genomes
as command-line parameters.

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

=over 4

=item showOnly

If specified, the DELETE statements will be displayed but no records will be deleted.

=item trace

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

=item sql

If specified, turns on tracing of SQL activity.

=item h

Display this commands parameters and options.



use strict;
use Tracer;
use DocUtils;
use TestUtils;
use Cwd;
use FIG;
use Stats;
use Sprout;
use SFXlate;
use File::Copy;
use File::Path;

# Get the command-line options.
my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout'],
                                            showOnly => [0, 'Display DELETE statements without deleting.'],
                                            trace => [2, 'tracing level'],
                                            '<genome1> <genome2> ...',
# Get the Sprout object.
my $sprout = SFXlate->new_sprout_only();
# Save the show-only flag.
my $showOnly = $options->{showOnly};
# Create the statistics object.
my $retVal = Stats->new('genomesFound', 'genomesNotFound');
# Loop through the genome IDs.
for my $genomeID (@parameters) {
    # Find out if the genome is real.
    if (! $sprout->Exists('Genome', $genomeID)) {
        # Warn the user. Nothing can get deleted if the genome is not in the Genome
        # table.
        Trace("Genome $genomeID not found in the genome table.") if T(1);
    } else {
        # Here we can delete it.
        my $stats = $sprout->DeleteGenome($genomeID, $showOnly);
        # Update the statistics.
# Display the statistcs.
Trace($retVal->Show()) if T(0);


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3