[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.8, Thu May 28 18:08:56 2009 UTC revision 1.9, Thu Jun 4 18:22:32 2009 UTC
# Line 21  Line 21 
21    
22      use strict;      use strict;
23      use Tracer;      use Tracer;
     use DBKernel;  
24      use base 'ERDB';      use base 'ERDB';
25      use Stats;      use Stats;
26        use DBKernel;
27      use XML::Simple;      use XML::Simple;
28    
29  =head1 Sapling Package  =head1 Sapling Package
# Line 261  Line 261 
261      return $retVal;      return $retVal;
262  }  }
263    
264    =head3 FeaturesByID
265    
266        my @fids = $sapling->FeaturesByID($id);
267    
268    Return all the features corresponding to the specified identifier. Only features
269    that represent the same locus will be returned.
270    
271    =over 4
272    
273    =item id
274    
275    Identifier of interest.
276    
277    =item RETURN
278    
279    Returns a list of all the features in the database that match the given
280    identifier.
281    
282    =back
283    
284    =cut
285    
286    sub FeaturesByID {
287        # Get the parameters.
288        my ($self, $id) = @_;
289        # Ask for features from the database.
290        my @retVal = $self->GetFlat("Identifies", "Identifies(from-link) = ?", [$id],
291                                    'to-link');
292        # Return the result.
293        return @retVal;
294    }
295    
296    =head3 ProteinsByID
297    
298        my @fids = $sapling->ProteinsByID($id);
299    
300    Return all the features that have the same protein sequence as the
301    identified feature. The returned features may not have the same locus. If
302    the identifier is not for a protein encoding gene, no result will be
303    returned.
304    
305    =over 4
306    
307    =item id
308    
309    ##TODO: id description
310    
311    =item RETURN
312    
313    ##TODO: return value description
314    
315    =back
316    
317    =cut
318    
319    sub ProteinsByID {
320        # Get the parameters.
321        my ($self, $id) = @_;
322        # Declare the return variable.
323        my @retVal;
324        ##TODO: Code
325        # Return the result.
326        return @retVal;
327    }
328    
329    =head3 GetSubsystem
330    
331        my $ssData = $sapling->GetSubsystem($ssName);
332    
333    Return a [[SaplingSubsysPm]] object for the named subsystem.
334    
335    =over 4
336    
337    =item ssName
338    
339    Name of the desired subsystem.
340    
341    =item RETURN
342    
343    Returns an object that defines multiple useful methods for manipulating the
344    named subsystem.
345    
346    =back
347    
348    =cut
349    
350    sub GetSubsystem {
351        # Get the parameters.
352        my ($self, $ssName) = @_;
353        # Declare the return variable.
354        require SaplingSubsys;
355        my $retVal = SaplingSubsys->new($ssName, $self);
356        # Return the result.
357        return $retVal;
358    }
359    
360    
361  =head3 GenesInRegion  =head3 GenesInRegion
# Line 312  Line 406 
406    
407  =head3 GetFasta  =head3 GetFasta
408    
409      my $fasta = $sapling->GetFasta($proteinID, $id);      my $fasta = $sapling->GetFasta($proteinID, $id, $comment);
410    
411  Return a FASTA sequence for the specified protein. An optional identifier  Return a FASTA sequence for the specified protein. An optional identifier
412  can be provided to be used as the identification string.  can be provided to be used as the identification string.
# Line 328  Line 422 
422  The identifier to be used in the FASTA output. If omitted, the protein ID  The identifier to be used in the FASTA output. If omitted, the protein ID
423  is used.  is used.
424    
425    =item comment (optional)
426    
427    The comment string to be used in the identification line of the FASTA output.
428    If omitted, no comment will be present.
429    
430  =item RETURN  =item RETURN
431    
432  Returns a FASTA string for the protein. This includes the identification  Returns a FASTA string for the protein. This includes the identification
# Line 339  Line 438 
438    
439  sub GetFasta {  sub GetFasta {
440      # Get the parameters.      # Get the parameters.
441      my ($self, $proteinID, $id) = @_;      my ($self, $proteinID, $id, $comment) = @_;
442      # Compute the identifier.      # Compute the identifier and comment.
443      my $realID = $id || "md5|$proteinID";      my $realID = $id || "md5|$proteinID";
444        my $realComment = (defined $comment ? " $comment" : "");
445      # Declare the return variable.      # Declare the return variable.
446      my $retVal;      my $retVal;
447      # Get the protein sequence.      # Get the protein sequence.
# Line 355  Line 455 
455          my @chunks = grep { $_ } split /(.{1,60})/, $sequence;          my @chunks = grep { $_ } split /(.{1,60})/, $sequence;
456          # Put it together to make the FASTA string. Note that we force a new-line          # Put it together to make the FASTA string. Note that we force a new-line
457          # at the end.          # at the end.
458          $retVal = join("\n", ">$realID", @chunks, "//", "");          $retVal = join("\n", ">$realID$realComment", @chunks, "//", "");
459      }      }
460      # Return the result.      # Return the result.
461      return $retVal;      return $retVal;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3