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

Annotation of /Sprout/DeleteGenomes.pl

Parent Directory Parent Directory | Revision Log Revision Log


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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3