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

Annotation of /Sprout/NmpdrStatus.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (view) (download) (as text)

1 : parrello 1.1 #!/usr/bin/perl -w
2 :    
3 :     #
4 :     # Copyright (c) 2003-2006 University of Chicago and Fellowship
5 :     # for Interpretations of Genomes. All Rights Reserved.
6 :     #
7 :     # This file is part of the SEED Toolkit.
8 :     #
9 :     # The SEED Toolkit is free software. You can redistribute
10 :     # it and/or modify it under the terms of the SEED Toolkit
11 :     # Public License.
12 :     #
13 :     # You should have received a copy of the SEED Toolkit Public License
14 :     # along with this program; if not write to the University of Chicago
15 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
16 :     # Genomes at veronika@thefig.info or download a copy from
17 :     # http://www.theseed.org/LICENSE.TXT.
18 :     #
19 :    
20 :     =head1 NMPDR Status Checker
21 :    
22 :     This script examines all of the genomes and displays the NMPDR group for each.
23 :    
24 :     The currently-supported command-line options are as follows.
25 :    
26 :     =over 4
27 :    
28 :     =item user
29 :    
30 :     Name suffix to be used for log files. If omitted, the PID is used.
31 :    
32 :     =item trace
33 :    
34 :     Numeric trace level. A higher trace level causes more messages to appear. The
35 :     default trace level is 2. Tracing will be directly to the standard output
36 :     as well as to a C<trace>I<User>C<.log> file in the FIG temporary directory,
37 :     where I<User> is the value of the B<user> option above.
38 :    
39 :     =item sql
40 :    
41 :     If specified, turns on tracing of SQL activity.
42 :    
43 :     =item background
44 :    
45 :     Save the standard and error output to files. The files will be created
46 :     in the FIG temporary directory and will be named C<err>I<User>C<.log> and
47 :     C<out>I<User>C<.log>, respectively, where I<User> is the value of the
48 :     B<user> option above.
49 :    
50 :     =item h
51 :    
52 :     Display this command's parameters and options.
53 :    
54 :     =item phone
55 :    
56 :     Phone number to message when the script is complete.
57 :    
58 :     =back
59 :    
60 :     =cut
61 :    
62 :     use strict;
63 :     use Tracer;
64 :     use FIG;
65 :     use Cwd;
66 :     use File::Copy;
67 :     use File::Path;
68 :    
69 :     # Get the command-line options and parameters.
70 :     my ($options, @parameters) = StandardSetup([qw(FIG) ],
71 :     {
72 :     phone => ["", "phone number (international format) to call when load finishes"],
73 :     },
74 :     "",
75 :     @ARGV);
76 :     # Set a variable to contain return type information.
77 :     my $rtype;
78 :     # Insure we catch errors.
79 :     eval {
80 :     # Get the FIG object.
81 :     my $fig = FIG->new();
82 :     # Get a list of all the genomes.
83 :     my $genomes = $fig->genome_list();
84 :     Trace(scalar(@{$genomes}) . " found.") if T(3);
85 :     # Loop through the list.
86 :     for my $genome (@{$genomes}) {
87 :     # Get the genome ID and name.
88 :     my ($genomeID, $genomeName) = @{$genome};
89 :     # Only proceed if the genome is complete. Otherwise, it's not part of NMPDR.
90 :     my $flag = $fig->is_complete($genomeID);
91 :     Trace("Complete flag for $genomeID is $flag.") if T(4);
92 :     if ($flag) {
93 :     # Compute the NMPDR group.
94 :     my $nmpdrFile = "$FIG_Config::organisms/$genomeID/NMPDR";
95 :     if (-e $nmpdrFile) {
96 :     # Get the NMPDR group from the file contents.
97 :     my ($nmpdrGroup) = Tracer::GetFile($nmpdrFile);
98 :     # Trace the result.
99 :     Trace("$genomeID ($genomeName) = $nmpdrGroup") if T(2);
100 :     }
101 :     } else {
102 :     # Denote this is not an NMPDR genome.
103 :     Trace("$genomeID ($genomeName) not used.") if T(3);
104 :     }
105 :     }
106 :     Trace("Processing complete.") if T(2);
107 :     };
108 :     if ($@) {
109 :     Trace("Script failed with error: $@") if T(0);
110 :     $rtype = "error";
111 :     } else {
112 :     Trace("Script complete.") if T(2);
113 :     $rtype = "no error";
114 :     }
115 :     if ($options->{phone}) {
116 :     my $msgID = Tracer::SendSMS($options->{phone}, "NMPDR Status Checker terminated with $rtype.");
117 :     if ($msgID) {
118 :     Trace("Phone message sent with ID $msgID.") if T(2);
119 :     } else {
120 :     Trace("Phone message not sent.") if T(2);
121 :     }
122 :     }
123 :    
124 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3