[Bio] / Sprout / Sprout.pm Repository:
ViewVC logotype

Diff of /Sprout/Sprout.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11, Tue Mar 8 09:17:40 2005 UTC revision 1.13, Thu May 5 03:14:03 2005 UTC
# Line 269  Line 269 
269  sub GetEntity {  sub GetEntity {
270          # Get the parameters.          # Get the parameters.
271          my ($self, $entityType, $ID) = @_;          my ($self, $entityType, $ID) = @_;
272          # Create a query.          # Call the ERDB method.
273          my $query = $self->Get([$entityType], "$entityType(id) = ?", [$ID]);          return $self->{_erdb}->GetEntity($entityType, $ID);
         # Get the first (and only) object.  
         my $retVal = $query->Fetch();  
         # Return the result.  
         return $retVal;  
274  }  }
275    
276  =head3 GetEntityValues  =head3 GetEntityValues
# Line 308  Line 304 
304  sub GetEntityValues {  sub GetEntityValues {
305          # Get the parameters.          # Get the parameters.
306          my ($self, $entityType, $ID, $fields) = @_;          my ($self, $entityType, $ID, $fields) = @_;
307          # Get the specified entity.          # Call the ERDB method.
308          my $entity = $self->GetEntity($entityType, $ID);          return $self->{_erdb}->GetEntityValues($entityType, $ID, $fields);
         # Declare the return list.  
         my @retVal = ();  
         # If we found the entity, push the values into the return list.  
         if ($entity) {  
                 push @retVal, $entity->Values($fields);  
         }  
         # Return the result.  
         return @retVal;  
309  }  }
310    
311  =head3 ShowMetaData  =head3 ShowMetaData
# Line 1447  Line 1435 
1435                  if ($line =~ m/^>\s*(.+?)(\s|\n)/) {                  if ($line =~ m/^>\s*(.+?)(\s|\n)/) {
1436                          # Here we have a new header. Store the current sequence if we have one.                          # Here we have a new header. Store the current sequence if we have one.
1437                          if ($id) {                          if ($id) {
1438                                  $retVal{$id} = $sequence;                                  $retVal{$id} = uc $sequence;
1439                          }                          }
1440                          # Clear the sequence accumulator and save the new ID.                          # Clear the sequence accumulator and save the new ID.
1441                          ($id, $sequence) = ("$prefix$1", "");                          ($id, $sequence) = ("$prefix$1", "");
1442                  } else {                  } else {
1443                          # Here we have a data line, so we add it to the sequence accumulator.                          # Here we have a data line, so we add it to the sequence accumulator.
1444                          # First, we get the actual data out.                          # First, we get the actual data out. Note that we normalize to upper
1445                            # case.
1446                          $line =~ /^\s*(.*?)(\s|\n)/;                          $line =~ /^\s*(.*?)(\s|\n)/;
1447                          $sequence .= $1;                          $sequence .= $1;
1448                  }                  }
1449          }          }
1450          # Flush out the last sequence (if any).          # Flush out the last sequence (if any).
1451          if ($sequence) {          if ($sequence) {
1452                  $retVal {$id} = $sequence;                  $retVal{$id} = uc $sequence;
1453          }          }
1454            # Close the file.
1455            close FASTAFILE;
1456          # Return the hash constructed from the file.          # Return the hash constructed from the file.
1457          return %retVal;          return %retVal;
1458  }  }
# Line 2362  Line 2353 
2353  sub GetAll {  sub GetAll {
2354          # Get the parameters.          # Get the parameters.
2355          my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;          my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;
2356          # Create the query.          # Call the ERDB method.
2357          my $query = $self->Get($objectNames, $filterClause, $parameterList);          my @retVal = $self->{_erdb}->GetAll($objectNames, $filterClause, $parameterList,
2358          # Set up a counter of the number of records read.                                                                                  $fields, $count);
         my $fetched = 0;  
         # Insure the counter has a value.  
         if (!defined $count) {  
                 $count = 0;  
         }  
         # Loop through the records returned, extracting the fields. Note that if the  
         # counter is non-zero, we stop when the number of records read hits the count.  
         my @retVal = ();  
         while (($count == 0 || $fetched < $count) && (my $row = $query->Fetch())) {  
                 my @rowData = $row->Values($fields);  
                 push @retVal, \@rowData;  
                 $fetched++;  
         }  
2359          # Return the resulting list.          # Return the resulting list.
2360          return @retVal;          return @retVal;
2361  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3