[Bio] / Sprout / SproutLoad.pm Repository:
ViewVC logotype

Diff of /Sprout/SproutLoad.pm

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

revision 1.24, Tue Jan 17 01:10:54 2006 UTC revision 1.26, Mon Jan 30 21:57:02 2006 UTC
# Line 184  Line 184 
184      return $self->{options}->{loadOnly};      return $self->{options}->{loadOnly};
185  }  }
186    
187    =head3 PrimaryOnly
188    
189    C<< my $flag = $spl->PrimaryOnly; >>
190    
191    Return TRUE if only the main entity is to be loaded, else FALSE.
192    
193    =cut
194    
195    sub PrimaryOnly {
196        my ($self) = @_;
197        return $self->{options}->{primaryOnly};
198    }
199    
200  =head3 LoadGenomeData  =head3 LoadGenomeData
201    
202  C<< my $stats = $spl->LoadGenomeData(); >>  C<< my $stats = $spl->LoadGenomeData(); >>
# Line 211  Line 224 
224    
225  =back  =back
226    
 B<TO DO>  
   
 Real quality vectors instead of C<unknown> for everything.  
   
 GenomeGroup relation. (The original script took group information from the C<NMPDR> file  
 in each genome's main directory, but no such file exists anywhere in my version of the  
 data store.)  
   
