[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.22, Mon Dec 12 21:48:22 2005 UTC revision 1.23, Fri Jan 13 06:59:49 2006 UTC
# Line 171  Line 171 
171      return $retVal;      return $retVal;
172  }  }
173    
174    =head3 LoadOnly
175    
176    C<< my $flag = $spl->LoadOnly; >>
177    
178    Return TRUE if we are in load-only mode, else FALSE.
179    
180    =cut
181    
182    sub LoadOnly {
183        my ($self) = @_;
184        return $self->{options}->{loadOnly};
185    }
186    
187  =head3 LoadGenomeData  =head3 LoadGenomeData
188    
189  C<< my $stats = $spl->LoadGenomeData(); >>  C<< my $stats = $spl->LoadGenomeData(); >>
# Line 216  Line 229 
229      # Get the genome count.      # Get the genome count.
230      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
231      my $genomeCount = (keys %{$genomeHash});      my $genomeCount = (keys %{$genomeHash});
     Trace("Beginning genome data load.") if T(2);  
232      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
233      my $loadGenome = $self->_TableLoader('Genome', $genomeCount);      my $loadGenome = $self->_TableLoader('Genome');
234      my $loadHasContig = $self->_TableLoader('HasContig', $genomeCount * 300);      my $loadHasContig = $self->_TableLoader('HasContig');
235      my $loadContig = $self->_TableLoader('Contig', $genomeCount * 300);      my $loadContig = $self->_TableLoader('Contig');
236      my $loadIsMadeUpOf = $self->_TableLoader('IsMadeUpOf', $genomeCount * 60000);      my $loadIsMadeUpOf = $self->_TableLoader('IsMadeUpOf');
237      my $loadSequence = $self->_TableLoader('Sequence', $genomeCount * 60000);      my $loadSequence = $self->_TableLoader('Sequence');
238        if ($self->{options}->{loadOnly}) {
239            Trace("Loading from existing files.") if T(2);
240        } else {
241            Trace("Generating genome data.") if T(2);
242      # Now we loop through the genomes, generating the data for each one.      # Now we loop through the genomes, generating the data for each one.
243      for my $genomeID (sort keys %{$genomeHash}) {      for my $genomeID (sort keys %{$genomeHash}) {
244          Trace("Loading data for genome $genomeID.") if T(3);              Trace("Generating data for genome $genomeID.") if T(3);
245          $loadGenome->Add("genomeIn");          $loadGenome->Add("genomeIn");
246          # The access code comes in via the genome hash.          # The access code comes in via the genome hash.
247          my $accessCode = $genomeHash->{$genomeID};          my $accessCode = $genomeHash->{$genomeID};
# Line 268  Line 284 
284              }              }
285          }          }
286      }      }
287        }
288      # Finish the loads.      # Finish the loads.
289      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
290      # Return the result.      # Return the result.
# Line 311  Line 328 
328      my $genomeCount = (keys %{$genomeFilter});      my $genomeCount = (keys %{$genomeFilter});
329      my $featureCount = $genomeCount * 4000;      my $featureCount = $genomeCount * 4000;
330      # Start the loads.      # Start the loads.
331      my $loadCoupling = $self->_TableLoader('Coupling', $featureCount * $genomeCount);      my $loadCoupling = $self->_TableLoader('Coupling');
332      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy', $featureCount * 8000);      my $loadIsEvidencedBy = $self->_TableLoader('IsEvidencedBy');
333      my $loadPCH = $self->_TableLoader('PCH', $featureCount * 2000);      my $loadPCH = $self->_TableLoader('PCH');
334      my $loadParticipatesInCoupling = $self->_TableLoader('ParticipatesInCoupling', $featureCount * 2000);      my $loadParticipatesInCoupling = $self->_TableLoader('ParticipatesInCoupling');
335      my $loadUsesAsEvidence = $self->_TableLoader('UsesAsEvidence', $featureCount * 8000);      my $loadUsesAsEvidence = $self->_TableLoader('UsesAsEvidence');
336      Trace("Beginning coupling data load.") if T(2);      if ($self->{options}->{loadOnly}) {
337            Trace("Loading from existing files.") if T(2);
338        } else {
339            Trace("Generating coupling data.") if T(2);
340      # Loop through the genomes found.      # Loop through the genomes found.
341      for my $genome (sort keys %{$genomeFilter}) {      for my $genome (sort keys %{$genomeFilter}) {
342          Trace("Generating coupling data for $genome.") if T(3);          Trace("Generating coupling data for $genome.") if T(3);
# Line 389  Line 409 
409              }              }
410          }          }
411      }      }
412        }
413      # All done. Finish the load.      # All done. Finish the load.
414      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
415      return $retVal;      return $retVal;
# Line 426  Line 447 
447      my ($self) = @_;      my ($self) = @_;
448      # Get the FIG object.      # Get the FIG object.
449      my $fig = $self->{fig};      my $fig = $self->{fig};
     # Find out if this is a limited run.  
     my $limited = $self->{options}->{limitedFeatures};  
