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.5


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   6 use vars '@ISA';
  1         2  
  1         230  
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 is a subclass of L (B
64             L) 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 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 object. If you wish to create an
75             I object directly, please consult the source
76             code for the I method.
77              
78             =head1 OBJECT METHODS
79              
80             Most methods are inherited from I. 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 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 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, L,
122             L,L,
123             L, L
124              
125             =head1 AUTHOR
126              
127             Lincoln Stein with extensive help from Jean
128             Thierry-Mieg
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