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

View of /Sprout/NmpdrProgress.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (download) (as text) (annotate)
Mon Nov 5 21:32:05 2007 UTC (12 years, 5 months ago) by parrello
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +0 -0 lines
FILE REMOVED
Replaced by the difference report.

#!/usr/bin/perl -w

=head1 NMPDR Progress Statistics

This script will compute the statistics used in the NMPDR progress reports and
display them as trace output.

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

=over 4

=item user

Name suffix to be used for log files. If omitted, the PID is used.

=item trace

Numeric trace level. A higher trace level causes more messages to appear. The
default trace level is 2. Tracing will be directly to the standard output
as well as to a C<trace>I<User>C<.log> file in the FIG temporary directory,
where I<User> is the value of the B<user> option above.

=item sql

If specified, turns on tracing of SQL activity.

=item background

Save the standard and error output to files. The files will be created
in the FIG temporary directory and will be named C<err>I<User>C<.log> and
C<out>I<User>C<.log>, respectively, where I<User> is the value of the
B<user> option above.

=item h

Display this command's parameters and options.

=item phone

Phone number to message when the script is complete.

=back

=cut

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

# Get the command-line options and parameters.
my ($options, @parameters) = StandardSetup([qw(Sprout) ],
                                           {
                                              trace => [2, 'tracing level'],
                                              phone => ["", "phone number (international format) to call when load finishes"],
                                           },
                                           "",
                                           @ARGV);
# Set a variable to contain return type information.
my $rtype;
# Insure we catch errors.
eval {
    my $sprout = SFXlate->new_sprout_only();
    Trace("Computing basic counts.") if T(2);
    my $genomes = $sprout->GetCount(['Genome']);
    my $subsystems = $sprout->GetCount(['Subsystem']);
    my $roles = $sprout->GetCount(['OccursInSubsystem']);
    my $funcs = $sprout->GetCount(['ExternalAliasFunc']);
    my $couples = $sprout->GetCount(['Coupling']);
    # Count features, external links, and BBHs.
    my $links = 0;
    my $bbhs = 0;
    my $features = 0;
    my $lquery = $sprout->Get(['Feature']);
    Trace("Processing features.") if T(3);
    while (my $peg = $lquery->Fetch()) {
        my ($pegID) = $peg->Value('Feature(id)');
        Trace("Processing feature $pegID.") if T(4);
        $features++;
        my @linkText = $peg->Value('Feature(link)');
        $links += scalar @linkText;
        $bbhs += $sprout->GetCount(['IsBidirectionalBestHitOf'],
                                   'IsBidirectionalBestHitOf(from-link) = ?',
                                   [$pegID]);
        if ($features % 1000 == 0) {
            Trace("$features processed.") if T(3);
        }
    }
    Trace("Genomes = $genomes.") if T(0);
    Trace("Subsystems = $subsystems.") if T(0);
    Trace("Roles = $roles.") if T(0);
    Trace("External function assignments = $funcs.") if T(0);
    Trace("Features = $features.") if T(0);
    Trace("External links from features = $links.") if T(0);
    Trace("Bidirectional Best Hits = $bbhs.") if T(0);
    Trace("Functional couplings = $couples.") if T(0);
};
if ($@) {
    Trace("Script failed with error: $@") if T(0);
    $rtype = "error";
} else {
    Trace("Script complete.") if T(2);
    $rtype = "no error";
}
if ($options->{phone}) {
    my $msgID = Tracer::SendSMS($options->{phone}, "a terminated with $rtype.");
    if ($msgID) {
        Trace("Phone message sent with ID $msgID.") if T(2);
    } else {
        Trace("Phone message not sent.") if T(2);
    }
}

1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3