450      # Get the table of genome IDs.      # Get the table of genome IDs.
451      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
     my $featureCount = $genomeCount * 4000;  
452      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
453      my $loadFeature = $self->_TableLoader('Feature', $featureCount);      my $loadFeature = $self->_TableLoader('Feature');
454      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn', $featureCount);      my $loadIsLocatedIn = $self->_TableLoader('IsLocatedIn');
455      my $loadFeatureAlias = $self->_TableLoader('FeatureAlias', $featureCount * 6);      my $loadFeatureAlias = $self->_TableLoader('FeatureAlias');
456      my ($loadFeatureLink, $loadFeatureTranslation, $loadFeatureUpstream);      my $loadFeatureLink = $self->_TableLoader('FeatureLink');
457      if (! $limited) {      my $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation');
458          $loadFeatureLink = $self->_TableLoader('FeatureLink', $featureCount * 10);      my $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream');
         $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation', $featureCount);  
         $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream', $featureCount);  
     }  
459      # Get the maximum sequence size. We need this later for splitting up the      # Get the maximum sequence size. We need this later for splitting up the
460      # locations.      # locations.
461      my $chunkSize = $self->{sprout}->MaxSegment();      my $chunkSize = $self->{sprout}->MaxSegment();
462      Trace("Beginning feature data load.") if T(2);      if ($self->{options}->{loadOnly}) {
463            Trace("Loading from existing files.") if T(2);
464        } else {
465            Trace("Generating feature data.") if T(2);
466      # Now we loop through the genomes, generating the data for each one.      # Now we loop through the genomes, generating the data for each one.
467      for my $genomeID (sort keys %{$genomeHash}) {      for my $genomeID (sort keys %{$genomeHash}) {
468          Trace("Loading features for genome $genomeID.") if T(3);          Trace("Loading features for genome $genomeID.") if T(3);
# Line 463  Line 480 
480              for my $alias ($fig->feature_aliases($featureID)) {              for my $alias ($fig->feature_aliases($featureID)) {
481                  $loadFeatureAlias->Put($featureID, $alias);                  $loadFeatureAlias->Put($featureID, $alias);
482              }              }
             # The next stuff is for a full load only.  
             if (! $limited) {  
483                  # Get the links.                  # Get the links.
484                  my @links = $fig->fid_links($featureID);                  my @links = $fig->fid_links($featureID);
485                  for my $link (@links) {                  for my $link (@links) {
# Line 483  Line 498 
498                          $loadFeatureUpstream->Put($featureID, $upstream);                          $loadFeatureUpstream->Put($featureID, $upstream);
499                      }                      }
500                  }                  }
             }  
501              # This part is the roughest. We need to relate the features to contig              # This part is the roughest. We need to relate the features to contig
502              # locations, and the locations must be split so that none of them exceed              # locations, and the locations must be split so that none of them exceed
503              # the maximum segment size. This simplifies the genes_in_region processing              # the maximum segment size. This simplifies the genes_in_region processing
# Line 512  Line 526 
526              }              }
527          }          }
528      }      }
529        }
530      # Finish the loads.      # Finish the loads.
531      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
532      return $retVal;      return $retVal;
# Line 548  Line 563 
563      my $fig = $self->{fig};      my $fig = $self->{fig};
564      # Get the table of genome IDs.      # Get the table of genome IDs.
565      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
     my $featureCount = $genomeCount * 4000;  
