File Coverage

blib/lib/Ace/Sequence/Homol.pm
Criterion Covered Total %
statement 3 10 30.0
branch 0 2 0.0
condition n/a
subroutine 1 5 20.0
pod 2 4 50.0
total 6 21 28.6


line stmt bran cond sub pod time code
1             # Ace::Sequence::Homol is just like Ace::Object, but has start() and end() methods
2             package Ace::Sequence::Homol;
3              
4 1     1   15 use vars '@ISA';
  1         15  
  1         15  
5             @ISA = 'Ace::Object';
6              
7              
8             # this was a mistake!
9             # use overload '""' => 'asString';
10              
11             # *stop = \&end;
12              
13             sub new_homol {
14 0     0 0     my ($pack,$tclass,$tname,$db,$start,$end) = @_;
15 0 0           return unless my $obj = $db->class->new($tclass,$tname,$db,1);
16 0             @$obj{'start','end'} = ($start,$end);
17 0             return bless $obj,$pack;
18             }
19              
20 0     0 1   sub start { return $_[0]->{'start'}; }
21              
22 0     0 1   sub end { return $_[0]->{'end'}; }
23              
24 0     0 0   sub stop { return $_[0]->{'end'}; }
25              
26             # sub _clone {
27             # my $self = shift;
28             # my $pack = ref($self);
29             # return $pack->new($self->db,$self->class,$self->name,$self->start,$self->end);
30             # }
31              
32             #sub asString {
33             # my $n = $_[0]->name;
34             # "$n/$_[0]->{'start'}-$_[0]->{'end'}";
35             #}
36              
37             1;
38              
39             =head1 NAME
40            
41             Ace::Sequence::Homol - Temporary Sequence Homology Class
42            
43             =head1 SYNOPSIS
44            
45             # Get all similarity features from an Ace::Sequence
46             @homol = $seq->features('Similarity');
47            
48             # sort by score
49             @sorted = sort { $a->score <=> $b->score } @homol;
50            
51             # the last one has the highest score
52             $best = $sorted[$#sorted];
53            
54             # fetch its associated Ace::Sequence::Homol
55             $homol = $best->target;
56            
57             # print out the sequence name, DNA, start and end
58             print $homol->name,' ',$homol->start,'-',$homol->end,"\n";
59             print $homol->asDNA;
60            
61             =head1 DESCRIPTION
62            
63             I<Ace::Sequence::Homol> is a subclass of L<Ace::Object> (B<not>
64             L<Ace::Sequence>) which is specialized for returning information about
65             a DNA or protein homology. This is a temporary placeholder for a more
66             sophisticated homology class which will include support for
67             alignments.
68            
69             =head1 OBJECT CREATION
70            
71             You will not ordinarily create an I<Ace::Sequence::Homol> object
72             directly. Instead, objects will be created in response to an info()
73             or group() method call on a similarity feature in an
74             I<Ace::Sequence::Feature> object. If you wish to create an
75             I<Ace::Sequence::Homol> object directly, please consult the source
76             code for the I<new()> method.
77            
78             =head1 OBJECT METHODS
79            
80             Most methods are inherited from I<Ace::Object>. The following
81             methods are also supported:
82            
83             =over 4
84            
85             =item start()
86            
87             $start = $homol->start;
88            
89             Returns the start of the area that is similar to the
90             I<Ace::Sequence::Feature> from which his homology was derived.
91             Coordinates are relative to the target homology.
92            
93             =item end()
94            
95             $end = $homol->end;
96            
97             Returns the end of the area that is similar to the
98             I<Ace::Sequence::Feature> from which his homology was derived.
99             Coordinates are relative to the target homology.
100            
101             =item asString()
102            
103             $label = $homol->asString;
104            
105             Returns a human-readable identifier describing the nature of the
106             feature. The format is:
107            
108             $name/$start-$end
109            
110             for example:
111            
112             HUMGEN13/1-67
113            
114             This method is also called automatically when the object is treated in
115             a string context.
116            
117             =back
118            
119             =head1 SEE ALSO
120            
121             L<Ace>, L<Ace::Object>,
122             L<Ace::Sequence>,L<Ace::Sequence::FeatureList>,
123             L<Ace::Sequence::Feature>, L<GFF>
124            
125             =head1 AUTHOR
126            
127             Lincoln Stein <lstein@w3.org> with extensive help from Jean
128             Thierry-Mieg <mieg@kaa.crbm.cnrs-mop.fr>
129            
130             Copyright (c) 1999, Lincoln D. Stein
131            
132             This library is free software; you can redistribute it and/or modify
133             it under the same terms as Perl itself. See DISCLAIMER.txt for
134             disclaimers of warranty.
135            
136             =cut
137              
138