
This is the Title of the Book, eMatter Edition
Copyright © 2012 O’Reilly & Associates, Inc. All rights reserved.
Basic BLAST Statistics
|
101
#
return nToB($l*$raw_score – log($k));
}
The Expect of an HSP
Now calculate the Expect for the HSP shown in Figure 7-1, recalling that
. Again, a simple Perl function is useful:
sub rawScoreToExpect {
my $raw_score = shift;
my $k = shift;
my $l = shift; # lambda in nats
my $m = shift; # effective length of query
my $n = shift; # effective length of database
#
return $k*$m*$n*exp(-1*$l*$raw_score);
}
Using this function, the values of k and λ, given in Table 7-1, combined with the val-
ues m´ (222) and n´ (7648142) that you calculated in your discussion of effective
lengths, gives an Expect of 8e
-13
for the alignment shown in Figure 7-1.
You can also calculate the Expect of an alignment with a normalized score, S´
(Figure 7-1). The Karlin-Altschul equation is formulated for the raw
score, S, not the normalized score S´. To calculate an Expect using a normalized
score S´ whose units are nats, use the equation . Note that k doesn’t
appear in this equation; it has already been accounted for when deriving the normal-
ized (nat) score (e.g., ).
To calculate the Expect of an HSP from its bit score (Figure 7-1) use the Perl func-
tion shown next. The formula is similar to that used to calculate an Expect from a
nat score. However, the base of the exponent is 2 rather ...