[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.43, Fri May 11 06:23:51 2007 UTC revision 1.47, Tue Feb 5 05:04:26 2008 UTC
# Line 104  Line 104 
104    
105  =back  =back
106    
 =over 4  
   
107  Most of the above preparation is performed by the B<NMPDRSetup> utility.  Most of the above preparation is performed by the B<NMPDRSetup> utility.
108  NMPDRSetup prints the instructions for completing the process, including  NMPDRSetup prints the instructions for completing the process, including
109  loading the Sprout database. The specific procedure for loading  loading the Sprout database. The specific procedure for loading
110  the Sprout data, however, is as follows.  the Sprout data, however, is as follows.
111    
 =item 1  
   
 Type  
   
     nohup LoadSproutTables -dbLoad -user=you -background "*" >null &  
   
 where C<you> is your user ID, and press ENTER.  
   
 The above command line runs the load in the background. The standard output,  
 standard error, and trace output will be directed to files in the FIG temporary  
 directory. If your user name is C<Bruce> then the files will be named  
 C<outBruce.log>, C<errBruce.log>, and C<traceBruce.log> respectively.  
   
 If the load fails at some point and you are able to correct the problem, use the  
 C<resume> option to restart it. For example, if the load failed while doing the  
 Feature load group, you would resume it using  
   
     nohup LoadSproutTables -dbLoad -dbCreate -user=you -resume -background Feature >null &  
   
 =item 2  
   
 Type  
   
     index_sprout_lucene  
   
  and press ENTER. This will create the Lucene indexes for the Sprout data.  
   
 =back  
   
112  =head2 LoadSproutTables Command  =head2 LoadSproutTables Command
113    
114  C<LoadSproutTables> creates the load files for Sprout tables and optionally loads them.  C<LoadSproutTables> creates the load files for Sprout tables and optionally loads them.
# Line 155  Line 124 
124  =item Feature  =item Feature
125    
126  Loads B<Feature>, B<FeatureAlias>, B<FeatureTranslation>, B<FeatureUpstream>,  Loads B<Feature>, B<FeatureAlias>, B<FeatureTranslation>, B<FeatureUpstream>,
127  B<IsLocatedIn>, B<FeatureLink>.  B<IsLocatedIn>, B<FeatureLink>, B<IsAliasOf>, B<CDD>, B<HasFeature>,
128    B<HasRoleInSubsystem>, B<FeatureEssential>, B<FeatureVirulent>, B<FeatureIEDB>,
129  =item Coupling  B<CDD>, and B<IsPresentOnProteinOf>
   
 Loads B<Coupling>, B<IsEvidencedBy>, B<PCH>, B<ParticipatesInCoupling>,  
 B<UsesAsEvidence>.  
130    
131  =item Subsystem  =item Subsystem
132    
# Line 168  Line 134 
134  B<IsRoleOf>, B<OccursInSubsystem>, B<ParticipatesIn>, B<HasSSCell>,  B<IsRoleOf>, B<OccursInSubsystem>, B<ParticipatesIn>, B<HasSSCell>,
135  B<Catalyzes>, B<ConsistsOfRoles>, B<RoleSubset>, B<HasRoleSubset>,  B<Catalyzes>, B<ConsistsOfRoles>, B<RoleSubset>, B<HasRoleSubset>,
136  B<ConsistsOfGenomes>, B<GenomeSubset>, B<HasGenomeSubset>, B<Diagram>,  B<ConsistsOfGenomes>, B<GenomeSubset>, B<HasGenomeSubset>, B<Diagram>,
137  B<RoleOccursIn>.  B<RoleOccursIn>, B<SubSystemClass>, B<RoleEC>, B<IsIdentifiedByEC>,
138    B<ContainsFeature>.
139    
140  =item Annotation  =item Annotation
141    
# Line 206  Line 173 
173    
174  =item Drug  =item Drug
175    
176  Loads B<DrugProject>, B<ContainsTopic>, B<DrugTopic>, B<ContainsAnalysisOf>,  Loads B<PDB>, B<DocksWith>, C<IsProteinForFeature>, and C<Ligand>.
 B<PDB>, B<IncludesBound>, B<PDB>, B<IsBoundIn>, B<BindsWith>, B<Ligand>,  
 B<DescribesProteinForFeature>, and B<FeatureConservation>.  
177    
178  =item *  =item *
179    
# Line 256  Line 221 
221  will not be created. This option is useful if you are setting up a copy of Sprout  will not be created. This option is useful if you are setting up a copy of Sprout
222  and have load files already set up from the original version.  and have load files already set up from the original version.
223    
 =item primaryOnly  
   
 If TRUE, only the group's primary entity will be loaded.  
   
224  =item background  =item background
225    
226  Redirect the standard and error output to files in the FIG temporary directory.  Redirect the standard and error output to files in the FIG temporary directory.
# Line 283  Line 244 
244    
245  use strict;  use strict;
246  use Tracer;  use Tracer;
 use DocUtils;  
247  use Cwd;  use Cwd;
248  use FIG;  use FIG;
249  use SFXlate;  use SFXlate;
# Line 293  Line 253 
253  use Stats;  use Stats;
254  use SFXlate;  use SFXlate;
255    
256    # This is a list of the load groups in their natural order. We'll go through these in sequence, processing
257    # the ones the user asks for.
258    my @LoadGroups = qw(Genome Feature Subsystem Property Annotation Source External Reaction Synonym Family Drug);
259    
260  # Get the command-line parameters and options.  # Get the command-line parameters and options.
261  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',
262                                              'ERDB', 'Load', 'Sprout', 'Subsystem'],                                              'ERDB', 'Load', 'Sprout', 'Subsystem'],
# Line 301  Line 265 
265                                                dbLoad => [0, "load the database from generated files"],                                                dbLoad => [0, "load the database from generated files"],
266                                                dbCreate => [0, "drop and re-create the database"],                                                dbCreate => [0, "drop and re-create the database"],
267                                                loadOnly => [0, "load the database from previously generated files"],                                                loadOnly => [0, "load the database from previously generated files"],
                                               primaryOnly => [0, "only process the group's main entity"],  
