[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.46, Mon Jun 26 19:13:16 2006 UTC revision 1.55, Thu Jul 13 10:03:24 2006 UTC
# Line 136  Line 136 
136      # We only need it if load-only is NOT specified.      # We only need it if load-only is NOT specified.
137      if (! $options->{loadOnly}) {      if (! $options->{loadOnly}) {
138          if (! defined $subsysFile || $subsysFile eq '') {          if (! defined $subsysFile || $subsysFile eq '') {
139              # Here we want all the NMPDR subsystems. First we get the whole list.              # Here we want all the usable subsystems. First we get the whole list.
140              my @subs = $fig->all_subsystems();              my @subs = $fig->all_subsystems();
141              # Loop through, checking for the NMPDR file.              # Loop through, checking for usability.
142              for my $sub (@subs) {              for my $sub (@subs) {
143                  if (-e "$FIG_Config::data/Subsystems/$sub/NMPDR") {                  if ($fig->usable_subsystem($sub)) {
144                      $subsystems{$sub} = 1;                      $subsystems{$sub} = 1;
145                  }                  }
146              }              }
# Line 340  Line 340 
340      my $fig = $self->{fig};      my $fig = $self->{fig};
341      # Get the genome hash.      # Get the genome hash.
342      my $genomeFilter = $self->{genomes};      my $genomeFilter = $self->{genomes};
343      my $genomeCount = (keys %{$genomeFilter});      # Set up an ID counter for the PCHs.
344      my $featureCount = $genomeCount * 4000;      my $pchID = 0;
345      # Start the loads.      # Start the loads.
346      my $loadCoupling = $self->_TableLoader('Coupling');      my $loadCoupling = $self->_TableLoader('Coupling');
347      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy', $self->PrimaryOnly);      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy', $self->PrimaryOnly);
# Line 375  Line 375 
375                  for my $coupleData (@couplings) {                  for my $coupleData (@couplings) {
376                      my ($peg2, $score) = @{$coupleData};                      my ($peg2, $score) = @{$coupleData};
377                      # Compute the coupling ID.                      # Compute the coupling ID.
378                      my $coupleID = Sprout::CouplingID($peg1, $peg2);                      my $coupleID = $self->{erdb}->CouplingID($peg1, $peg2);
379                      if (! exists $dupHash{$coupleID}) {                      if (! exists $dupHash{$coupleID}) {
380                          $loadCoupling->Add("couplingIn");                          $loadCoupling->Add("couplingIn");
381                          # Here we have a new coupling to store in the load files.                          # Here we have a new coupling to store in the load files.
# Line 411  Line 411 
411                              }                              }
412                          }                          }
413                          for my $evidenceID (keys %evidenceMap) {                          for my $evidenceID (keys %evidenceMap) {
414                                # Get the ID for this evidence.
415                                $pchID++;
416                              # Create the evidence record.                              # Create the evidence record.
417                              my ($peg3, $peg4, $usage) = @{$evidenceMap{$evidenceID}};                              my ($peg3, $peg4, $usage) = @{$evidenceMap{$evidenceID}};
418                              $loadPCH->Put($evidenceID, $usage);                              $loadPCH->Put($pchID, $usage);
419                              # Connect it to the coupling.                              # Connect it to the coupling.
420                              $loadIsEvidencedBy->Put($coupleID, $evidenceID);                              $loadIsEvidencedBy->Put($coupleID, $pchID);
421                              # Connect it to the features.                              # Connect it to the features.
422                              $loadUsesAsEvidence->Put($evidenceID, $peg3, 1);                              $loadUsesAsEvidence->Put($pchID, $peg3, 1);
423                              $loadUsesAsEvidence->Put($evidenceID, $peg4, 2);                              $loadUsesAsEvidence->Put($pchID, $peg4, 2);
424                          }                          }
425                      }                      }
426                  }                  }
# Line 486  Line 488 
488              $loadFeature->Add("genomeIn");              $loadFeature->Add("genomeIn");
489              # Get the feature list for this genome.              # Get the feature list for this genome.
490              my $features = $fig->all_features_detailed($genomeID);              my $features = $fig->all_features_detailed($genomeID);
491                my $count = scalar @{$features};
492                Trace("$count features found for genome $genomeID.") if T(3);
493              # Loop through the features.              # Loop through the features.
494              for my $featureData (@{$features}) {              for my $featureData (@{$features}) {
495                  $loadFeature->Add("featureIn");                  $loadFeature->Add("featureIn");
# Line 1536  Line 1540 
1540      my $retVal = Stats->new();      my $retVal = Stats->new();
1541      # Get the loader list.      # Get the loader list.
1542      my $loadList = $self->{loaders};      my $loadList = $self->{loaders};
1543        # Create a hash to hold the statistics objects, keyed on relation name.
1544        my %loaderHash = ();
1545      # 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
1546      # ignominiously. At some future point, we want to make the loads restartable.      # ignominiously. At some future point, we want to make the loads more restartable.
1547      while (my $loader = pop @{$loadList}) {      while (my $loader = pop @{$loadList}) {
1548          # Get the relation name.          # Get the relation name.
1549          my $relName = $loader->RelName;          my $relName = $loader->RelName;
# Line 1548  Line 1554 
1554              # Here we really need to finish.              # Here we really need to finish.
1555              Trace("Finishing $relName.") if T(2);              Trace("Finishing $relName.") if T(2);
1556              my $stats = $loader->Finish();              my $stats = $loader->Finish();
1557                $loaderHash{$relName} = $stats;
1558            }
1559        }
1560        # Now we loop through again, actually loading the tables. We want to finish before
1561        # loading so that if something goes wrong at this point, all the load files are usable
1562        # and we don't have to redo all that work.
1563        for my $relName (sort keys %loaderHash) {
1564            # Get the statistics for this relation.
1565            my $stats = $loaderHash{$relName};
1566            # Check for a database load.
1567              if ($self->{options}->{dbLoad}) {              if ($self->{options}->{dbLoad}) {
1568                  # 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.
1569                  Trace("Loading relation $relName.") if T(2);                  Trace("Loading relation $relName.") if T(2);
# Line 1558  Line 1574 
1574              $retVal->Accumulate($stats);              $retVal->Accumulate($stats);
1575              Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);              Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);
1576          }          }
     }  
1577      # Return the load statistics.      # Return the load statistics.
1578      return $retVal;      return $retVal;
1579  }  }

Legend:
Removed from v.1.46  
changed lines
  Added in v.1.55

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3