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

Annotation of /Sprout/DeleteGenomes.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 :     =head1 Delete Genomes from Sprout
4 :    
5 :     This method deletes genomes from the Sprout database. Simply list the genomes
6 :     as command-line parameters.
7 :    
8 :     The currently-supported command-line options are as follows.
9 :    
10 :     =over 4
11 :    
12 :     =item showOnly
13 :    
14 :     If specified, the DELETE statements will be displayed but no records will be deleted.
15 :    
16 :     =item trace
17 :    
18 :     Numeric trace level. A higher trace level causes more messages to appear. The
19 :     default trace level is 2.
20 :    
21 :     =item sql
22 :    
23 :     If specified, turns on tracing of SQL activity.
24 :    
25 :     =item h
26 :    
27 :     Display this commands parameters and options.
28 :    
29 :     =back
30 :    
31 :     =cut
32 :    
33 :     use strict;
34 :     use Tracer;
35 :     use DocUtils;
36 :     use TestUtils;
37 :     use Cwd;
38 :     use FIG;
39 :     use Stats;
40 :     use Sprout;
41 :     use SFXlate;
42 :     use File::Copy;
43 :     use File::Path;
44 :    
45 :     # Get the command-line options.
46 :     my ($options, @parameters) = StandardSetup(['ERDB', 'Sprout'],
47 :     {
48 :     showOnly => [0, 'Display DELETE statements without deleting.']
49 :     },
50 :     '<genome1> <genome2> ...',
51 :     @ARGV);
52 :     # Get the Sprout object.
53 :     my $sprout = SFXlate->new_sprout_only();
54 :     # Save the show-only flag.
55 :     my $showOnly = $options->{showOnly};
56 :     # Create the statistics object.
57 :     my $retVal = Stats->new('genomesFound', 'genomesNotFound');
58 :     # Loop through the genome IDs.
59 :     for my $genomeID (@parameters) {
60 :     # Find out if the genome is real.
61 :     if (! $sprout->Exists('Genome', $genomeID)) {
62 :     # Warn the user. Nothing can get deleted if the genome is not in the Genome
63 :     # table.
64 :     Trace("Genome $genomeID not found in the genome table.") if T(1);
65 :     $retVal->Add('genomesNotFound');
66 :     } else {
67 :     # Here we can delete it.
68 :     my $stats = $sprout->DeleteGenome($genomeID, $showOnly);
69 :     # Update the statistics.
70 :     $retVal->Add('genomesFound');
71 :     $retVal->Accumulate($stats);
72 :     }
73 :     }
74 :     # Display the statistcs.
75 :     Trace($retVal->Show()) if T(0);
76 :    
77 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3