[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.8, Wed Sep 14 09:57:27 2005 UTC revision 1.14, Fri Sep 16 02:38:49 2005 UTC
# Line 434  Line 434 
434      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
435      my $loadFeature = $self->_TableLoader('Feature', $featureCount);      my $loadFeature = $self->_TableLoader('Feature', $featureCount);
436      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn', $featureCount);      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn', $featureCount);
437      my ($loadFeatureAlias, $loadFeatureLink, $loadFeatureTranslation, $loadFeatureUpstream);      my $loadFeatureAlias = $self->_TableLoader('FeatureAlias', $featureCount * 6);
438        my ($loadFeatureLink, $loadFeatureTranslation, $loadFeatureUpstream);
439      if (! $limited) {      if (! $limited) {
         $loadFeatureAlias = $self->_TableLoader('FeatureAlias', $featureCount * 6);  
440          $loadFeatureLink = $self->_TableLoader('FeatureLink', $featureCount * 10);          $loadFeatureLink = $self->_TableLoader('FeatureLink', $featureCount * 10);
441          $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation', $featureCount);          $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation', $featureCount);
442          $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream', $featureCount);          $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream', $featureCount);
# Line 455  Line 455 
455          for my $featureData (@{$features}) {          for my $featureData (@{$features}) {
456              $loadFeature->Add("featureIn");              $loadFeature->Add("featureIn");
457              # Split the tuple.              # Split the tuple.
458              my ($featureID, $locations, $aliases, $type) = @{$featureData};              my ($featureID, $locations, undef, $type) = @{$featureData};
459              # Create the feature record.              # Create the feature record.
460              $loadFeature->Put($featureID, 1, $type);              $loadFeature->Put($featureID, 1, $type);
             # The next stuff is for a full load only.  
             if (! $limited) {  
461                  # Create the aliases.                  # Create the aliases.
462                  for my $alias (split /\s*,\s*/, $aliases) {              for my $alias ($fig->feature_aliases($featureID)) {
463                      $loadFeatureAlias->Put($featureID, $alias);                      $loadFeatureAlias->Put($featureID, $alias);
464                  }                  }
465                # The next stuff is for a full load only.
466                if (! $limited) {
467                  # Get the links.                  # Get the links.
468                  my @links = $fig->fid_links($featureID);                  my @links = $fig->fid_links($featureID);
469                  for my $link (@links) {                  for my $link (@links) {
# Line 493  Line 493 
493              # Loop through the locations.              # Loop through the locations.
494              for my $location (@locationList) {              for my $location (@locationList) {
495                  # Parse the location.                  # Parse the location.
496                  my $locObject = BasicLocation->new($location);                  my $locObject = BasicLocation->new("$genomeID:$location");
497                  # Split it into a list of chunks.                  # Split it into a list of chunks.
498                  my @locOList = ();                  my @locOList = ();
499                  while (my $peeling = $locObject->Peel($chunkSize)) {                  while (my $peeling = $locObject->Peel($chunkSize)) {
# Line 629  Line 629 
629      # Get the genome hash. We'll use it to filter the genomes in each      # Get the genome hash. We'll use it to filter the genomes in each
630      # spreadsheet.      # spreadsheet.
631      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
632        my @genomes = sort keys %{$genomeHash};
633      # Get the subsystem hash. This lists the subsystems we'll process.      # Get the subsystem hash. This lists the subsystems we'll process.
634      my $subsysHash = $self->{subsystems};      my $subsysHash = $self->{subsystems};
635      my @subsysIDs = sort keys %{$subsysHash};      my @subsysIDs = sort keys %{$subsysHash};
# Line 669  Line 670 
670              }              }
671          }          }
672          # Now all roles for this subsystem have been filled in. We create the          # Now all roles for this subsystem have been filled in. We create the
673          # spreadsheet by matches roles to genomes. To do this, we need to          # spreadsheet by matching roles to genomes.
         # get the genomes on the sheet.  
674          Trace("Creating subsystem $subsysID spreadsheet.") if T(3);          Trace("Creating subsystem $subsysID spreadsheet.") if T(3);
         my @genomes = map { $_->[0] } @{$fig->subsystem_genomes($subsysID)};  
675          for my $genomeID (@genomes) {          for my $genomeID (@genomes) {
676              # Only process this genome if it's one of ours.              # Count the PEGs and cells found for verification purposes.
677              if (exists $genomeHash->{$genomeID}) {              my $pegCount = 0;
678                  # Connect the genome to the subsystem.              my $cellCount = 0;
                 $loadParticipatesIn->Put($genomeID, $subsysID);  
679                  # Loop through the subsystem's roles. We use an index because it is                  # Loop through the subsystem's roles. We use an index because it is
680                  # part of the spreadsheet cell ID.                  # part of the spreadsheet cell ID.
681                  for (my $i = 0; $i <= $#roles; $i++) {                  for (my $i = 0; $i <= $#roles; $i++) {
# Line 687  Line 685 
685                      # Only proceed if features exist.                      # Only proceed if features exist.
686                      if (@pegs > 0) {                      if (@pegs > 0) {
687                          # Create the spreadsheet cell.                          # Create the spreadsheet cell.
688                        $cellCount++;
689                          my $cellID = "$subsysID:$genomeID:$i";                          my $cellID = "$subsysID:$genomeID:$i";
690                          $loadSSCell->Put($cellID);                          $loadSSCell->Put($cellID);
691                          $loadIsGenomeOf->Put($genomeID, $cellID);                          $loadIsGenomeOf->Put($genomeID, $cellID);
# Line 695  Line 694 
694                          # Attach the features to it.                          # Attach the features to it.
695                          for my $pegID (@pegs) {                          for my $pegID (@pegs) {
696                              $loadContainsFeature->Put($cellID, $pegID);                              $loadContainsFeature->Put($cellID, $pegID);
697                            $pegCount++;
698                          }                          }
699                      }                      }
700                  }                  }
701                # If we found some cells for this genome, denote it participates in the
702                # subsystem.
703                if ($pegCount > 0) {
704                    Trace("$pegCount PEGs in $cellCount cells for $genomeID.") if T(3);
705                    $loadParticipatesIn->Put($genomeID, $subsysID);
706              }              }
707          }          }
708      }      }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3