566      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
567      my $loadIsBidirectionalBestHitOf = $self->_TableLoader('IsBidirectionalBestHitOf',      my $loadIsBidirectionalBestHitOf = $self->_TableLoader('IsBidirectionalBestHitOf');
568                                                             $featureCount * $genomeCount);      if ($self->{options}->{loadOnly}) {
569      Trace("Beginning BBH load.") if T(2);          Trace("Loading from existing files.") if T(2);
570        } else {
571            Trace("Generating BBH data.") if T(2);
572      # Now we loop through the genomes, generating the data for each one.      # Now we loop through the genomes, generating the data for each one.
573      for my $genomeID (sort keys %{$genomeHash}) {      for my $genomeID (sort keys %{$genomeHash}) {
574          $loadIsBidirectionalBestHitOf->Add("genomeIn");          $loadIsBidirectionalBestHitOf->Add("genomeIn");
# Line 579  Line 594 
594              }              }
595          }          }
596      }      }
597        }
598      # Finish the loads.      # Finish the loads.
599      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
600      return $retVal;      return $retVal;
# Line 639  Line 655 
655      # Get the subsystem hash. This lists the subsystems we'll process.      # Get the subsystem hash. This lists the subsystems we'll process.
656      my $subsysHash = $self->{subsystems};      my $subsysHash = $self->{subsystems};
657      my @subsysIDs = sort keys %{$subsysHash};      my @subsysIDs = sort keys %{$subsysHash};
     my $subsysCount = @subsysIDs;  
     my $genomeCount = (keys %{$genomeHash});  
     my $featureCount = $genomeCount * 4000;  
658      # Get the map list.      # Get the map list.
659      my @maps = $fig->all_maps;      my @maps = $fig->all_maps;
     my $mapCount = @maps;  
     # Create load objects for each of the tables we're loading.  
     my $loadDiagram = $self->_TableLoader('Diagram', $mapCount);  
     my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn', $featureCount * 6);  
     my $loadSubsystem = $self->_TableLoader('Subsystem', $subsysCount);  
     my $loadRole = $self->_TableLoader('Role', $featureCount * 6);  
     my $loadRoleEC = $self->_TableLoader('RoleEC', $featureCount * 6);  
     my $loadCatalyzes = $self->_TableLoader('Catalyzes', $genomeCount * $featureCount);  
     my $loadSSCell = $self->_TableLoader('SSCell', $featureCount * $genomeCount);  
     my $loadContainsFeature = $self->_TableLoader('ContainsFeature', $featureCount * $subsysCount);  
     my $loadIsGenomeOf = $self->_TableLoader('IsGenomeOf', $featureCount * $genomeCount);  
     my $loadIsRoleOf = $self->_TableLoader('IsRoleOf', $featureCount * $genomeCount);  
     my $loadOccursInSubsystem = $self->_TableLoader('OccursInSubsystem', $featureCount * 6);  
     my $loadParticipatesIn = $self->_TableLoader('ParticipatesIn', $subsysCount * $genomeCount);  
     my $loadHasSSCell = $self->_TableLoader('HasSSCell', $featureCount * $genomeCount);  
     my $loadRoleSubset = $self->_TableLoader('RoleSubset', $subsysCount * 50);  
     my $loadGenomeSubset = $self->_TableLoader('GenomeSubset', $subsysCount * 50);  
     my $loadConsistsOfRoles = $self->_TableLoader('ConsistsOfRoles', $featureCount * $genomeCount);  
     my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes', $featureCount * $genomeCount);  
     my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset', $subsysCount * 50);  
     my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset', $subsysCount * 50);  
