Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Tools/HMMER/Set.pm @ 0:1f6dce3d34e0
Uploaded
| author | mahtabm |
|---|---|
| date | Thu, 11 Apr 2013 02:01:53 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:1f6dce3d34e0 |
|---|---|
| 1 # $Id: Set.pm,v 1.13 2002/10/22 07:45:23 lapp Exp $ | |
| 2 # | |
| 3 # BioPerl module for Bio::Tools::HMMER::Set | |
| 4 # | |
| 5 # Cared for by Ewan Birney <birney@sanger.ac.uk> | |
| 6 # | |
| 7 # Copyright Ewan Birney | |
| 8 # | |
| 9 # You may distribute this module under the same terms as perl itself | |
| 10 | |
| 11 # POD documentation - main docs before the code | |
| 12 | |
| 13 =head1 NAME | |
| 14 | |
| 15 Bio::Tools::HMMER::Set - Set of identical domains from HMMER matches | |
| 16 | |
| 17 =head1 SYNOPSIS | |
| 18 | |
| 19 # get a Set object probably from the results object | |
| 20 print "Bits score over set ",$set->bits," evalue ",$set->evalue,"\n"; | |
| 21 | |
| 22 foreach $domain ( $set->each_Domain ) { | |
| 23 print "Domain start ",$domain->start," end ",$domain->end,"\n"; | |
| 24 } | |
| 25 | |
| 26 =head1 DESCRIPTION | |
| 27 | |
| 28 Represents a set of HMMER domains hitting one sequence. HMMER reports two | |
| 29 different scores, a per sequence total score (and evalue) and a per | |
| 30 domain score and evalue. This object represents a collection of the same | |
| 31 domain with the sequence bits score and evalue. (these attributes are also | |
| 32 on the per domain scores, which you can get there). | |
| 33 | |
| 34 =head1 FEEDBACK | |
| 35 | |
| 36 =head2 Mailing Lists | |
| 37 | |
| 38 User feedback is an integral part of the evolution of this and other | |
| 39 Bioperl modules. Send your comments and suggestions preferably to one | |
| 40 of the Bioperl mailing lists. Your participation is much appreciated. | |
| 41 | |
| 42 bioperl-l@bioperl.org - General discussion | |
| 43 http://www.bioperl.org/MailList.html - About the mailing lists | |
| 44 | |
| 45 =head2 Reporting Bugs | |
| 46 | |
| 47 Report bugs to the Bioperl bug tracking system to help us keep track | |
| 48 the bugs and their resolution. | |
| 49 | |
| 50 Bug reports can be submitted via email or the web: | |
| 51 | |
| 52 bioperl-bugs@bioperl.org | |
| 53 http://www.bugzilla.bioperl.org/ | |
| 54 | |
| 55 =head1 AUTHOR - Ewan Birney | |
| 56 | |
| 57 Email birney@sanger.ac.uk | |
| 58 | |
| 59 =head1 APPENDIX | |
| 60 | |
| 61 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ | |
| 62 | |
| 63 =cut | |
| 64 | |
| 65 | |
| 66 # Let the code begin... | |
| 67 | |
| 68 | |
| 69 package Bio::Tools::HMMER::Set; | |
| 70 use vars qw(@ISA); | |
| 71 use strict; | |
| 72 | |
| 73 use Bio::Root::Root; | |
| 74 use Bio::Tools::HMMER::Domain; | |
| 75 | |
| 76 @ISA = qw( Bio::Root::Root ); | |
| 77 | |
| 78 sub new { | |
| 79 my($class,@args) = @_; | |
| 80 my $self = $class->SUPER::new(@args); | |
| 81 my ($name,$acc,$desc) = $self->_rearrange([qw(NAME ACCESSION DESC)], | |
| 82 @args); | |
| 83 $name && $self->name($name); | |
| 84 $acc && $self->accession($acc); | |
| 85 $desc && $self->desc($desc); | |
| 86 | |
| 87 | |
| 88 $self->{'domains'} = []; | |
| 89 $self->{'domainnames'} = {}; | |
| 90 return $self; | |
| 91 } | |
| 92 | |
| 93 =head2 add_Domain | |
| 94 | |
| 95 Title : add_Domain | |
| 96 Usage : $set->add_Domain($domain) | |
| 97 Function: adds the domain to the list | |
| 98 Returns : nothing | |
| 99 Args : A Bio::Tools::HMMER::Domain object | |
| 100 | |
| 101 =cut | |
| 102 | |
| 103 sub add_Domain{ | |
| 104 my ($self,$domain) = @_; | |
| 105 | |
| 106 | |
| 107 if( ! defined $domain || ! $domain->isa("Bio::Tools::HMMER::Domain") ) { | |
| 108 $self->throw("[$domain] is not a Bio::Tools::HMMER::Domain. aborting"); | |
| 109 } | |
| 110 return if $self->{'domainnames'}->{$domain->get_nse}++; | |
| 111 push(@{$self->{'domains'}},$domain); | |
| 112 | |
| 113 } | |
| 114 | |
| 115 =head2 each_Domain | |
| 116 | |
| 117 Title : each_Domain | |
| 118 Usage : foreach $domain ( $set->each_Domain() ) | |
| 119 Function: returns an array of domain objects in this set | |
| 120 Returns : array | |
| 121 Args : none | |
| 122 | |
| 123 | |
| 124 =cut | |
| 125 | |
| 126 sub each_Domain{ | |
| 127 my ($self,@args) = @_; | |
| 128 | |
| 129 return @{$self->{'domains'}}; | |
| 130 } | |
| 131 | |
| 132 =head2 name | |
| 133 | |
| 134 Title : name | |
| 135 Usage : $obj->name($newval) | |
| 136 Function: | |
| 137 Example : | |
| 138 Returns : value of name | |
| 139 Args : newvalue (optional) | |
| 140 | |
| 141 | |
| 142 =cut | |
| 143 | |
| 144 sub name{ | |
| 145 my ($obj,$value) = @_; | |
| 146 if( defined $value) { | |
| 147 $obj->{'name'} = $value; | |
| 148 } | |
| 149 return $obj->{'name'}; | |
| 150 | |
| 151 } | |
| 152 | |
| 153 =head2 desc | |
| 154 | |
| 155 Title : desc | |
| 156 Usage : $obj->desc($newval) | |
| 157 Function: | |
| 158 Example : | |
| 159 Returns : value of desc | |
| 160 Args : newvalue (optional) | |
| 161 | |
| 162 =cut | |
| 163 | |
| 164 sub desc{ | |
| 165 my ($self,$value) = @_; | |
| 166 if( defined $value) { | |
| 167 $self->{'desc'} = $value; | |
| 168 } | |
| 169 return $self->{'desc'}; | |
| 170 | |
| 171 } | |
| 172 | |
| 173 =head2 accession | |
| 174 | |
| 175 Title : accession | |
| 176 Usage : $obj->accession($newval) | |
| 177 Function: | |
| 178 Example : | |
| 179 Returns : value of accession | |
| 180 Args : newvalue (optional) | |
| 181 | |
| 182 | |
| 183 =cut | |
| 184 | |
| 185 sub accession{ | |
| 186 my ($self,$value) = @_; | |
| 187 if( defined $value) { | |
| 188 $self->{'accession'} = $value; | |
| 189 } | |
| 190 return $self->{'accession'}; | |
| 191 } | |
| 192 | |
| 193 | |
| 194 =head2 bits | |
| 195 | |
| 196 Title : bits | |
| 197 Usage : $obj->bits($newval) | |
| 198 Function: | |
| 199 Example : | |
| 200 Returns : value of bits | |
| 201 Args : newvalue (optional) | |
| 202 | |
| 203 | |
| 204 =cut | |
| 205 | |
| 206 sub bits{ | |
| 207 my ($obj,$value) = @_; | |
| 208 | |
| 209 if( defined $value) { | |
| 210 $obj->{'bits'} = $value; | |
| 211 } | |
| 212 return $obj->{'bits'}; | |
| 213 | |
| 214 } | |
| 215 | |
| 216 =head2 evalue | |
| 217 | |
| 218 Title : evalue | |
| 219 Usage : $obj->evalue($newval) | |
| 220 Function: | |
| 221 Example : | |
| 222 Returns : value of evalue | |
| 223 Args : newvalue (optional) | |
| 224 | |
| 225 | |
| 226 =cut | |
| 227 | |
| 228 sub evalue{ | |
| 229 my ($obj,$value) = @_; | |
| 230 if( defined $value) { | |
| 231 $obj->{'evalue'} = $value; | |
| 232 } | |
| 233 return $obj->{'evalue'}; | |
| 234 | |
| 235 } | |
| 236 | |
| 237 | |
| 238 sub addHMMUnit { | |
| 239 my $self = shift; | |
| 240 my $unit = shift; | |
| 241 | |
| 242 $self->warn("Using old addHMMUnit call on Bio::Tools::HMMER::Set. Should replace with add_Domain"); | |
| 243 return $self->add_Domain($unit); | |
| 244 } | |
| 245 | |
| 246 sub eachHMMUnit { | |
| 247 my $self = shift; | |
| 248 $self->warn("Using old eachHMMUnit call on Bio::Tools::HMMER::Set. Should replace with each_Domain"); | |
| 249 return $self->each_Domain(); | |
| 250 } | |
| 251 | |
| 252 1; # says use was ok | |
| 253 __END__ | |
| 254 |
