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

Diff of /Sprout/Sapling.pm

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

revision 1.29, Mon Feb 1 20:14:28 2010 UTC revision 1.30, Wed Feb 17 18:28:41 2010 UTC
# Line 1259  Line 1259 
1259    
1260  =head3 ComputeFeatureFilter  =head3 ComputeFeatureFilter
1261    
1262      my ($objects, $filter, @parms) = $sap->ComputeFeatureFilter($source);      my ($objects, $filter, @parms) = $sap->ComputeFeatureFilter($source, $genome);
1263    
1264  Compute the initial object name list, filter string, and parameter list  Compute the initial object name list, filter string, and parameter list
1265  for a query by feature ID. The object name list will always end with the  for a query by feature ID. The object name list will always end with the
# Line 1283  Line 1283 
1283  prefixing indicating the ID type (e.g. C<uni|P00934> for a UniProt ID, C<gi|135813> for  prefixing indicating the ID type (e.g. C<uni|P00934> for a UniProt ID, C<gi|135813> for
1284  an NCBI identifier, and so forth). The default is C<SEED>.  an NCBI identifier, and so forth). The default is C<SEED>.
1285    
1286    =item genome (optional)
1287    
1288    ID of a genome. If specified, only features from the specified genome will be
1289    accepted by the filter. This is important for IDs that are ambiguous between
1290    genomes (like Locus Tags). If omitted, no genome filtering will take place.
1291    
1292  =item RETURN  =item RETURN
1293    
1294  Returns a list containing parameters to the desired query call. The first element  Returns a list containing parameters to the desired query call. The first element
# Line 1295  Line 1301 
1301    
1302  sub ComputeFeatureFilter {  sub ComputeFeatureFilter {
1303      # Get the parameters.      # Get the parameters.
1304      my ($self, $source) = @_;      my ($self, $source, $genome) = @_;
1305      # Declare the return variables.      # Declare the return variables.
1306      my ($objects, $filter, @parms);      my ($objects, $filter, @parms);
1307        # This will be set to TRUE if we are directly processing FIG IDs.
1308        my $figOnly = 0;
1309      # Determine the source type.      # Determine the source type.
1310      if (! defined $source || $source eq 'SEED') {      if (! defined $source || $source eq 'SEED') {
1311          # Here we're directly processing FIG IDs.          # Here we're directly processing FIG IDs.
1312          $objects = 'Feature';          $objects = 'Feature';
1313          $filter = 'Feature(id) = ?'          $filter = 'Feature(id) = ?';
1314            $figOnly = 1;
1315      } elsif ($source eq 'mixed') {      } elsif ($source eq 'mixed') {
1316          # Here we're processing mixed IDs of unknown type.          # Here we're processing mixed IDs of unknown type.
1317          $objects = 'Identifier Identifies Feature';          $objects = 'Identifier Identifies Feature';
# Line 1321  Line 1330 
1330          $filter = 'Identifier(source) = ? AND Identifier(natural-form) = ?';          $filter = 'Identifier(source) = ? AND Identifier(natural-form) = ?';
1331          push @parms, $source;          push @parms, $source;
1332      }      }
1333        # Was a genome ID specified?
1334        if ($genome) {
1335            # Yes. Add genome filtering.
1336            if ($figOnly) {
1337                # In a FIG ID situation, we can simply add the genome filtering to the front
1338                # of the object list.
1339                $objects = "Genome IsOwnerOf $objects";
1340            } else {
1341                # Otherwise, we need to do an AND thing.
1342                $objects = "Genome IsOwnerOf Feature AND $objects";
1343            }
1344            # Add the genome ID to the filter clause.
1345            $filter = "Genome(id) = ? AND $filter";
1346            # Add it to the parameter list.
1347            unshift @parms, $genome;
1348        }
1349      # Return the results.      # Return the results.
1350      return ($objects, $filter, @parms);      return ($objects, $filter, @parms);
1351  }  }

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3