[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.85, Mon Jul 16 19:59:33 2007 UTC revision 1.89, Mon Nov 5 23:43:57 2007 UTC
# Line 12  Line 12 
12      use Stats;      use Stats;
13      use BasicLocation;      use BasicLocation;
14      use HTML;      use HTML;
15        use AliasAnalysis;
16    
17  =head1 Sprout Load Methods  =head1 Sprout Load Methods
18    
# Line 102  Line 103 
103              # Here we want all the complete genomes and an access code of 1.              # Here we want all the complete genomes and an access code of 1.
104              my @genomeList = $fig->genomes(1);              my @genomeList = $fig->genomes(1);
105              %genomes = map { $_ => 1 } @genomeList;              %genomes = map { $_ => 1 } @genomeList;
106                Trace(scalar(keys %genomes) . " genomes found.") if T(3);
107          } else {          } else {
108              my $type = ref $genomeFile;              my $type = ref $genomeFile;
109              Trace("Genome file parameter type is \"$type\".") if T(3);              Trace("Genome file parameter type is \"$type\".") if T(3);
# Line 168  Line 170 
170          for my $subsystem (keys %subsystems) {          for my $subsystem (keys %subsystems) {
171              my $name = $subsystem;              my $name = $subsystem;
172              $name =~ s/_/ /g;              $name =~ s/_/ /g;
173              my $classes = $fig->subsystem_classification($subsystem);  #            my $classes = $fig->subsystem_classification($subsystem);
174              $name .= " " . join(" ", @{$classes});  #            $name .= " " . join(" ", @{$classes});
175              $subsystems{$subsystem} = $name;              $subsystems{$subsystem} = $name;
176          }          }
177      }      }
# Line 397  Line 399 
399      } else {      } else {
400          Trace("Generating feature data.") if T(2);          Trace("Generating feature data.") if T(2);
401          # Now we loop through the genomes, generating the data for each one.          # Now we loop through the genomes, generating the data for each one.
402          for my $genomeID (sort keys %{$genomeHash}) {          my @allGenomes = sort keys %{$genomeHash};
403            Trace(scalar(@allGenomes) . " genomes found in list.") if T(3);
404            for my $genomeID (@allGenomes) {
405              Trace("Loading features for genome $genomeID.") if T(3);              Trace("Loading features for genome $genomeID.") if T(3);
406              $loadFeature->Add("genomeIn");              $loadFeature->Add("genomeIn");
407              # Get the feature list for this genome.              # Get the feature list for this genome.
# Line 409  Line 413 
413              Trace("$count features found for genome $genomeID.") if T(3);              Trace("$count features found for genome $genomeID.") if T(3);
414              # Get the attributes for this genome and put them in a hash by feature ID.              # Get the attributes for this genome and put them in a hash by feature ID.
415              my $attributes = GetGenomeAttributes($fig, $genomeID, \@fids, $propKeys);              my $attributes = GetGenomeAttributes($fig, $genomeID, \@fids, $propKeys);
416                Trace("Looping through features for $genomeID.") if T(3);
417              # Set up for our duplicate-feature check.              # Set up for our duplicate-feature check.
418              my $oldFeatureID = "";              my $oldFeatureID = "";
419              # Loop through the features.              # Loop through the features.
# Line 474  Line 479 
479                      }                      }
480                      # Now we need to find the subsystems this feature participates in.                      # Now we need to find the subsystems this feature participates in.
481                      # We also add the subsystems to the keyword list. Before we do that,                      # We also add the subsystems to the keyword list. Before we do that,
482                      # we must convert underscores to spaces and tack on the classifications.                      # we must convert underscores to spaces.
483                      my @subsystems = $fig->peg_to_subsystems($featureID);                      my @subsystems = $fig->peg_to_subsystems($featureID);
484                      for my $subsystem (@subsystems) {                      for my $subsystem (@subsystems) {
485                          # Only proceed if we like this subsystem.                          # Only proceed if we like this subsystem.
# Line 552  Line 557 
557                          my @cddData = sort keys %{$cddHash};                          my @cddData = sort keys %{$cddHash};
558                          for my $cdd (@cddData) {                          for my $cdd (@cddData) {
559                              # Extract the score for this CDD and decode it.                              # Extract the score for this CDD and decode it.
560                              my ($codeScore) = split(/\s*,\s*/, $cddHash->{$cdd}->[0]);                              my ($codeScore) = split(/\s*,\s*/, $cddHash->{$cdd}->[1]);
561                              my $realScore = FIGRules::DecodeScore($codeScore);                              my $realScore = FIGRules::DecodeScore($codeScore);
562                                # We can't afford to crash because of a bad attribute
563                                # value, hence the IF below.
564                                if (! defined($realScore)) {
565                                    # Bad score, so count it.
566                                    $loadFeature->Add('badCDDscore');
567                                } else {
568                              # Create the connection.                              # Create the connection.
569                              $loadIsPresentOnProteinOf->Put($cdd, $featureID, $realScore);                              $loadIsPresentOnProteinOf->Put($cdd, $featureID, $realScore);
570                              # If this CDD does not yet exist, create its record.                              # If this CDD does not yet exist, create its record.
# Line 563  Line 574 
574                              }                              }
575                          }                          }
576                      }                      }
577                        }
578                      # Now we need to bust up hyphenated words in the keyword                      # Now we need to bust up hyphenated words in the keyword
579                      # list. We keep them separate and put them at the end so                      # list. We keep them separate and put them at the end so
580                      # the original word order is available.                      # the original word order is available.
# Line 615  Line 627 
627                      $loadFeature->Put($featureID, 1, $user, $quality, $celloValue, $type, $assignment, $cleanWords, $locations);                      $loadFeature->Put($featureID, 1, $user, $quality, $celloValue, $type, $assignment, $cleanWords, $locations);
628                  }                  }
629              }              }
630                Trace("Genome $genomeID processed.") if T(3);
631          }          }
632      }      }
633      # Finish the loads.      # Finish the loads.
# Line 872  Line 885 
885              # Now we need to link all the map's roles to it.              # Now we need to link all the map's roles to it.
886              # A hash is used to prevent duplicates.              # A hash is used to prevent duplicates.
887              my %roleHash = ();              my %roleHash = ();
888              for my $role ($fig->map_to_ecs($map)) {              for my $ec ($fig->map_to_ecs($map)) {
889                  if (exists $ecToRoles{$role} && ! $roleHash{$role}) {                  if (exists $ecToRoles{$ec}) {
890                      $loadRoleOccursIn->Put($ecToRoles{$role}, $map);                      for my $role (@{$ecToRoles{$ec}}) {
891                            if (! $roleHash{$role}) {
892                                $loadRoleOccursIn->Put($role, $map);
893                      $roleHash{$role} = 1;                      $roleHash{$role} = 1;
894                  }                  }
895              }              }
896          }          }
897                }
898            }
899          # Before we leave, we must create the Catalyzes table. We start with the reactions,          # Before we leave, we must create the Catalyzes table. We start with the reactions,
900          # then use the "ecToRoles" table to convert EC numbers to role IDs.          # then use the "ecToRoles" table to convert EC numbers to role IDs.
901          my @reactions = $fig->all_reactions();          my @reactions = $fig->all_reactions();

Legend:
Removed from v.1.85  
changed lines
  Added in v.1.89

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3