怎么计算这个公式用perl
发布网友
发布时间:2022-05-20 00:21
我来回答
共1个回答
热心网友
时间:2023-10-21 00:44
#usr/bin/perl -w
use strict();
my %P = (
"ac"=>0.091116173,
"cc"=>0.054669704,
"ag"=>0.102505695,
"tg"=>0.022779043,
"at"=>0.061503417,
"tc"=>0.06833713,
"aa"=>0.141230068,
"ga"=>0.104783599,
"tt"=>0.027334852,
"ct"=>0.027334852,
"cg"=>0.045558087,
"gg"=>0.036446469,
"ta"=>0.029612756,
"ca"=>0.118451025,
"gc"=>0.034168565,
"gt"=>0.031890661,
"a"=>0.396355353,
"c"=>0.248291572,
"g"=>0.207289294,
"t"=>0.148063781,
);
my @index=("a","c","g","t");
for $n1(0..3){
for $n2(0..3)
{$i=$index[$n1];
$j=$index[$n2];
$ij=$i.$j;
$temp=($P{$i}*$P{$j});
#my $result=$P{"$ij"}/($P{$i}*$P{$j});
$result_temp=(($P{"$ij"}-$temp)**2)/$temp;
$result=$result+$result_temp;
}
}
print "$result\n";
my $ele=1.442695040889;
$result_f=$ele*$result;
print "D2=$result_f";