RogersDNA evaluation methodology
by John L Olson, 15 December 2008
|
The following equation is used on this site for comparing DNA samples against each other and against modal templates.
|
|
My PHP Code for the above equation:
$size = 0;
$count = 0;
$score = 0;
for ( $marker = 1; $marker <= $num_dna_col; $marker += 1 )
{
$temp = $ref[$marker][$j]; // 2D array of Modal alleles to compare against
$temp0 = $dna_cols[$marker]; // Array of allele names
$temp0 = $myrow[$temp0]; // Data array from database read
if($temp) // Do we have an allele in the Modal template?
if($temp0) // Does the current participant have a corresponding allele?
{
$size2 += 1; // Increment number of available alleles to compare
if($temp) // Does the Modal template have a corresponding allele?
{
$size += 1;
if($temp == $temp0)
$count += 1; // Increment number of matches
else
{
$temp1 = ($temp - $temp0);
if ($temp1 < 0 )
$temp1 = -$temp1;
$temp2 = $mutate_coef[$marker]; // mutation coefficients
$temp2 = log($temp2);
$temp1 = $temp1 * $temp2;
$score = $score + $temp1;
}
}
}
}
if ($size) // Avoid division by zero
{
$score = $score / $size;
$score = exp($score);
}
else
{
$score = 0;
}
$score = (int) (( $score * 1000. ) + 0.5);
|