[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.12, Wed May 4 03:24:43 2005 UTC revision 1.14, Thu Jun 9 19:06:55 2005 UTC
# Line 1349  Line 1349 
1349  sub CoupledFeatures {  sub CoupledFeatures {
1350          # Get the parameters.          # Get the parameters.
1351          my ($self, $featureID) = @_;          my ($self, $featureID) = @_;
1352          # Create a query to retrieve the functionally-coupled features. Note that we depend on the          # Create a query to retrieve the functionally-coupled features.
1353          # fact that the functional coupling is physically paired. If (A,B) is in the database, then          my $query = $self->Get(['ParticipatesInCoupling', 'Coupling'],
1354          # (B,A) will also be found.                                                     "ParticipatesInCoupling(from-link) = ?", [$featureID]);
         my $query = $self->Get(['IsClusteredOnChromosomeWith'],  
                                                    "IsClusteredOnChromosomeWith(from-link) = ?", [$featureID]);  
1355          # This value will be set to TRUE if we find at least one coupled feature.          # This value will be set to TRUE if we find at least one coupled feature.
1356          my $found = 0;          my $found = 0;
1357          # Create the return hash.          # Create the return hash.
1358          my %retVal = ();          my %retVal = ();
1359          # Retrieve the relationship records and store them in the hash.          # Retrieve the relationship records and store them in the hash.
1360          while (my $clustering = $query->Fetch()) {          while (my $clustering = $query->Fetch()) {
1361                  my ($otherFeatureID, $score) = $clustering->Values(['IsClusteredOnChromosomeWith(to-link)',                  # Get the ID and score of the coupling.
1362                                                                      'IsClusteredOnChromosomeWith(score)']);                  my ($couplingID, $score) = $clustering->Values(['Coupling(id)',
1363                                                                                    'Coupling(score)']);
1364                    # The coupling ID contains the two feature IDs separated by a space. We use
1365                    # this information to find the ID of the other feature.
1366                    my ($fid1, $fid2) = split / /, $couplingID;
1367                    my $otherFeatureID = ($featureID eq $fid1 ? $fid2 : $fid1);
1368                    # Attach the other feature's score to its ID.
1369                  $retVal{$otherFeatureID} = $score;                  $retVal{$otherFeatureID} = $score;
1370                  $found = 1;                  $found = 1;
1371          }          }
# Line 2353  Line 2357 
2357  sub GetAll {  sub GetAll {
2358          # Get the parameters.          # Get the parameters.
2359          my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;          my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;
2360          # Create the query.          # Call the ERDB method.
2361          my $query = $self->Get($objectNames, $filterClause, $parameterList);          my @retVal = $self->{_erdb}->GetAll($objectNames, $filterClause, $parameterList,
2362          # 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++;  
         }  
2363          # Return the resulting list.          # Return the resulting list.
2364          return @retVal;          return @retVal;
2365  }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.14

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3