[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.39, Wed Aug 30 15:00:42 2006 UTC revision 1.48, Tue Sep 9 21:02:10 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    
133  Loads B<Subsystem>, B<Role>, B<SSCell>, B<ContainsFeature>, B<IsGenomeOf>,  Loads B<Subsystem>, B<Role>, B<SSCell>, B<ContainsFeature>, B<IsGenomeOf>,
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<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>, and
138    B<ContainsFeature>.
139    
140  =item Annotation  =item Annotation
141    
142  Loads B<SproutUser>, B<UserAccess>, B<Annotation>, B<IsTargetOfAnnotation>,  Loads B<SproutUser>, B<UserAccess>, B<Annotation>, B<IsTargetOfAnnotation>, and
143  B<MadeAnnotation>.  B<MadeAnnotation>.
144    
145  =item Property  =item Property
146    
147  Loads B<Property>, B<HasProperty>.  Loads B<Property>, and B<HasProperty>.
   
 =item BBH  
   
 Loads B<IsBidirectionalBestHitOf>.  
148    
149  =item Group  =item Group
150    
# Line 189  Line 152 
152    
153  =item Source  =item Source
154    
155  Loads B<Source>, B<ComesFrom>, B<SourceURL>.  Loads B<Source>, B<ComesFrom>, and B<SourceURL>.
   
 =item External  
   
 Loads B<ExternalAliasOrg>, B<ExternalAliasFunc>.  
156    
157  =item Reaction  =item Reaction
158    
159  Loads B<ReactionURL>, B<Compound>, B<CompoundName>,  Loads B<ReactionURL>, B<Compound>, B<CompoundName>,
160  B<CompoundCAS>, B<IsAComponentOf>, B<Reaction>.  B<CompoundCAS>, B<IsAComponentOf>, B<Reaction>, B<Scenario>, B<IsInputFor>,
161    B<IsOutputOf>, B<IsOnDiagram>, and B<Catalyzes>.
162    
163  =item Synonym  =item Synonym
164    
# Line 208  Line 168 
168    
169  Loads B<Family> and B<IsFamilyForFeature>.  Loads B<Family> and B<IsFamilyForFeature>.
170    
171    =item Drug
172    
173    Loads B<PDB>, B<DocksWith>, C<IsProteinForFeature>, and C<Ligand>.
174    
175  =item *  =item *
176    
177  Loads all of the above tables.  Loads all of the above tables.
# Line 254  Line 218 
218  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
219  and have load files already set up from the original version.  and have load files already set up from the original version.
220    
 =item primaryOnly  
   
 If TRUE, only the group's primary entity will be loaded.  
   
221  =item background  =item background
222    
223  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 281  Line 241 
241    
242  use strict;  use strict;
243  use Tracer;  use Tracer;
 use DocUtils;  
244  use Cwd;  use Cwd;
245  use FIG;  use FIG;
246  use SFXlate;  use SFXlate;
# Line 291  Line 250 
250  use Stats;  use Stats;
251  use SFXlate;  use SFXlate;
252    
253    # This is a list of the load groups in their natural order. We'll go through these in sequence, processing
254    # the ones the user asks for.
255    my @LoadGroups = qw(Genome Subsystem Property Annotation Source Reaction Synonym Family Drug Feature);
256    
257  # Get the command-line parameters and options.  # Get the command-line parameters and options.
258  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',  my ($options, @parameters) = StandardSetup(['SproutLoad', 'ERDBLoad', 'Stats',
259                                              'ERDB', 'Load', 'Sprout', 'Subsystem'],                                              'ERDB', 'Load', 'Sprout', 'Subsystem'],
# Line 299  Line 262 
262                                                dbLoad => [0, "load the database from generated files"],                                                dbLoad => [0, "load the database from generated files"],
263                                                dbCreate => [0, "drop and re-create the database"],                                                dbCreate => [0, "drop and re-create the database"],
264                                                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"],  
265                                                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"],
266                                                phone => ["", "phone number (international format) to call when load finishes"],                                                phone => ["", "phone number (international format) to call when load finishes"],
267                                              },                                              },
# Line 326  Line 288 
288  my $spl = SproutLoad->new($sprout, $fig, $geneFile, $options->{subsysFile}, $options);  my $spl = SproutLoad->new($sprout, $fig, $geneFile, $options->{subsysFile}, $options);
289  # Insure we have an output directory.  # Insure we have an output directory.
290  FIG::verify_dir($FIG_Config::sproutData);  FIG::verify_dir($FIG_Config::sproutData);
291    # Check for the "*" option.
292    if ($parameters[0] eq '*') {
293        @parameters = @LoadGroups;
294    }
295  # If we're resuming, we only want to have 1 parameter.  # If we're resuming, we only want to have 1 parameter.
296  my $resume = $options->{resume};  my $resume = $options->{resume};
297  if ($resume && @parameters > 1) {  if ($resume && @parameters > 1) {
# Line 333  Line 299 
299  } elsif (! @parameters) {  } elsif (! @parameters) {
300      Trace("No load groups were specified.") if T(0);      Trace("No load groups were specified.") if T(0);
301  }  }
302    # Process the resume option here. We modify the incoming parameters to
303    # contain the resume group and everything after it.
304    if ($resume) {
305        # Save the starting group.
306        my $resumeGroup = $parameters[0];
307        # Copy the load group list into the parameter array.
308        @parameters = @LoadGroups;
309        # Shift out the groups until we reach our desired starting point.
310        while (scalar(@parameters) && $parameters[0] ne $resumeGroup) {
311            shift @parameters;
312        }
313        if (! @parameters) {
314            Confess("Resume group \"$resumeGroup\" not found.");
315        }
316    }
317  # Set a variable to contain return type information.  # Set a variable to contain return type information.
318  my $rtype;  my $rtype;
319    # Set up a statistics object for statistics about the entire load.
320    my $totalStats = Stats->new();
321  # Insure we catch errors.  # Insure we catch errors.
322  eval {  eval {
323      # Process the parameters.      # Process the parameters.
324      for my $group (@parameters) {      for my $group (@parameters) {
325          Trace("Processing load group $group.") if T(2);          Trace("Processing load group $group.") if T(2);
326          my $stats;          # Compute the string we want to execute.
327          if ($group eq 'Genome' || $group eq '*') {          my $code = "\$spl->Load${group}Data()";
328              $spl->LoadGenomeData();          # Load this group.
329              $group = ResumeCheck($resume, $group);          my $stats = eval($code);
330          }          if ($@) {
331          if ($group eq 'Feature' || $group eq '*') {              Confess("Load group error: $@");
332              $spl->LoadFeatureData();          }
333              $group = ResumeCheck($resume, $group);          # Merge the statistics into the master.
334          }          $totalStats->Accumulate($stats);
         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 'BBH' || $group eq '*') {  
             $spl->LoadBBHData();  
             $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);  
335          }          }
336        # Compute the statistical display.
337        my $statDisplay = $totalStats->Show();
338        # Display it.
339        Trace("Statistics for this load:\n$statDisplay") if T(2);
340        # Check for a "table load failed" message. If we find one, we want
341        # to end with an error.
342        if ($statDisplay =~ /table load failed/i) {
343            Confess("One or more table loads failed.");
344      }      }
345  };  };
346  if ($@) {  if ($@) {
# Line 411  Line 359 
359      }      }
360  }  }
361    
 # If the resume flag is set, return "*", else return "".  
 sub ResumeCheck {  
     my ($resume, $group) = @_;  
     return ($resume ? "*" : $group);  
 }  
   
362  1;  1;

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.48

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3