[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.26, Fri Dec 11 19:07:33 2009 UTC revision 1.27, Wed Dec 16 01:45:19 2009 UTC
# Line 27  Line 27 
27      use SeedUtils;      use SeedUtils;
28      use BasicLocation;      use BasicLocation;
29      use XML::Simple;      use XML::Simple;
30        use Digest::MD5;
31    
32  =head1 Sapling Package  =head1 Sapling Package
33    
# Line 143  Line 144 
144    
145      use constant TUNING_DEFAULTS => {      use constant TUNING_DEFAULTS => {
146          maxLocationLength => 4000,          maxLocationLength => 4000,
147          maxSequenceLength => 1000000,          maxSequenceLength => 10000,
148      };      };
149    
150  =head3 new  =head3 new
# Line 271  Line 272 
272      return $retVal;      return $retVal;
273  }  }
274    
275    =head3 ProteinID
276    
277        my $key = $sap->ProteinID($sequence);
278    
279    Return the protein sequence ID that would be associated with a specific
280    protein sequence.
281    
282    =over 4
283    
284    =item sequence
285    
286    String containing the protein sequence in question.
287    
288    =item RETURN
289    
290    Returns the ID value for the specified protein sequence. If the sequence exists
291    in the database, it will have this ID in the B<ProteinSequence> table.
292    
293    =back
294    
295    =cut
296    
297    sub ProteinID {
298        # Get the parameters.
299        my ($self, $sequence) = @_;
300        # Compute the MD5 hash.
301        my $retVal = Digest::MD5::md5_hex($sequence);
302        # Return the result.
303        return $retVal;
304    }
305    
306    
307  =head3 Assignment  =head3 Assignment
308    
309      my $assignment = $sapling->Assignment($fid);      my $assignment = $sapling->Assignment($fid);
# Line 301  Line 334 
334      return $retVal;      return $retVal;
335  }  }
336    
337    =head3 IdsForProtein
338    
339        my @ids = $sap->IdsForProtein($protID);
340    
341    Return a list of all the identifiers associated with the specified
342    protein.
343    
344    =over 4
345    
346    =item protID
347    
348    ID of the protein of interest.
349    
350    =item RETURN
351    
352    Returns a list of the Identifiers for the specific protein or for genes that
353    produce the specific protein.
354    
355    =back
356    
357    =cut
358    
359    sub IdsForProtein {
360        # Get the parameters.
361        my ($self, $protID) = @_;
362        # We'll put the identifiers found in here.
363        my %retVal;
364        # Ask for identifiers that directly name the protein.
365        for my $id ($self->GetFlat("ProteinSequence IsNamedBy Identifier",
366                                   "ProteinSequence(id) = ?", [$protID],
367                                   'Identifier(id)')) {
368            $retVal{$id} = 1;
369        }
370        # Add identifiers that name genes producing the protein.
371        for my $id ($self->GetFlat("ProteinSequence IsProteinFor Feature IsIdentifiedBy Identifier",
372                                   "ProteinSequence(id) = ?", [$protID],
373                                   'Identifier(id)')) {
374            $retVal{$id} = 1;
375        }
376        # Return the results found.
377        return sort keys %retVal;
378    }
379    
380    
381  =head3 ComputeDNA  =head3 ComputeDNA
382    

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3