4 # BioPerl module for Bio::SearchDist
6 # Cared for by Ewan Birney <birney@ebi.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
16 Bio::SearchDist - A perl wrapper around Sean Eddy's histogram object
20 $dis = Bio::SearchDist->new();
21 foreach $score ( @scores ) {
22 $dis->add_score($score);
25 if( $dis->fit_evd() ) {
26 foreach $score ( @scores ) {
27 $evalue = $dis->evalue($score);
28 print "Score $score had an evalue of $evalue\n";
31 warn("Could not fit histogram to an EVD!");
36 The Bio::SearchDist object is a wrapper around Sean Eddy's excellent
37 histogram object. The histogram object can bascially take in a number
38 of scores which are sensibly distributed somewhere around 0 that come
39 from a supposed Extreme Value Distribution. Having add all the scores
40 from a database search via the add_score method you can then fit a
41 extreme value distribution using fit_evd(). Once fitted you can then
42 get out the evalue for each score (or a new score) using
45 The fitting procedure is better described in Sean Eddy's own code
46 (available from http://hmmer.wustl.edu, or in the histogram.h header
47 file in Compile/SW). Bascially it fits a EVD via a maximum likelhood
48 method with pruning of the top end of the distribution so that real
49 positives are discarded in the fitting procedure. This comes from
50 an orginally idea of Richard Mott's and the likelhood fitting
51 is from a book by Lawless [should ref here].
54 The object relies on the fact that the scores are sensibly distributed
55 around about 0 and that integer bins are sensible for the
56 histogram. Scores based on bits are often ideal for this (bits based
57 scoring mechanisms is what this histogram object was originally
63 The original code this was based on comes from the histogram module as
64 part of the HMMer2 package. Look at http://hmmer.wustl.edu/
66 Its use in Bioperl is via the Compiled XS extension which is cared for
67 by Ewan Birney (birney@ebi.ac.uk). Please contact Ewan first about
68 the use of this module
74 User feedback is an integral part of the evolution of this and other
75 Bioperl modules. Send your comments and suggestions preferably to one
76 of the Bioperl mailing lists. Your participation is much appreciated.
78 bioperl-l@bioperl.org - General discussion
79 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
83 Report bugs to the Bioperl bug tracking system to help us keep track
84 the bugs and their resolution. Bug reports can be submitted via the
87 http://bugzilla.open-bio.org/
91 The rest of the documentation details each of the object
92 methods. Internal methods are usually preceded with a _
97 # Let the code begin...
100 package Bio
::SearchDist
;
106 require Bio
::Ext
::Align
;
110 print STDERR
("\nThe C-compiled engine for histogram object (Bio::Ext::Align) has not been installed.\n Please install the bioperl-ext package\n\n");
116 use base
qw(Bio::Root::Root);
119 my($class,@args) = @_;
120 my $self = $class->SUPER::new
(@args);
121 my($min, $max, $lump) =
122 $self->_rearrange([qw(MIN MAX LUMP)], @args);
136 $self->_engine(&Bio
::Ext
::Align
::new_Histogram
($min,$max,$lump));
144 Usage : $dis->add_score(300);
145 Function: Adds a single score to the distribution
153 my ($self,$score) = @_;
155 $eng = $self->_engine();
156 #$eng->AddToHistogram($score);
163 Usage : $dis->fit_evd();
164 Function: fits an evd to the current distribution
165 Returns : 1 if it fits successfully, 0 if not
172 my ($self,@args) = @_;
174 return $self->_engine()->fit_EVD(10000,1);
190 my ($self,$high) = @_;
192 if( ! defined $high ) {
196 return $self->_engine()->fit_Gaussian($high);
203 Usage : $eval = $dis->evalue($score)
204 Function: Returns the evalue of this score
212 my ($self,$score) = @_;
214 return $self->_engine()->evalue($score);
223 Usage : $obj->_engine($newval)
224 Function: underlyine bp_sw:: histogram engine
225 Returns : value of _engine
226 Args : newvalue (optional)
232 my ($self,$value) = @_;
233 if( defined $value) {
234 $self->{'_engine'} = $value;
236 return $self->{'_engine'};