[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.34, Sat May 13 04:13:24 2006 UTC revision 1.37, Sat May 27 02:01:24 2006 UTC
# Line 95  Line 95 
95  sub new {  sub new {
96      # Get the parameters.      # Get the parameters.
97      my ($class, $sprout, $fig, $genomeFile, $subsysFile, $options) = @_;      my ($class, $sprout, $fig, $genomeFile, $subsysFile, $options) = @_;
98      # Load the list of genomes into a hash.      # Create the genome hash.
99      my %genomes;      my %genomes = ();
100        # We only need it if load-only is NOT specified.
101        if (! $options->{loadOnly}) {
102      if (! defined($genomeFile) || $genomeFile eq '') {      if (! defined($genomeFile) || $genomeFile eq '') {
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);
# Line 130  Line 132 
132              Confess("Invalid genome parameter ($type) in SproutLoad constructor.");              Confess("Invalid genome parameter ($type) in SproutLoad constructor.");
133          }          }
134      }      }
135        }
136      # Load the list of trusted subsystems.      # Load the list of trusted subsystems.
137      my %subsystems = ();      my %subsystems = ();
138        # We only need it if load-only is NOT specified.
139        if (! $options->{loadOnly}) {
140      if (! defined $subsysFile || $subsysFile eq '') {      if (! defined $subsysFile || $subsysFile eq '') {
141          # Here we want all the NMPDR subsystems. First we get the whole list.          # Here we want all the NMPDR subsystems. First we get the whole list.
142          my @subs = $fig->all_subsystems();          my @subs = $fig->all_subsystems();
# Line 160  Line 165 
165              Confess("Invalid subsystem parameter in SproutLoad constructor.");              Confess("Invalid subsystem parameter in SproutLoad constructor.");
166          }          }
167      }      }
168        }
169      # Get the data directory from the Sprout object.      # Get the data directory from the Sprout object.
170      my ($directory) = $sprout->LoadInfo();      my ($directory) = $sprout->LoadInfo();
171      # Create the Sprout load object.      # Create the Sprout load object.
# Line 760  Line 766 
766                          # part of the spreadsheet cell ID.                          # part of the spreadsheet cell ID.
767                          for (my $col = 0; defined($roleID = $sub->get_role($col)); $col++) {                          for (my $col = 0; defined($roleID = $sub->get_role($col)); $col++) {
768                              # Get the features in the spreadsheet cell for this genome and role.                              # Get the features in the spreadsheet cell for this genome and role.
769                              my @pegs = $sub->get_pegs_from_cell($row, $col);                              my @pegs = grep { !$fig->is_deleted_fid($_) } $sub->get_pegs_from_cell($row, $col);
770                              # Only proceed if features exist.                              # Only proceed if features exist.
771                              if (@pegs > 0) {                              if (@pegs > 0) {
772                                  # Create the spreadsheet cell.                                  # Create the spreadsheet cell.
# Line 1028  Line 1034 
1034          # Loop through the genomes.          # Loop through the genomes.
1035          for my $genomeID (sort keys %{$genomeHash}) {          for my $genomeID (sort keys %{$genomeHash}) {
1036              Trace("Processing $genomeID.") if T(3);              Trace("Processing $genomeID.") if T(3);
1037              # Get the genome's PEGs.              # Get the genome's annotations.
1038              my @pegs = $fig->pegs_of($genomeID);              my @annotations = $fig->read_all_annotations($genomeID);
1039              for my $peg (@pegs) {              Trace("Processing annotations.") if T(2);
1040                  Trace("Processing $peg.") if T(4);              for my $tuple (@annotations) {
1041                  # Create a hash of timestamps. We use this to prevent duplicate time stamps                  # Create a hash of timestamps. We use this to prevent duplicate time stamps
1042                  # from showing up for a single PEG's annotations.                  # from showing up for a single PEG's annotations.
1043                  my %seenTimestamps = ();                  my %seenTimestamps = ();
1044                  # Loop through the annotations.                  # Get the annotation tuple.
1045                  for my $tuple ($fig->feature_annotations($peg, "raw")) {                  my ($peg, $timestamp, $user, $text) = @{$tuple};
                     my ($fid, $timestamp, $user, $text) = @{$tuple};  
1046                      # Here we fix up the annotation text. "\r" is removed,                      # Here we fix up the annotation text. "\r" is removed,
1047                      # and "\t" and "\n" are escaped. Note we use the "s"                      # and "\t" and "\n" are escaped. Note we use the "s"
1048                      # modifier so that new-lines inside the text do not                      # modifier so that new-lines inside the text do not
# Line 1052  Line 1057 
1057                          # Here it's a number. We need to insure the one we use to form                          # Here it's a number. We need to insure the one we use to form
1058                          # the key is unique.                          # the key is unique.
1059                          my $keyStamp = $timestamp;                          my $keyStamp = $timestamp;
1060                          while ($seenTimestamps{$keyStamp}) {                      while ($seenTimestamps{"$peg:$keyStamp"}) {
1061                              $keyStamp++;                              $keyStamp++;
1062                          }                          }
                         $seenTimestamps{$keyStamp} = 1;  
1063                          my $annotationID = "$peg:$keyStamp";                          my $annotationID = "$peg:$keyStamp";
1064                        $seenTimestamps{$annotationID} = 1;
1065                          # Insure the user exists.                          # Insure the user exists.
1066                          if (! $users{$user}) {                          if (! $users{$user}) {
1067                              $loadSproutUser->Put($user, "SEED user");                              $loadSproutUser->Put($user, "SEED user");
# Line 1074  Line 1079 
1079                  }                  }
1080              }              }
1081          }          }
     }  
1082      # Finish the load.      # Finish the load.
1083      my $retVal = $self->_FinishAll();      my $retVal = $self->_FinishAll();
1084      return $retVal;      return $retVal;

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3