Bio::DB::TFBS namespace has been moved to its own distribution named after itself
[bioperl-live.git] / Bio / Tools / HMMER / Set.pm
blob10416652e439a0277364842fdab77985a9b63b72
2 # BioPerl module for Bio::Tools::HMMER::Set
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ewan Birney <birney@sanger.ac.uk>
8 # Copyright Ewan Birney
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Tools::HMMER::Set - Set of identical domains from HMMER matches
18 =head1 SYNOPSIS
20 # get a Set object probably from the results object
21 print "Bits score over set ",$set->bits," evalue ",$set->evalue,"\n";
23 foreach $domain ( $set->each_Domain ) {
24 print "Domain start ",$domain->start," end ",$domain->end,"\n";
27 =head1 DESCRIPTION
29 Represents a set of HMMER domains hitting one sequence. HMMER reports two
30 different scores, a per sequence total score (and evalue) and a per
31 domain score and evalue. This object represents a collection of the same
32 domain with the sequence bits score and evalue. (these attributes are also
33 on the per domain scores, which you can get there).
35 =head1 FEEDBACK
37 =head2 Mailing Lists
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to one
41 of the Bioperl mailing lists. Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 =head2 Support
48 Please direct usage questions or support issues to the mailing list:
50 I<bioperl-l@bioperl.org>
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 the bugs and their resolution.Bug reports can be submitted via the
61 web:
63 https://github.com/bioperl/bioperl-live/issues
65 =head1 AUTHOR - Ewan Birney
67 Email birney-at-ebi.ac.uk
69 =head1 APPENDIX
71 The rest of the documentation details each of the object
72 methods. Internal methods are usually preceded with a _
74 =cut
77 # Let the code begin...
80 package Bio::Tools::HMMER::Set;
81 use strict;
83 use Bio::Tools::HMMER::Domain;
85 use base qw(Bio::Root::Root);
87 sub new {
88 my($class,@args) = @_;
89 my $self = $class->SUPER::new(@args);
90 my ($name,$acc,$desc) = $self->_rearrange([qw(NAME ACCESSION DESC)],
91 @args);
92 $name && $self->name($name);
93 $acc && $self->accession($acc);
94 $desc && $self->desc($desc);
97 $self->{'domains'} = [];
98 $self->{'domainnames'} = {};
99 return $self;
102 =head2 add_Domain
104 Title : add_Domain
105 Usage : $set->add_Domain($domain)
106 Function: adds the domain to the list
107 Returns : nothing
108 Args : A Bio::Tools::HMMER::Domain object
110 =cut
112 sub add_Domain{
113 my ($self,$domain) = @_;
116 if( ! defined $domain || ! $domain->isa("Bio::Tools::HMMER::Domain") ) {
117 $self->throw("[$domain] is not a Bio::Tools::HMMER::Domain. aborting");
119 return if $self->{'domainnames'}->{$domain->get_nse}++;
120 push(@{$self->{'domains'}},$domain);
124 =head2 each_Domain
126 Title : each_Domain
127 Usage : foreach $domain ( $set->each_Domain() )
128 Function: returns an array of domain objects in this set
129 Returns : array
130 Args : none
133 =cut
135 sub each_Domain{
136 my ($self,@args) = @_;
138 return @{$self->{'domains'}};
141 =head2 name
143 Title : name
144 Usage : $obj->name($newval)
145 Function:
146 Example :
147 Returns : value of name
148 Args : newvalue (optional)
151 =cut
153 sub name{
154 my ($obj,$value) = @_;
155 if( defined $value) {
156 $obj->{'name'} = $value;
158 return $obj->{'name'};
162 =head2 desc
164 Title : desc
165 Usage : $obj->desc($newval)
166 Function:
167 Example :
168 Returns : value of desc
169 Args : newvalue (optional)
171 =cut
173 sub desc{
174 my ($self,$value) = @_;
175 if( defined $value) {
176 $self->{'desc'} = $value;
178 return $self->{'desc'};
182 =head2 accession
184 Title : accession
185 Usage : $obj->accession($newval)
186 Function:
187 Example :
188 Returns : value of accession
189 Args : newvalue (optional)
192 =cut
194 sub accession{
195 my ($self,$value) = @_;
196 if( defined $value) {
197 $self->{'accession'} = $value;
199 return $self->{'accession'};
203 =head2 bits
205 Title : bits
206 Usage : $obj->bits($newval)
207 Function:
208 Example :
209 Returns : value of bits
210 Args : newvalue (optional)
213 =cut
215 sub bits{
216 my ($obj,$value) = @_;
218 if( defined $value) {
219 $obj->{'bits'} = $value;
221 return $obj->{'bits'};
225 =head2 evalue
227 Title : evalue
228 Usage : $obj->evalue($newval)
229 Function:
230 Example :
231 Returns : value of evalue
232 Args : newvalue (optional)
235 =cut
237 sub evalue{
238 my ($obj,$value) = @_;
239 if( defined $value) {
240 $obj->{'evalue'} = $value;
242 return $obj->{'evalue'};
247 sub addHMMUnit {
248 my $self = shift;
249 my $unit = shift;
251 $self->warn("Using old addHMMUnit call on Bio::Tools::HMMER::Set. Should replace with add_Domain");
252 return $self->add_Domain($unit);
255 sub eachHMMUnit {
256 my $self = shift;
257 $self->warn("Using old eachHMMUnit call on Bio::Tools::HMMER::Set. Should replace with each_Domain");
258 return $self->each_Domain();
261 1; # says use was ok
262 __END__