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

Annotation of /Sprout/DeleteGenomes.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 :     =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 : parrello 1.2 showOnly => [0, 'Display DELETE statements without deleting.'],
49 :     trace => [2, 'tracing level'],
50 : parrello 1.1 },
51 :     '<genome1> <genome2> ...',
52 :     @ARGV);
53 :     # Get the Sprout object.
54 :     my $sprout = SFXlate->new_sprout_only();
55 :     # Save the show-only flag.
56 :     my $showOnly = $options->{showOnly};
57 :     # Create the statistics object.
58 :     my $retVal = Stats->new('genomesFound', 'genomesNotFound');
59 :     # Loop through the genome IDs.
60 :     for my $genomeID (@parameters) {
61 :     # Find out if the genome is real.
62 :     if (! $sprout->Exists('Genome', $genomeID)) {
63 :     # Warn the user. Nothing can get deleted if the genome is not in the Genome
64 :     # table.
65 :     Trace("Genome $genomeID not found in the genome table.") if T(1);
66 :     $retVal->Add('genomesNotFound');
67 :     } else {
68 :     # Here we can delete it.
69 :     my $stats = $sprout->DeleteGenome($genomeID, $showOnly);
70 :     # Update the statistics.
71 :     $retVal->Add('genomesFound');
72 :     $retVal->Accumulate($stats);
73 :     }
74 :     }
75 :     # Display the statistcs.
76 :     Trace($retVal->Show()) if T(0);
77 :    
78 :     1;

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3