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

Annotation of /FigKernelScripts/ListLits.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (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 :     use strict;
21 :     use Tracer;
22 :     use SFXlate;
23 :     use FIG;
24 :     use Stats;
25 :    
26 :     =head1 ListLits Script
27 :    
28 :     ListLits [options]
29 :    
30 :     Count literature references.
31 :    
32 :     =head2 Introduction
33 :    
34 :     This script counts the C<dlit> and C<ilit> evidence codes for features in NMPDR
35 :     genomes. The output will contain the total counts for all genomes and the counts
36 :     for only the five core genomes.
37 :    
38 :    
39 :     =head2 Command-Line Options
40 :    
41 :     =over 4
42 :    
43 :     =item trace
44 :    
45 :     Specifies the tracing level. The higher the tracing level, the more messages
46 :     will appear in the trace log. Use E to specify emergency tracing.
47 :     [ %END option_map %]
48 :    
49 :     =item user
50 :    
51 :     Name suffix to be used for log files. If omitted, the PID is used.
52 :    
53 :     =item sql
54 :    
55 :     If specified, turns on tracing of SQL activity.
56 :    
57 :     =item background
58 :    
59 :     Save the standard and error output to files. The files will be created
60 :     in the FIG temporary directory and will be named C<err>I<User>C<.log> and
61 :     C<out>I<User>C<.log>, respectively, where I<User> is the value of the
62 :     B<user> option above.
63 :    
64 :     =item help
65 :    
66 :     Display this command's parameters and options.
67 :    
68 :     =item warn
69 :    
70 :     Create an event in the RSS feed when an error occurs.
71 :    
72 :     =item phone
73 :    
74 :     Phone number to message when the script is complete.
75 :    
76 :     =back
77 :    
78 :     =cut
79 :    
80 :     # Get the command-line options and parameters.
81 :     my ($options, @parameters) = StandardSetup([qw(ERDB Sprout) ],
82 :     {
83 :     phone => ["", "phone number (international format) to call when load finishes"]
84 :     },
85 :     "",
86 :     @ARGV);
87 :     # Set a variable to contain return type information.
88 :     my $rtype;
89 :     # Insure we catch errors.
90 :     eval {
91 :     # Get the Sprout object.
92 :     my $sprout = SFXlate->new_sprout_only();
93 :     my $fig = FIG->new();
94 :     # Get a hash that can be used to identify the core genomes.
95 :     my %cores = map { $_ => 1 } $sprout->CoreGenomes('core');
96 :     # Get a list of all the genomes.
97 :     my @genomes = $sprout->Genomes();
98 :     # Create a statistics object to count the literature references.
99 :     my $stats = Stats->new(qw(ilit_core dlit_core ilit_all dlit_all));
100 :     # Loop through the genomes.
101 :     for my $genome (@genomes) {
102 :     Trace("Processing $genome.") if T(3);
103 :     # Compute each literature type separately.
104 :     for my $type (qw(dlit ilit)) {
105 :     my $count = $fig->query_attributes('$object LIKE ? AND $key = ? AND $value LIKE ?',
106 :     ["fig|$genome.%", 'evidence_code', "$type%"]);
107 :     Trace("Genome $genome has $count $type references.") if T(3);
108 :     if ($cores{$genome}) {
109 :     $stats->Add("${type}_core" => $count);
110 :     }
111 :     $stats->Add("${type}_all", $count);
112 :     }
113 :     }
114 :     # Display the results.
115 :     Trace("Total counts\n" . $stats->Show()) if T(2);
116 :     };
117 :     if ($@) {
118 :     Trace("Script failed with error: $@") if T(0);
119 :     $rtype = "error";
120 :     } else {
121 :     Trace("Script complete.") if T(2);
122 :     $rtype = "no error";
123 :     }
124 :     if ($options->{phone}) {
125 :     my $msgID = Tracer::SendSMS($options->{phone}, "ListLits terminated with $rtype.");
126 :     if ($msgID) {
127 :     Trace("Phone message sent with ID $msgID.") if T(2);
128 :     } else {
129 :     Trace("Phone message not sent.") if T(2);
130 :     }
131 :     }
132 :    
133 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3