227  =cut  =cut
228  #: Return Type $%;  #: Return Type $%;
229  sub LoadGenomeData {  sub LoadGenomeData {
# Line 231  Line 236 
236      my $genomeCount = (keys %{$genomeHash});      my $genomeCount = (keys %{$genomeHash});
237      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
238      my $loadGenome = $self->_TableLoader('Genome');      my $loadGenome = $self->_TableLoader('Genome');
239      my $loadHasContig = $self->_TableLoader('HasContig');      my $loadHasContig = $self->_TableLoader('HasContig', $self->PrimaryOnly);
240      my $loadContig = $self->_TableLoader('Contig');      my $loadContig = $self->_TableLoader('Contig', $self->PrimaryOnly);
241      my $loadIsMadeUpOf = $self->_TableLoader('IsMadeUpOf');      my $loadIsMadeUpOf = $self->_TableLoader('IsMadeUpOf', $self->PrimaryOnly);
242      my $loadSequence = $self->_TableLoader('Sequence');      my $loadSequence = $self->_TableLoader('Sequence', $self->PrimaryOnly);
243      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
244          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
245      } else {      } else {
# Line 329  Line 334 
334      my $featureCount = $genomeCount * 4000;      my $featureCount = $genomeCount * 4000;
335      # Start the loads.      # Start the loads.
336      my $loadCoupling = $self->_TableLoader('Coupling');      my $loadCoupling = $self->_TableLoader('Coupling');
337      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy');      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy', $self->PrimaryOnly);
338      my $loadPCH = $self->_TableLoader('PCH');      my $loadPCH = $self->_TableLoader('PCH', $self->PrimaryOnly);
339      my $loadParticipatesInCoupling = $self->_TableLoader('ParticipatesInCoupling');      my $loadParticipatesInCoupling = $self->_TableLoader('ParticipatesInCoupling', $self->PrimaryOnly);
340      my $loadUsesAsEvidence = $self->_TableLoader('UsesAsEvidence');      my $loadUsesAsEvidence = $self->_TableLoader('UsesAsEvidence', $self->PrimaryOnly);
341      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
342          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
343      } else {      } else {
# Line 451  Line 456 
456      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
457      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
458      my $loadFeature = $self->_TableLoader('Feature');      my $loadFeature = $self->_TableLoader('Feature');
459      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn');      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn', $self->PrimaryOnly);
460      my $loadFeatureAlias = $self->_TableLoader('FeatureAlias');      my $loadFeatureAlias = $self->_TableLoader('FeatureAlias');
461      my $loadFeatureLink = $self->_TableLoader('FeatureLink');      my $loadFeatureLink = $self->_TableLoader('FeatureLink');
462      my $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation');      my $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation');
# Line 658  Line 663 
663      # Get the map list.      # Get the map list.
664      my @maps = $fig->all_maps;      my @maps = $fig->all_maps;
665      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
666      my $loadDiagram = $self->_TableLoader('Diagram');      my $loadDiagram = $self->_TableLoader('Diagram', $self->PrimaryOnly);
667      my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn');      my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn', $self->PrimaryOnly);
668      my $loadSubsystem = $self->_TableLoader('Subsystem');      my $loadSubsystem = $self->_TableLoader('Subsystem');
669      my $loadRole = $self->_TableLoader('Role');      my $loadRole = $self->_TableLoader('Role', $self->PrimaryOnly);
670      my $loadRoleEC = $self->_TableLoader('RoleEC');      my $loadRoleEC = $self->_TableLoader('RoleEC', $self->PrimaryOnly);
671      my $loadCatalyzes = $self->_TableLoader('Catalyzes');      my $loadCatalyzes = $self->_TableLoader('Catalyzes', $self->PrimaryOnly);
672      my $loadSSCell = $self->_TableLoader('SSCell');      my $loadSSCell = $self->_TableLoader('SSCell', $self->PrimaryOnly);
673      my $loadContainsFeature = $self->_TableLoader('ContainsFeature');      my $loadContainsFeature = $self->_TableLoader('ContainsFeature', $self->PrimaryOnly);
674      my $loadIsGenomeOf = $self->_TableLoader('IsGenomeOf');      my $loadIsGenomeOf = $self->_TableLoader('IsGenomeOf', $self->PrimaryOnly);
675      my $loadIsRoleOf = $self->_TableLoader('IsRoleOf');      my $loadIsRoleOf = $self->_TableLoader('IsRoleOf', $self->PrimaryOnly);
676      my $loadOccursInSubsystem = $self->_TableLoader('OccursInSubsystem');      my $loadOccursInSubsystem = $self->_TableLoader('OccursInSubsystem', $self->PrimaryOnly);
677      my $loadParticipatesIn = $self->_TableLoader('ParticipatesIn');      my $loadParticipatesIn = $self->_TableLoader('ParticipatesIn', $self->PrimaryOnly);
678      my $loadHasSSCell = $self->_TableLoader('HasSSCell');      my $loadHasSSCell = $self->_TableLoader('HasSSCell', $self->PrimaryOnly);
679      my $loadRoleSubset = $self->_TableLoader('RoleSubset');      my $loadRoleSubset = $self->_TableLoader('RoleSubset', $self->PrimaryOnly);
680      my $loadGenomeSubset = $self->_TableLoader('GenomeSubset');      my $loadGenomeSubset = $self->_TableLoader('GenomeSubset', $self->PrimaryOnly);
681      my $loadConsistsOfRoles = $self->_TableLoader('ConsistsOfRoles');      my $loadConsistsOfRoles = $self->_TableLoader('ConsistsOfRoles', $self->PrimaryOnly);
682      my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes');      my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes', $self->PrimaryOnly);
683      my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset');      my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset', $self->PrimaryOnly);
684      my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset');      my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset', $self->PrimaryOnly);
685      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
686          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
687      } else {      } else {
# Line 892  Line 897 
897      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
898      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
899      my $loadProperty = $self->_TableLoader('Property');      my $loadProperty = $self->_TableLoader('Property');
900      my $loadHasProperty = $self->_TableLoader('HasProperty');      my $loadHasProperty = $self->_TableLoader('HasProperty', $self->PrimaryOnly);
901      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
902          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
903      } else {      } else {
# Line 989  Line 994 
994      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
995      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
996      my $loadAnnotation = $self->_TableLoader('Annotation');      my $loadAnnotation = $self->_TableLoader('Annotation');
997      my $loadIsTargetOfAnnotation = $self->_TableLoader('IsTargetOfAnnotation');      my $loadIsTargetOfAnnotation = $self->_TableLoader('IsTargetOfAnnotation', $self->PrimaryOnly);
998      my $loadSproutUser = $self->_TableLoader('SproutUser');      my $loadSproutUser = $self->_TableLoader('SproutUser', $self->PrimaryOnly);
999      my $loadUserAccess = $self->_TableLoader('UserAccess');      my $loadUserAccess = $self->_TableLoader('UserAccess', $self->PrimaryOnly);
1000      my $loadMadeAnnotation = $self->_TableLoader('MadeAnnotation');      my $loadMadeAnnotation = $self->_TableLoader('MadeAnnotation', $self->PrimaryOnly);
1001      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
1002          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
1003      } else {      } else {
# Line 1098  Line 1103 
1103      # Get the genome hash.      # Get the genome hash.
1104      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
1105      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
1106      my $loadComesFrom = $self->_TableLoader('ComesFrom');      my $loadComesFrom = $self->_TableLoader('ComesFrom', $self->PrimaryOnly);
1107      my $loadSource = $self->_TableLoader('Source');      my $loadSource = $self->_TableLoader('Source');
1108      my $loadSourceURL = $self->_TableLoader('SourceURL');      my $loadSourceURL = $self->_TableLoader('SourceURL');
1109      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
# Line 1256  Line 1261 
1261      my $fig = $self->{fig};      my $fig = $self->{fig};
1262      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
1263      my $loadReaction = $self->_TableLoader('Reaction');      my $loadReaction = $self->_TableLoader('Reaction');
1264      my $loadReactionURL = $self->_TableLoader('ReactionURL');      my $loadReactionURL = $self->_TableLoader('ReactionURL', $self->PrimaryOnly);
1265      my $loadCompound = $self->_TableLoader('Compound');      my $loadCompound = $self->_TableLoader('Compound', $self->PrimaryOnly);
1266      my $loadCompoundName = $self->_TableLoader('CompoundName');      my $loadCompoundName = $self->_TableLoader('CompoundName', $self->PrimaryOnly);
1267      my $loadCompoundCAS = $self->_TableLoader('CompoundCAS');      my $loadCompoundCAS = $self->_TableLoader('CompoundCAS', $self->PrimaryOnly);
1268      my $loadIsAComponentOf = $self->_TableLoader('IsAComponentOf');      my $loadIsAComponentOf = $self->_TableLoader('IsAComponentOf', $self->PrimaryOnly);
1269      if ($self->{options}->{loadOnly}) {      if ($self->{options}->{loadOnly}) {
1270          Trace("Loading from existing files.") if T(2);          Trace("Loading from existing files.") if T(2);
1271      } else {      } else {
# Line 1392  Line 1397 
1397    
1398  Name of the table (relation) being loaded.  Name of the table (relation) being loaded.
1399    
1400    =item ignore
1401    
1402    TRUE if the table should be ignored entirely, else FALSE.
1403    
1404  =item RETURN  =item RETURN
1405    
1406  Returns an ERDBLoad object for loading the specified table.  Returns an ERDBLoad object for loading the specified table.
# Line 1402  Line 1411 
1411    
1412  sub _TableLoader {  sub _TableLoader {
1413      # Get the parameters.      # Get the parameters.
1414      my ($self, $tableName, $loadOnly) = @_;      my ($self, $tableName, $ignore) = @_;
1415      # Create the load object.      # Create the load object.
1416      my $retVal = ERDBLoad->new($self->{erdb}, $tableName, $self->{loadDirectory}, $self->LoadOnly);      my $retVal = ERDBLoad->new($self->{erdb}, $tableName, $self->{loadDirectory}, $self->LoadOnly,
1417                                   $ignore);
1418      # Cache it in the loader list.      # Cache it in the loader list.
1419      push @{$self->{loaders}}, $retVal;      push @{$self->{loaders}}, $retVal;
1420      # Return it to the caller.      # Return it to the caller.
# Line 1441  Line 1451 
1451      # Loop through the list, finishing the loads. Note that if the finish fails, we die      # Loop through the list, finishing the loads. Note that if the finish fails, we die
1452      # ignominiously. At some future point, we want to make the loads restartable.      # ignominiously. At some future point, we want to make the loads restartable.
1453      while (my $loader = pop @{$loadList}) {      while (my $loader = pop @{$loadList}) {
1454          # Trace the fact that we're cleaning up.          # Get the relation name.
1455          my $relName = $loader->RelName;          my $relName = $loader->RelName;
1456            # Check the ignore flag.
1457            if ($loader->Ignore) {
1458                Trace("Relation $relName not loaded.") if T(2);
1459            } else {
1460                # Here we really need to finish.
1461          Trace("Finishing $relName.") if T(2);          Trace("Finishing $relName.") if T(2);
1462          my $stats = $loader->Finish();          my $stats = $loader->Finish();
1463          if ($self->{options}->{dbLoad}) {              if ($self->{options}->{dbLoad} && ! $loader->Ignore) {
1464              # Here we want to use the load file just created to load the database.              # Here we want to use the load file just created to load the database.
1465              Trace("Loading relation $relName.") if T(2);              Trace("Loading relation $relName.") if T(2);
1466              my $newStats = $self->{sprout}->LoadUpdate(1, [$relName]);              my $newStats = $self->{sprout}->LoadUpdate(1, [$relName]);
# Line 1455  Line 1470 
1470          $retVal->Accumulate($stats);          $retVal->Accumulate($stats);
1471          Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);          Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);
1472      }      }
1473        }
1474      # Return the load statistics.      # Return the load statistics.
1475      return $retVal;      return $retVal;
1476  }  }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.26

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3