#----------------------------------------------------------# #Shailesh Date and Edward Marcotte, 20th Sept, 2001. #----------------------------------------------------------# # PSEUDOCODE generated July 25, 2006 ----#### # PSEUDOCODE updated and posted Aug 3, 2006 ----#### ####---- PSEUDOCODE ----#### @queryprofileArray; # put contents in an array %queryprob = (); for ($i=0; $i < lengthOfProfile; $i++) { #take first place after decimal $querybin = (int($queryprofilearray[$i]*10))/10; #round off if value is greater than 0.5 $querybin = $querybin + 0.1 if (($queryprofilearray[$i] - $querybin) >= 0.05); #add value to hash queryprob $queryprob{$querybin}++; } $queryentropy = 0; foreach $key (keys %queryprob) { $queryprob{$key} = ($queryprob{$key} / lengthOfProfile); $querybase2log = log($queryprob{$key}) / log(2); $queryentropy += $queryprob{$key} * $querybase2log; } $queryentropy = -1*$queryentropy; # ------ similar steps for relative entropy ------------ $bothbins = $querybin." ".$phylobin; $prob{$bothbins}++; # ------ calculate mutual information ------------ $mutualinfo = ($queryentropy + $phyloprofileentropy) - $relativeentropy; exit