// Fonction trouvée // sur caningest (v1.1), fonctions.php, fct_calcul_consang(). // function CalculConsang($link, $idPere, $idMere, $nb_gen=5) { $tab_pat[0][]=$idPere; $tab_mat[0][]=$idMere; for($gen=0; $gen<($nb_gen-1); $gen++) { for($i=0; $i<(count($tab_pat[$gen]));$i++ ) { $id = $tab_pat[$gen][$i]; if ($id > 0) { $A = RechercheChien($link, $id); if ($A->idPere == '') $A->idPere = -1; if ($A->idMere == '') $A->idMere = -1; $tab_pat[$gen+1][]=$A->idPere; $tab_pat[$gen+1][]=$A->idMere; } else { $tab_pat[$gen+1][] = -1; $tab_pat[$gen+1][] = -1; } } } for($gen=0; $gen<($nb_gen-1); $gen++) { for($i=0; $i<(count($tab_mat[$gen]));$i++ ) { $id = $tab_mat[$gen][$i]; if ($id > 0) { $A = RechercheChien($link, $id); if ($A->idPere == '') $A->idPere = -1; if ($A->idMere == '') $A->idMere = -1; $tab_mat[$gen+1][] = $A->idPere; $tab_mat[$gen+1][] = $A->idMere; } else { $tab_mat[$gen+1][] = -1; $tab_mat[$gen+1][] = -1; } } } for($i=0;$i<(count($tab_pat)); $i++) { for ($j=0;$j<(count($tab_pat[$i])); $j++) { for($k=0;$k<(count($tab_mat)); $k++) { for ($l=0;$l<(count($tab_mat[$k])); $l++) { if($tab_pat[$i][$j]!=-1) { if($tab_pat[$i][$j]==$tab_mat[$k][$l]) { $tab_commun[]=$i; $tab_commun[]=$k; } } } } } } $tx_consang=0; if(isset($tab_commun)) { for($i=0;$i<(count($tab_commun));$i+=2) { $puissance=1+$tab_commun[$i]+$tab_commun[$i+1]; // $bas=puissance(2,$puissance); $bas=pow(2,$puissance); $tx_consang+=(1/$bas); } } $tx_consang *= 100; // $tx_consang = round($tx_consang, 2); $tx_consang = round($tx_consang); return $tx_consang; } Pedigree English Setter:: Family Tree
 
[ Home ] [ Search ] [ Search Kennel ] [ Connection ]

unknown
Setter Anglais
Mother
unknown
unknownunknown
unknown
unknownunknown
unknown
Mother
unknown
unknownunknown
unknown
unknownunknown
unknown
Note: data are entered by members. There is no guarantee about accuracy of data.