660      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
661      Trace("Beginning subsystem data load.") if T(2);      my $loadDiagram = $self->_TableLoader('Diagram');
662        my $loadRoleOccursIn = $self->_TableLoader('RoleOccursIn');
663        my $loadSubsystem = $self->_TableLoader('Subsystem');
664        my $loadRole = $self->_TableLoader('Role');
665        my $loadRoleEC = $self->_TableLoader('RoleEC');
666        my $loadCatalyzes = $self->_TableLoader('Catalyzes');
667        my $loadSSCell = $self->_TableLoader('SSCell');
668        my $loadContainsFeature = $self->_TableLoader('ContainsFeature');
669        my $loadIsGenomeOf = $self->_TableLoader('IsGenomeOf');
670        my $loadIsRoleOf = $self->_TableLoader('IsRoleOf');
671        my $loadOccursInSubsystem = $self->_TableLoader('OccursInSubsystem');
672        my $loadParticipatesIn = $self->_TableLoader('ParticipatesIn');
673        my $loadHasSSCell = $self->_TableLoader('HasSSCell');
674        my $loadRoleSubset = $self->_TableLoader('RoleSubset');
675        my $loadGenomeSubset = $self->_TableLoader('GenomeSubset');
676        my $loadConsistsOfRoles = $self->_TableLoader('ConsistsOfRoles');
677        my $loadConsistsOfGenomes = $self->_TableLoader('ConsistsOfGenomes');
678        my $loadHasRoleSubset = $self->_TableLoader('HasRoleSubset');
679        my $loadHasGenomeSubset = $self->_TableLoader('HasGenomeSubset');
680        if ($self->{options}->{loadOnly}) {
681            Trace("Loading from existing files.") if T(2);
682        } else {
683            Trace("Generating subsystem data.") if T(2);
684      # This hash will contain the role for each EC. When we're done, this      # This hash will contain the role for each EC. When we're done, this
685      # information will be used to generate the Catalyzes table.      # information will be used to generate the Catalyzes table.
686      my %ecToRoles = ();      my %ecToRoles = ();
# Line 834  Line 848 
848              }              }
849          }          }
850      }      }
851        }
852      # Finish the load.      # Finish the load.
853      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
854      return $retVal;      return $retVal;
# Line 875  Line 890 
890      my $fig = $self->{fig};      my $fig = $self->{fig};
891      # Get the genome hash.      # Get the genome hash.
892      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
893      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
894      my $loadProperty = $self->_TableLoader('Property', $genomeCount * 1500);      my $loadProperty = $self->_TableLoader('Property');
895      my $loadHasProperty = $self->_TableLoader('HasProperty', $genomeCount * 1500);      my $loadHasProperty = $self->_TableLoader('HasProperty');
896      Trace("Beginning property data load.") if T(2);      if ($self->{options}->{loadOnly}) {
897            Trace("Loading from existing files.") if T(2);
898        } else {
899            Trace("Generating property data.") if T(2);
900      # Create a hash for storing property IDs.      # Create a hash for storing property IDs.
901      my %propertyKeys = ();      my %propertyKeys = ();
902      my $nextID = 1;      my $nextID = 1;
# Line 920  Line 937 
937              }              }
938          }          }
939      }      }
940        }
941      # Finish the load.      # Finish the load.
942      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
943      return $retVal;      return $retVal;
# Line 959  Line 977 
977      my $fig = $self->{fig};      my $fig = $self->{fig};
978      # Get the genome hash.      # Get the genome hash.
979      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
980      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
981      my $loadAnnotation = $self->_TableLoader('Annotation', $genomeCount * 4000);      my $loadAnnotation = $self->_TableLoader('Annotation');
982      my $loadIsTargetOfAnnotation = $self->_TableLoader('IsTargetOfAnnotation', $genomeCount * 4000);      my $loadIsTargetOfAnnotation = $self->_TableLoader('IsTargetOfAnnotation');
983      my $loadSproutUser = $self->_TableLoader('SproutUser', 100);      my $loadSproutUser = $self->_TableLoader('SproutUser');
984      my $loadUserAccess = $self->_TableLoader('UserAccess', 1000);      my $loadUserAccess = $self->_TableLoader('UserAccess');
985      my $loadMadeAnnotation = $self->_TableLoader('MadeAnnotation', $genomeCount * 4000);      my $loadMadeAnnotation = $self->_TableLoader('MadeAnnotation');
986      Trace("Beginning annotation data load.") if T(2);      if ($self->{options}->{loadOnly}) {
987            Trace("Loading from existing files.") if T(2);
988        } else {
989            Trace("Generating annotation data.") if T(2);
990      # Create a hash of user names. We'll use this to prevent us from generating duplicate      # Create a hash of user names. We'll use this to prevent us from generating duplicate
991      # user records.      # user records.
992      my %users = ( FIG => 1, master => 1 );      my %users = ( FIG => 1, master => 1 );
# Line 1026  Line 1046 
1046              }              }
1047          }          }
1048      }      }
1049        }
1050      # Finish the load.      # Finish the load.
1051      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1052      return $retVal;      return $retVal;
# Line 1066  Line 1087 
1087      my $fig = $self->{fig};      my $fig = $self->{fig};
1088      # Get the genome hash.      # Get the genome hash.
1089      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
1090      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
1091      my $loadComesFrom = $self->_TableLoader('ComesFrom', $genomeCount * 4);      my $loadComesFrom = $self->_TableLoader('ComesFrom');
1092      my $loadSource = $self->_TableLoader('Source', $genomeCount * 4);      my $loadSource = $self->_TableLoader('Source');
1093      my $loadSourceURL = $self->_TableLoader('SourceURL', $genomeCount * 8);      my $loadSourceURL = $self->_TableLoader('SourceURL');
1094      Trace("Beginning source data load.") if T(2);      if ($self->{options}->{loadOnly}) {
1095            Trace("Loading from existing files.") if T(2);
1096        } else {
1097            Trace("Generating annotation data.") if T(2);
1098      # Create hashes to collect the Source information.      # Create hashes to collect the Source information.
1099      my %sourceURL = ();      my %sourceURL = ();
1100      my %sourceDesc = ();      my %sourceDesc = ();
# Line 1101  Line 1124 
1124      for my $sourceID (keys %sourceDesc) {      for my $sourceID (keys %sourceDesc) {
1125          $loadSource->Put($sourceID, $sourceDesc{$sourceID});          $loadSource->Put($sourceID, $sourceDesc{$sourceID});
1126      }      }
1127        }
1128      # Finish the load.      # Finish the load.
1129      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1130      return $retVal;      return $retVal;
# Line 1140  Line 1164 
1164      my $fig = $self->{fig};      my $fig = $self->{fig};
1165      # Get the genome hash.      # Get the genome hash.
1166      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
1167      # Convert the genome hash. We'll get the genus and species for each genome and make      # Convert the genome hash. We'll get the genus and species for each genome and make
1168      # it the key.      # it the key.
1169      my %speciesHash = map { $fig->genus_species($_) => $_ } (keys %{$genomeHash});      my %speciesHash = map { $fig->genus_species($_) => $_ } (keys %{$genomeHash});
1170      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
1171      my $loadExternalAliasFunc = $self->_TableLoader('ExternalAliasFunc', $genomeCount * 4000);      my $loadExternalAliasFunc = $self->_TableLoader('ExternalAliasFunc');
1172      my $loadExternalAliasOrg = $self->_TableLoader('ExternalAliasOrg', $genomeCount * 4000);      my $loadExternalAliasOrg = $self->_TableLoader('ExternalAliasOrg');
1173      Trace("Beginning external data load.") if T(2);      if ($self->{options}->{loadOnly}) {
1174            Trace("Loading from existing files.") if T(2);
1175        } else {
1176            Trace("Generating external data.") if T(2);
1177      # We loop through the files one at a time. First, the organism file.      # We loop through the files one at a time. First, the organism file.
1178      Open(\*ORGS, "<$FIG_Config::global/ext_org.table");      Open(\*ORGS, "<$FIG_Config::global/ext_org.table");
1179      my $orgLine;      my $orgLine;
# Line 1177  Line 1203 
1203              $loadExternalAliasFunc->Put(@funcFields[0,1]);              $loadExternalAliasFunc->Put(@funcFields[0,1]);
1204          }          }
1205      }      }
1206        }
1207      # Finish the load.      # Finish the load.
1208      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1209      return $retVal;      return $retVal;
# Line 1217  Line 1244 
1244      my ($self) = @_;      my ($self) = @_;
1245      # Get the FIG object.      # Get the FIG object.
1246      my $fig = $self->{fig};      my $fig = $self->{fig};
     # Get the genome hash.  
     my $genomeHash = $self->{genomes};  
     my $genomeCount = (keys %{$genomeHash});  