268                                                resume => [0, "resume a complete load starting with the first group specified in the parameter list"],                                                resume => [0, "resume a complete load starting with the first group specified in the parameter list"],
269                                                phone => ["", "phone number (international format) to call when load finishes"],                                                phone => ["", "phone number (international format) to call when load finishes"],
270                                              },                                              },
# Line 328  Line 291 
291  my $spl = SproutLoad->new($sprout, $fig, $geneFile, $options->{subsysFile}, $options);  my $spl = SproutLoad->new($sprout, $fig, $geneFile, $options->{subsysFile}, $options);
292  # Insure we have an output directory.  # Insure we have an output directory.
293  FIG::verify_dir($FIG_Config::sproutData);  FIG::verify_dir($FIG_Config::sproutData);
294    # Check for the "*" option.
295    if ($parameters[0] eq '*') {
296        @parameters = @LoadGroups;
297    }
298  # If we're resuming, we only want to have 1 parameter.  # If we're resuming, we only want to have 1 parameter.
299  my $resume = $options->{resume};  my $resume = $options->{resume};
300  if ($resume && @parameters > 1) {  if ($resume && @parameters > 1) {
# Line 335  Line 302 
302  } elsif (! @parameters) {  } elsif (! @parameters) {
303      Trace("No load groups were specified.") if T(0);      Trace("No load groups were specified.") if T(0);
304  }  }
305    # Process the resume option here. We modify the incoming parameters to
306    # contain the resume group and everything after it.
307    if ($resume) {
308        # Save the starting group.
309        my $resumeGroup = $parameters[0];
310        # Copy the load group list into the parameter array.
311        @parameters = @LoadGroups;
312        # Shift out the groups until we reach our desired starting point.
313        while (scalar(@parameters) && $parameters[0] ne $resumeGroup) {
314            shift @parameters;
315        }
316        if (! @parameters) {
317            Confess("Resume group \"$resumeGroup\" not found.");
318        }
319    }
320  # Set a variable to contain return type information.  # Set a variable to contain return type information.
321  my $rtype;  my $rtype;
322    # Set up a statistics object for statistics about the entire load.
323    my $totalStats = Stats->new();
324  # Insure we catch errors.  # Insure we catch errors.
325  eval {  eval {
326      # Process the parameters.      # Process the parameters.
327      for my $group (@parameters) {      for my $group (@parameters) {
328          Trace("Processing load group $group.") if T(2);          Trace("Processing load group $group.") if T(2);
329          my $stats;          # Compute the string we want to execute.
330          if ($group eq 'Genome' || $group eq '*') {          my $code = "\$spl->Load${group}Data()";
331              $spl->LoadGenomeData();          # Load this group.
332              $group = ResumeCheck($resume, $group);          my $stats = eval($code);
333          }          if ($@) {
334          if ($group eq 'Feature' || $group eq '*') {              Confess("Load group error: $@");
             $spl->LoadFeatureData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Coupling' || $group eq '*') {  
             $spl->LoadCouplingData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Subsystem' || $group eq '*') {  
             $spl->LoadSubsystemData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Property' || $group eq '*') {  
             $spl->LoadPropertyData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Annotation' || $group eq '*') {  
             $spl->LoadAnnotationData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Group' || $group eq '*') {  
             $spl->LoadGroupData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Source' || $group eq '*') {  
             $spl->LoadSourceData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'External' || $group eq '*') {  
             $spl->LoadExternalData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Reaction' || $group eq '*') {  
             $spl->LoadReactionData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Synonym' || $group eq '*') {  
             $spl->LoadSynonymData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Family' || $group eq '*') {  
             $spl->LoadFamilyData();  
             $group = ResumeCheck($resume, $group);  
         }  
         if ($group eq 'Drug' || $group eq '*') {  
             $spl->LoadDrugData();  
             $group = ResumeCheck($resume, $group);  
335          }          }
336            # Merge the statistics into the master.
337            $totalStats->Accumulate($stats);
338        }
339        # Compute the statistical display.
340        my $statDisplay = $totalStats->Show();
341        # Display it.
342        Trace("Statistics for this load:\n$statDisplay") if T(2);
343        # Check for a "table load failed" message. If we find one, we want
344        # to end with an error.
345        if ($statDisplay =~ /table load failed/i) {
346            Confess("One or more table loads failed.");
347      }      }
348  };  };
349  if ($@) {  if ($@) {
# Line 413  Line 362 
362      }      }
363  }  }
364    
 # If the resume flag is set, return "*", else return "".  
 sub ResumeCheck {  
     my ($resume, $group) = @_;  
     return ($resume ? "*" : $group);  
 }  
   
365  1;  1;

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.47

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3