[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.51, Mon Jul 10 21:12:51 2006 UTC
# 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 370  Line 370 
370                  Trace("Processing PEG $peg1 for $genome.") if T(4);                  Trace("Processing PEG $peg1 for $genome.") if T(4);
371                  # Get a list of the coupled PEGs.                  # Get a list of the coupled PEGs.
372                  my @couplings = $fig->coupled_to($peg1);                  my @couplings = $fig->coupled_to($peg1);
373                    Trace(scalar(@couplings) . " couplings found for $peg1.") if T(4);
374                  # For each coupled PEG, we need to verify that a coupling already                  # For each coupled PEG, we need to verify that a coupling already
375                  # exists. If not, we have to create one.                  # exists. If not, we have to create one.
376                  for my $coupleData (@couplings) {                  for my $coupleData (@couplings) {
377                      my ($peg2, $score) = @{$coupleData};                      my ($peg2, $score) = @{$coupleData};
378                      # Compute the coupling ID.                      # Compute the coupling ID.
379                      my $coupleID = Sprout::CouplingID($peg1, $peg2);                      my $coupleID = $self->{erdb}->CouplingID($peg1, $peg2);
380                      if (! exists $dupHash{$coupleID}) {                      if (! exists $dupHash{$coupleID}) {
381                          $loadCoupling->Add("couplingIn");                          $loadCoupling->Add("couplingIn");
382                          # 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 412 
412                              }                              }
413                          }                          }
414                          for my $evidenceID (keys %evidenceMap) {                          for my $evidenceID (keys %evidenceMap) {
415                                # Get the ID for this evidence.
416                                $pchID++;
417                              # Create the evidence record.                              # Create the evidence record.
418                              my ($peg3, $peg4, $usage) = @{$evidenceMap{$evidenceID}};                              my ($peg3, $peg4, $usage) = @{$evidenceMap{$evidenceID}};
419                              $loadPCH->Put($evidenceID, $usage);                              $loadPCH->Put($pchID, $usage);
420                              # Connect it to the coupling.                              # Connect it to the coupling.
421                              $loadIsEvidencedBy->Put($coupleID, $evidenceID);                              $loadIsEvidencedBy->Put($coupleID, $pchID);
422                              # Connect it to the features.                              # Connect it to the features.
423                              $loadUsesAsEvidence->Put($evidenceID, $peg3, 1);                              $loadUsesAsEvidence->Put($pchID, $peg3, 1);
424                              $loadUsesAsEvidence->Put($evidenceID, $peg4, 2);                              $loadUsesAsEvidence->Put($pchID, $peg4, 2);
425                          }                          }
426                      }                      }
427                  }                  }
# Line 1536  Line 1539 
1539      my $retVal = Stats->new();      my $retVal = Stats->new();
1540      # Get the loader list.      # Get the loader list.
1541      my $loadList = $self->{loaders};      my $loadList = $self->{loaders};
1542        # Create a hash to hold the statistics objects, keyed on relation name.
1543        my %loaderHash = ();
1544      # 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
1545      # 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.
1546      while (my $loader = pop @{$loadList}) {      while (my $loader = pop @{$loadList}) {
1547          # Get the relation name.          # Get the relation name.
1548          my $relName = $loader->RelName;          my $relName = $loader->RelName;
# Line 1548  Line 1553 
1553              # Here we really need to finish.              # Here we really need to finish.
1554              Trace("Finishing $relName.") if T(2);              Trace("Finishing $relName.") if T(2);
1555              my $stats = $loader->Finish();              my $stats = $loader->Finish();
1556                $loaderHash{$relName} = $stats;
1557            }
1558        }
1559        # Now we loop through again, actually loading the tables. We want to finish before
1560        # loading so that if something goes wrong at this point, all the load files are usable
1561        # and we don't have to redo all that work.
1562        for my $relName (sort keys %loaderHash) {
1563            # Get the statistics for this relation.
1564            my $stats = $loaderHash{$relName};
1565            # Check for a database load.
1566              if ($self->{options}->{dbLoad}) {              if ($self->{options}->{dbLoad}) {
1567                  # 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.
1568                  Trace("Loading relation $relName.") if T(2);                  Trace("Loading relation $relName.") if T(2);
# Line 1558  Line 1573 
1573              $retVal->Accumulate($stats);              $retVal->Accumulate($stats);
1574              Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);              Trace("Statistics for $relName:\n" . $stats->Show()) if T(2);
1575          }          }
     }  
1576      # Return the load statistics.      # Return the load statistics.
1577      return $retVal;      return $retVal;
1578  }  }

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3