1247      # Create load objects for each of the tables we're loading.      # Create load objects for each of the tables we're loading.
1248      my $loadReaction = $self->_TableLoader('Reaction', $genomeCount * 4000);      my $loadReaction = $self->_TableLoader('Reaction');
1249      my $loadReactionURL = $self->_TableLoader('ReactionURL', $genomeCount * 4000);      my $loadReactionURL = $self->_TableLoader('ReactionURL');
1250      my $loadCompound = $self->_TableLoader('Compound', $genomeCount * 4000);      my $loadCompound = $self->_TableLoader('Compound');
1251      my $loadCompoundName = $self->_TableLoader('CompoundName', $genomeCount * 8000);      my $loadCompoundName = $self->_TableLoader('CompoundName');
1252      my $loadCompoundCAS = $self->_TableLoader('CompoundCAS', $genomeCount * 4000);      my $loadCompoundCAS = $self->_TableLoader('CompoundCAS');
1253      my $loadIsAComponentOf = $self->_TableLoader('IsAComponentOf', $genomeCount * 12000);      my $loadIsAComponentOf = $self->_TableLoader('IsAComponentOf');
1254      Trace("Beginning reaction/compound data load.") if T(2);      if ($self->{options}->{loadOnly}) {
1255            Trace("Loading from existing files.") if T(2);
1256        } else {
1257            Trace("Generating annotation data.") if T(2);
1258      # First we create the compounds.      # First we create the compounds.
1259      my @compounds = $fig->all_compounds();      my @compounds = $fig->all_compounds();
1260      for my $cid (@compounds) {      for my $cid (@compounds) {
# Line 1276  Line 1303 
1303              }              }
1304          }          }
1305      }      }
1306        }
1307      # Finish the load.      # Finish the load.
1308      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1309      return $retVal;      return $retVal;
# Line 1311  Line 1339 
1339      my $fig = $self->{fig};      my $fig = $self->{fig};
1340      # Get the genome hash.      # Get the genome hash.
1341      my $genomeHash = $self->{genomes};      my $genomeHash = $self->{genomes};
     my $genomeCount = (keys %{$genomeHash});  
