[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.26, Mon Jan 30 21:57:02 2006 UTC revision 1.34, Sat May 13 04:13:24 2006 UTC
# Line 80  Line 80 
80  =item subsysFile  =item subsysFile
81    
82  Either the name of the file containing the list of trusted subsystems or a reference  Either the name of the file containing the list of trusted subsystems or a reference
83  to a list of subsystem names. If nothing is specified, all known subsystems will be  to a list of subsystem names. If nothing is specified, all NMPDR subsystems will be
84  considered trusted. Only subsystem data related to the trusted subsystems is loaded.  considered trusted. (A subsystem is considered NMPDR if it has a file named C<NMPDR>
85    in its data directory.) Only subsystem data related to the trusted subsystems is loaded.
86    
87  =item options  =item options
88    
# Line 132  Line 133 
133      # Load the list of trusted subsystems.      # Load the list of trusted subsystems.
134      my %subsystems = ();      my %subsystems = ();
135      if (! defined $subsysFile || $subsysFile eq '') {      if (! defined $subsysFile || $subsysFile eq '') {
136          # Here we want all the subsystems.          # Here we want all the NMPDR subsystems. First we get the whole list.
137          %subsystems = map { $_ => 1 } $fig->all_subsystems();          my @subs = $fig->all_subsystems();
138            # Loop through, checking for the NMPDR file.
139            for my $sub (@subs) {
140                if (-e "$FIG_Config::data/Subsystems/$sub/NMPDR") {
141                    $subsystems{$sub} = 1;
142                }
143            }
144      } else {      } else {
145          my $type = ref $subsysFile;          my $type = ref $subsysFile;
146          if ($type eq 'ARRAY') {          if ($type eq 'ARRAY') {
# Line 250  Line 257 
257              $loadGenome->Add("genomeIn");              $loadGenome->Add("genomeIn");
258              # The access code comes in via the genome hash.              # The access code comes in via the genome hash.
259              my $accessCode = $genomeHash->{$genomeID};              my $accessCode = $genomeHash->{$genomeID};
260              # Get the genus, species, and strain from the scientific name. Note that we append              # Get the genus, species, and strain from the scientific name.
             # the genome ID to the strain. In some cases this is the totality of the strain name.  
261              my ($genus, $species, @extraData) = split / /, $self->{fig}->genus_species($genomeID);              my ($genus, $species, @extraData) = split / /, $self->{fig}->genus_species($genomeID);
262              my $extra = join " ", @extraData, "[$genomeID]";              my $extra = join " ", @extraData;
263              # Get the full taxonomy.              # Get the full taxonomy.
264              my $taxonomy = $fig->taxonomy_of($genomeID);              my $taxonomy = $fig->taxonomy_of($genomeID);
265              # Output the genome record.              # Output the genome record.
# Line 436  Line 442 
442      FeatureTranslation      FeatureTranslation
443      FeatureUpstream      FeatureUpstream
444      IsLocatedIn      IsLocatedIn
445        HasFeature
446    
447  =over 4  =over 4
448    
# Line 461  Line 468 
468      my $loadFeatureLink = $self->_TableLoader('FeatureLink');      my $loadFeatureLink = $self->_TableLoader('FeatureLink');
469      my $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation');      my $loadFeatureTranslation = $self->_TableLoader('FeatureTranslation');
470      my $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream');      my $loadFeatureUpstream = $self->_TableLoader('FeatureUpstream');
471        my $loadHasFeature = $self->_TableLoader('HasFeature');
472      # 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
473      # locations.      # locations.
474      my $chunkSize = $self->{sprout}->MaxSegment();      my $chunkSize = $self->{sprout}->MaxSegment();
# Line 481  Line 489 
489                  my ($featureID, $locations, undef, $type) = @{$featureData};                  my ($featureID, $locations, undef, $type) = @{$featureData};
490                  # Create the feature record.                  # Create the feature record.
491                  $loadFeature->Put($featureID, 1, $type);                  $loadFeature->Put($featureID, 1, $type);
492                    # Link it to the parent genome.
493                    $loadHasFeature->Put($genomeID, $featureID, $type);
494                  # Create the aliases.                  # Create the aliases.
495                  for my $alias ($fig->feature_aliases($featureID)) {                  for my $alias ($fig->feature_aliases($featureID)) {
496                      $loadFeatureAlias->Put($featureID, $alias);                      $loadFeatureAlias->Put($featureID, $alias);
# Line 697  Line 707 
707          my ($genomeID, $roleID);          my ($genomeID, $roleID);
708          my %roleData = ();          my %roleData = ();
709          for my $subsysID (@subsysIDs) {          for my $subsysID (@subsysIDs) {
             Trace("Creating subsystem $subsysID.") if T(3);  
             $loadSubsystem->Add("subsystemIn");  
710              # Get the subsystem object.              # Get the subsystem object.
711              my $sub = $fig->get_subsystem($subsysID);              my $sub = $fig->get_subsystem($subsysID);
712                # Only proceed if the subsystem has a spreadsheet.
713                if (! $sub->{empty_ss}) {
714                    Trace("Creating subsystem $subsysID.") if T(3);
715                    $loadSubsystem->Add("subsystemIn");
716              # Create the subsystem record.              # Create the subsystem record.
717              my $curator = $sub->get_curator();              my $curator = $sub->get_curator();
718              my $notes = $sub->get_notes();              my $notes = $sub->get_notes();
# Line 801  Line 813 
813                  # Connect the subset to the subsystem.                  # Connect the subset to the subsystem.
814                  $loadHasRoleSubset->Put($subsysID, $actualID);                  $loadHasRoleSubset->Put($subsysID, $actualID);
815                  # Connect the subset to its roles.                  # Connect the subset to its roles.
816                  my @roles = $sub->get_subset($subsetID);                      my @roles = $sub->get_subsetC_roles($subsetID);
817                  for my $roleID (@roles) {                  for my $roleID (@roles) {
818                      $loadConsistsOfRoles->Put($actualID, $roleID);                      $loadConsistsOfRoles->Put($actualID, $roleID);
819                  }                  }
# Line 854  Line 866 
866              }              }
867          }          }
868      }      }
869        }
870      # Finish the load.      # Finish the load.
871      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
872      return $retVal;      return $retVal;
# Line 1460  Line 1473 
1473              # Here we really need to finish.              # Here we really need to finish.
1474              Trace("Finishing $relName.") if T(2);              Trace("Finishing $relName.") if T(2);
1475              my $stats = $loader->Finish();              my $stats = $loader->Finish();
1476              if ($self->{options}->{dbLoad} && ! $loader->Ignore) {              if ($self->{options}->{dbLoad}) {
1477                  # 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.
1478                  Trace("Loading relation $relName.") if T(2);                  Trace("Loading relation $relName.") if T(2);
1479                  my $newStats = $self->{sprout}->LoadUpdate(1, [$relName]);                  my $newStats = $self->{sprout}->LoadUpdate(1, [$relName]);

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3