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

Diff of /Sprout/LoadSproutTables.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20, Tue Jan 31 07:33:46 2006 UTC revision 1.27, Thu Apr 13 18:01:22 2006 UTC
# Line 20  Line 20 
20  commands.  commands.
21    
22      LoadSproutTables -dbLoad -dbCreate "*"      LoadSproutTables -dbLoad -dbCreate "*"
23      TestSproutLoad      TestSproutLoad [genomeID] ...
24      index_sprout      index_sprout_lucene
25    
26    where I<[genomeID]> is one or more genome IDs. These genomes will be tested more
27    thoroughly than the others.
28    
29  All three commands send output to the console. In addition, C<LoadSproutTables> and  All three commands send output to the console. In addition, C<LoadSproutTables> and
30  C<TestSproutLoad> write tracing information to C<trace.log> in the FIG temporary  C<TestSproutLoad> write tracing information to a trace log in the FIG temporary
31  directory (B<$FIG_Config::Tmp>). At the bottom of the log file will be a complete  directory (B<$FIG_Config::Tmp>). At the bottom of the log file will be a complete
32  list of errors. If errors occur in C<LoadSproutTables>, then the data must be corrected  list of errors. If errors occur in C<LoadSproutTables>, then the data must be corrected
33  and the offending table group reloaded. So, for example, if there are errors in the  and the offending table group reloaded. So, for example, if there are errors in the
# Line 46  Line 49 
49  to give you an idea of the progress.  to give you an idea of the progress.
50    
51  Once the Sprout database is loaded, B<TestSproutLoad> can be used to verify the load  Once the Sprout database is loaded, B<TestSproutLoad> can be used to verify the load
52  against the FIG data. Again, the end of the C<trace.log> file will contain a summary  against the FIG data. The end of the trace log file will contain statistics on
53  of the errors found. Like C<LoadSproutTables>, C<TestSproutLoad> is a time-consuming  the errors found. Like C<LoadSproutTables>, C<TestSproutLoad> is a time-consuming
54  script, so you may want to set the trace level to 3 to see visible progress.  script, so you may want to set the trace level to 3 to see visible progress.
55    
56      TestSproutLoad -trace=3      TestSproutLoad -trace=3 [genomeID] ...
57    
58    The I<[genomeID]> specifies zero or more IDs of genomes to receive more thorough
59    testing. So, for example,
60    
61        TestSproutLoad -trace=3 100226.1 83333.1
62    
63    would do thorough testing of I<Streptomyces coelicolor A3-2> (100226.1) and
64    I<Escherichia coli K12> (83333.1).
65    
66  Unlike C<LoadSproutTables>, in C<TestSproutLoad>, the individual errors found are  Unlike C<LoadSproutTables>, in C<TestSproutLoad>, the individual errors found are
67  mixed in with the trace messages. They are all, however, marked with a trace type  mixed in with the trace messages. They are all, however, marked with a trace type
# Line 68  Line 79 
79  The test may reveal that some tables need to be reloaded, or that a software  The test may reveal that some tables need to be reloaded, or that a software
80  problem has crept into the Sprout.  problem has crept into the Sprout.
81    
82  Once all the tables have the correct data, C<index_sprout> can be run to create the  Once all the tables have the correct data, C<index_sprout_lucene> can be run to create the
83  Glimpse indexes.  Lucene search indexes. Lucene is a web site search engine produced by the Apache project.
84    It is written in Java, and in order to run it you must have the B<LuceneSearch> and
85    B<NmpdrConfigs> projects checked out from CVS and made.
86    
87  =head2 Procedure For Loading Sprout  =head2 Procedure For Loading Sprout
88    
89    In order to load the Sprout, you need to have the B<Sprout>, B<NmpdrConfigs>, and
90    B<LuceneSearch> projects checked out from CVS in addition to the standard FIG
91    projects. You must also set up the following B<FIG_Config.pm> variables in addition
92    to the normal ones.
93    
94    =over 4
95    
96    =item sproutData
97    
98    Name of the data directory for the Sprout load files.
99    
100    =item var
101    
102    Name of the directory to contain cached NMPDR pages. The most important file in
103    this directory is C<nmpdr_page_template.html>, which contains a skeleton page
104    from the main NMPDR web site. This skeleton page is used to generate output
105    pages that look like the other NMPDR pages.
106    
107    =item java
108    
109    Path to the Java runtime environment.
110    
111    =item sproutDB
112    
113    Name of the Sprout database
114    
115    =item dbuser
116    
117    User name for logging into the Sprout database.
118    
119    =item dbpass
120    
121    Password for logging into the Sprout database.
122    
123    =item nmpdr_site_url
124    
125    URL for the NMPDR cover pages. The NMPDR cover pages are informational and text
126    pages that serve as the entry point to the NMPDR web site. They are generated by
127    a Content Management tool, and some Sprout scripts need to know where to find
128    them.
129    
130    =item nmpdr_site_template_id
131    
132    Page number for the template page used to generate results that look like they're
133    part of the NMPDR web site.
134    
135    =back
136    
137  =over 4  =over 4
138    
139    The procedure for loading Sprout is as follows.
140    
141  =item 1  =item 1
142    
143  Type C<LoadSproutTables -dbLoad -dbCreate "*"> and press ENTER. This will create  Type
144  the C<dtx> files and load them.  
145        nohup LoadSproutTables -dbLoad -dbCreate -user=you -background "*" >null &
146    
147    where C<you> is your user ID, and press ENTER. This will create the C<dtx> files
148    and load them. You may be asked for a password. If this is the case, simply
149    press ENTER. If that does not work, use the C<dbpass> value specified in
150    your C<FIG_Config.pm> file.
151    
152    The above command line runs the load in the background. The standard output,
153    standard error, and trace output will be directed to files in the FIG temporary
154    directory. If your user name is C<Bruce> then the files will be named
155    C<outBruce.log>, C<errBruce.log>, and C<traceBruce.log> respectively.
156    
157    If the load fails at some point and you are able to correct the problem, use the
158    C<resume> option to restart it. For example, if the load failed while doing the
159    Feature load group, you would resume it using
160    
161        nohup LoadSproutTables -dbLoad -dbCreate -user=you -resume -background Feature >null &
162    
163  =item 2  =item 2
164    
165  Type C<TestSproutLoad 100226.1 83333.1> and press ENTER. This will validate  Type
166  the Sprout database against the SEED data.  
167        nohup TestSproutLoad -user=you -background >null &100226.1 83333.1>
168    
169    and press ENTER. This will validate the Sprout database against the SEED data.
170    
171  =item 3  =item 3
172    
# Line 93  Line 176 
176    
177  =item 4  =item 4
178    
179  Type C<index_sprout> and press ENTER. This will create the Glimpse indexes  Type
180  for the Sprout data.  
181        index_sprout_lucene
182    
183     and press ENTER. This will create the Lucene indexes for the Sprout data.
184    
185    =item 5
186    
187    Change to the B<SproutData/Indexes> directory under B<FIGdisk> and look for the
188    directory created by C<index_sprout_lucene>. The directory name will be
189    something like C<Lucene.20060412-154112>. The numbers indicate the date and time
190    the index was created. In this case it was 04/12/2006 03:41:12pm. Type
191    
192        ln -sf directory Lucene
193    
194    where C<directory> is the new directory name, to point the C<Lucene> directory to the
195    new search index.
196    
197  =back  =back
198    
# Line 184  Line 282 
282    
283  Desired tracing level. The default is 3.  Desired tracing level. The default is 3.
284    
285    =item user
286    
287    Suffix to use for trace, output, and error files created in
288    
289  =item dbLoad  =item dbLoad
290    
291  If TRUE, the database tables will be loaded automatically from the load files created.  If TRUE, the database tables will be loaded automatically from the load files created.
# Line 203  Line 305 
305    
306  If TRUE, only the group's primary entity will be loaded.  If TRUE, only the group's primary entity will be loaded.
307    
308    =item background
309    
310    Redirect the standard and error output to files in the FIG temporary directory.
311    
312    =item resume
313    
314    Resume an interrupted load, starting with the load group specified in the first
315    positional parameter.
316    
317    =item sql
318    
319    Trace SQL statements.
320    
321  =back  =back
322    
323  =cut  =cut
# Line 221  Line 336 
336    
337  # Get the command-line parameters and options.  # Get the command-line parameters and options.
338  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',
339                                              'ERDB', 'Load'],                                              'ERDB', 'Load', 'Sprout', 'Subsystem'],
340                                              { geneFile => ["", "name of the genome list file"],                                              { geneFile => ["", "name of the genome list file"],
341                                                subsysFile => ["", "name of the trusted subsystem file"],                                                subsysFile => ["", "name of the trusted subsystem file"],
342                                                dbLoad => [0, "load the database from generated files"],                                                dbLoad => [0, "load the database from generated files"],
343                                                dbCreate => [0, "drop and re-create the database"],                                                dbCreate => [0, "drop and re-create the database"],
344                                                loadOnly => [0, "load the database from previously generated files"],                                                loadOnly => [0, "load the database from previously generated files"],
345                                                primaryOnly => [0, "only process the group's main entity"]                                                primaryOnly => [0, "only process the group's main entity"],
346                                                  resume => [0, "resume a complete load starting with the first group specified in the parameter list"],
347                                              },                                              },
348                                              "<group1> <group2> ...",                                              "<group1> <group2> ...",
349                                              @ARGV);                                              @ARGV);
# Line 247  Line 363 
363  my $spl = SproutLoad->new($sprout, $fig, $options->{geneFile}, $options->{subsysFile}, $options);  my $spl = SproutLoad->new($sprout, $fig, $options->{geneFile}, $options->{subsysFile}, $options);
364  # Insure we have an output directory.  # Insure we have an output directory.
365  FIG::verify_dir($FIG_Config::sproutData);  FIG::verify_dir($FIG_Config::sproutData);
366    # If we're resuming, we only want to have 1 parameter.
367    my $resume = $options->{resume};
368    if ($resume && @parameters > 1) {
369        Confess("If resume=1, only one load group can be specified.");
370    } elsif (! @parameters) {
371        Confess("No load groups were specified.");
372    }
373  # Process the parameters.  # Process the parameters.
374  for my $group (@parameters) {  for my $group (@parameters) {
375      Trace("Processing load group $group.") if T(2);      Trace("Processing load group $group.") if T(2);
376      my $stats;      my $stats;
377      if ($group eq 'Genome' || $group eq '*') {      if ($group eq 'Genome' || $group eq '*') {
378          $spl->LoadGenomeData();          $spl->LoadGenomeData();
379            $group = ResumeCheck($resume);
380      }      }
381      if ($group eq 'Feature' || $group eq '*') {      if ($group eq 'Feature' || $group eq '*') {
382          $spl->LoadFeatureData();          $spl->LoadFeatureData();
383            $group = ResumeCheck($resume);
384      }      }
385      if ($group eq 'Coupling' || $group eq '*') {      if ($group eq 'Coupling' || $group eq '*') {
386          $spl->LoadCouplingData();          $spl->LoadCouplingData();
387            $group = ResumeCheck($resume);
388      }      }
389      if ($group eq 'Subsystem' || $group eq '*') {      if ($group eq 'Subsystem' || $group eq '*') {
390          $spl->LoadSubsystemData();          $spl->LoadSubsystemData();
391            $group = ResumeCheck($resume);
392      }      }
393      if ($group eq 'Property' || $group eq '*') {      if ($group eq 'Property' || $group eq '*') {
394          $spl->LoadPropertyData();          $spl->LoadPropertyData();
395            $group = ResumeCheck($resume);
396      }      }
397      if ($group eq 'Annotation' || $group eq '*') {      if ($group eq 'Annotation' || $group eq '*') {
398          $spl->LoadAnnotationData();          $spl->LoadAnnotationData();
399            $group = ResumeCheck($resume);
400      }      }
401      if ($group eq 'BBH' || $group eq '*') {      if ($group eq 'BBH' || $group eq '*') {
402          $spl->LoadBBHData();          $spl->LoadBBHData();
403            $group = ResumeCheck($resume);
404      }      }
405      if ($group eq 'Group' || $group eq '*') {      if ($group eq 'Group' || $group eq '*') {
406          $spl->LoadGroupData();          $spl->LoadGroupData();
407            $group = ResumeCheck($resume);
408      }      }
409      if ($group eq 'Source' || $group eq '*') {      if ($group eq 'Source' || $group eq '*') {
410          $spl->LoadSourceData();          $spl->LoadSourceData();
411            $group = ResumeCheck($resume);
412      }      }
413      if ($group eq 'External' || $group eq '*') {      if ($group eq 'External' || $group eq '*') {
414          $spl->LoadExternalData();          $spl->LoadExternalData();
415            $group = ResumeCheck($resume);
416      }      }
417      if ($group eq 'Reaction' || $group eq '*') {      if ($group eq 'Reaction' || $group eq '*') {
418          $spl->LoadReactionData();          $spl->LoadReactionData();
419            $group = ResumeCheck($resume);
420      }      }
421    
422  }  }
423  Trace("Load complete.") if T(2);  Trace("Load complete.") if T(2);
424    
425    # If the resume flag is set, return "*", else return "".
426    sub ResumeCheck {
427        my ($resume) = @_;
428        return ($resume ? "*" : "");
429    }
430    
431  1;  1;

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.27

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3