1342      # Create a load object for the table we're loading.      # Create a load object for the table we're loading.
1343      my $loadGenomeGroups = $self->_TableLoader('GenomeGroups', $genomeCount * 4);      my $loadGenomeGroups = $self->_TableLoader('GenomeGroups');
1344      Trace("Beginning group data load.") if T(2);      if ($self->{options}->{loadOnly}) {
1345            Trace("Loading from existing files.") if T(2);
1346        } else {
1347            Trace("Generating group data.") if T(2);
1348      # Loop through the genomes.      # Loop through the genomes.
1349      my $line;      my $line;
1350      for my $genomeID (keys %{$genomeHash}) {      for my $genomeID (keys %{$genomeHash}) {
# Line 1330  Line 1360 
1360          }          }
1361          close TMP;          close TMP;
1362      }      }
1363        }
1364      # Finish the load.      # Finish the load.
1365      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1366      return $retVal;      return $retVal;
# Line 1351  Line 1382 
1382    
1383  Name of the table (relation) being loaded.  Name of the table (relation) being loaded.
1384    
 =item rowCount (optional)  
   
 Estimated maximum number of rows in the table.  
   
1385  =item RETURN  =item RETURN
1386    
1387  Returns an ERDBLoad object for loading the specified table.  Returns an ERDBLoad object for loading the specified table.
# Line 1365  Line 1392 
1392    
1393  sub _TableLoader {  sub _TableLoader {
1394      # Get the parameters.      # Get the parameters.
1395      my ($self, $tableName, $rowCount) = @_;      my ($self, $tableName, $loadOnly) = @_;
1396      # Create the load object.      # Create the load object.
1397      my $retVal = ERDBLoad->new($self->{erdb}, $tableName, $self->{loadDirectory}, $rowCount);      my $retVal = ERDBLoad->new($self->{erdb}, $tableName, $self->{loadDirectory}, $self->LoadOnly);
1398      # Cache it in the loader list.      # Cache it in the loader list.
1399      push @{$self->{loaders}}, $retVal;      push @{$self->{loaders}}, $retVal;
1400      # Return it to the caller.      # Return it to the caller.
# Line 1406  Line 1433 
1433      while (my $loader = pop @{$loadList}) {      while (my $loader = pop @{$loadList}) {
1434          # Trace the fact that we're cleaning up.          # Trace the fact that we're cleaning up.
1435          my $relName = $loader->RelName;          my $relName = $loader->RelName;
1436          Trace("Finishing load for $relName.") if T(2);          Trace("Finishing $relName.") if T(2);
1437          my $stats = $loader->Finish();          my $stats = $loader->Finish();
1438          if ($self->{options}->{dbLoad}) {          if ($self->{options}->{dbLoad}) {
1439              # 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.

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3