tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / Bio / Tools / HMMER / Set.pm
blob45560144b029a6a0a8730c28f3d85a4ff9adccc4
1 # $Id$
3 # BioPerl module for Bio::Tools::HMMER::Set
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Ewan Birney <birney@sanger.ac.uk>
9 # Copyright Ewan Birney
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::Tools::HMMER::Set - Set of identical domains from HMMER matches
19 =head1 SYNOPSIS
21 # get a Set object probably from the results object
22 print "Bits score over set ",$set->bits," evalue ",$set->evalue,"\n";
24 foreach $domain ( $set->each_Domain ) {
25 print "Domain start ",$domain->start," end ",$domain->end,"\n";
28 =head1 DESCRIPTION
30 Represents a set of HMMER domains hitting one sequence. HMMER reports two
31 different scores, a per sequence total score (and evalue) and a per
32 domain score and evalue. This object represents a collection of the same
33 domain with the sequence bits score and evalue. (these attributes are also
34 on the per domain scores, which you can get there).
36 =head1 FEEDBACK
38 =head2 Mailing Lists
40 User feedback is an integral part of the evolution of this and other
41 Bioperl modules. Send your comments and suggestions preferably to one
42 of the Bioperl mailing lists. Your participation is much appreciated.
44 bioperl-l@bioperl.org - General discussion
45 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
47 =head2 Support
49 Please direct usage questions or support issues to the mailing list:
51 I<bioperl-l@bioperl.org>
53 rather than to the module maintainer directly. Many experienced and
54 reponsive experts will be able look at the problem and quickly
55 address it. Please include a thorough description of the problem
56 with code and data examples if at all possible.
58 =head2 Reporting Bugs
60 Report bugs to the Bioperl bug tracking system to help us keep track
61 the bugs and their resolution.Bug reports can be submitted via the
62 web: http://bugzilla.open-bio.org/
64 =head1 AUTHOR - Ewan Birney
66 Email birney-at-ebi.ac.uk
68 =head1 APPENDIX
70 The rest of the documentation details each of the object
71 methods. Internal methods are usually preceded with a _
73 =cut
76 # Let the code begin...
79 package Bio::Tools::HMMER::Set;
80 use strict;
82 use Bio::Tools::HMMER::Domain;
84 use base qw(Bio::Root::Root);
86 sub new {
87 my($class,@args) = @_;
88 my $self = $class->SUPER::new(@args);
89 my ($name,$acc,$desc) = $self->_rearrange([qw(NAME ACCESSION DESC)],
90 @args);
91 $name && $self->name($name);
92 $acc && $self->accession($acc);
93 $desc && $self->desc($desc);
96 $self->{'domains'} = [];
97 $self->{'domainnames'} = {};
98 return $self;
101 =head2 add_Domain
103 Title : add_Domain
104 Usage : $set->add_Domain($domain)
105 Function: adds the domain to the list
106 Returns : nothing
107 Args : A Bio::Tools::HMMER::Domain object
109 =cut
111 sub add_Domain{
112 my ($self,$domain) = @_;
115 if( ! defined $domain || ! $domain->isa("Bio::Tools::HMMER::Domain") ) {
116 $self->throw("[$domain] is not a Bio::Tools::HMMER::Domain. aborting");
118 return if $self->{'domainnames'}->{$domain->get_nse}++;
119 push(@{$self->{'domains'}},$domain);
123 =head2 each_Domain
125 Title : each_Domain
126 Usage : foreach $domain ( $set->each_Domain() )
127 Function: returns an array of domain objects in this set
128 Returns : array
129 Args : none
132 =cut
134 sub each_Domain{
135 my ($self,@args) = @_;
137 return @{$self->{'domains'}};
140 =head2 name
142 Title : name
143 Usage : $obj->name($newval)
144 Function:
145 Example :
146 Returns : value of name
147 Args : newvalue (optional)
150 =cut
152 sub name{
153 my ($obj,$value) = @_;
154 if( defined $value) {
155 $obj->{'name'} = $value;
157 return $obj->{'name'};
161 =head2 desc
163 Title : desc
164 Usage : $obj->desc($newval)
165 Function:
166 Example :
167 Returns : value of desc
168 Args : newvalue (optional)
170 =cut
172 sub desc{
173 my ($self,$value) = @_;
174 if( defined $value) {
175 $self->{'desc'} = $value;
177 return $self->{'desc'};
181 =head2 accession
183 Title : accession
184 Usage : $obj->accession($newval)
185 Function:
186 Example :
187 Returns : value of accession
188 Args : newvalue (optional)
191 =cut
193 sub accession{
194 my ($self,$value) = @_;
195 if( defined $value) {
196 $self->{'accession'} = $value;
198 return $self->{'accession'};
202 =head2 bits
204 Title : bits
205 Usage : $obj->bits($newval)
206 Function:
207 Example :
208 Returns : value of bits
209 Args : newvalue (optional)
212 =cut
214 sub bits{
215 my ($obj,$value) = @_;
217 if( defined $value) {
218 $obj->{'bits'} = $value;
220 return $obj->{'bits'};
224 =head2 evalue
226 Title : evalue
227 Usage : $obj->evalue($newval)
228 Function:
229 Example :
230 Returns : value of evalue
231 Args : newvalue (optional)
234 =cut
236 sub evalue{
237 my ($obj,$value) = @_;
238 if( defined $value) {
239 $obj->{'evalue'} = $value;
241 return $obj->{'evalue'};
246 sub addHMMUnit {
247 my $self = shift;
248 my $unit = shift;
250 $self->warn("Using old addHMMUnit call on Bio::Tools::HMMER::Set. Should replace with add_Domain");
251 return $self->add_Domain($unit);
254 sub eachHMMUnit {
255 my $self = shift;
256 $self->warn("Using old eachHMMUnit call on Bio::Tools::HMMER::Set. Should replace with each_Domain");
257 return $self->each_Domain();
260 1; # says use was ok
261 __END__