Jump to content

Triple_Deuce

Members
  • Posts

    22
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

Triple_Deuce's Achievements

Member

Member (2/5)

0

Reputation

  1. Is there anyway to get the $sires & $dams arrays to properly display like this when necessary? It looks like it's not tracking all occurrences. DOG ID: 52 | ID | NAME | SIRE | DAM | | | | DIST | DIST | |-----|--------------------|------|------| | 44 | A | 2,2,2,2| 2,2,2,2| .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 | 45 | B | 2,2,2,2| 2,2,2,2| .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 .5^(4+1) = 0.03125 total ICO: 0.25
  2. Ok, I've put in the following: $c = array_map(function () { return array_sum(func_get_args()); }, $sires[$id], $dams[$id]); foreach($c AS $key =>$value){ $ico = pow(.5,($value + 1)) + $ico; } print_r($c); which calculates U correctly now... however J is now wrong, it's showing as 0.125 instead of .5 (full sibling x full sibling = .5 (50%)). What am I missing?
  3. Ok, as I was typing this, I think i see my error! DogU is supposed to be .375 (37.5%) DogO & DogP are only behind DogU TWICE. I have my equation in a nested foreach() which is why I'm getting the 4 extra (2 of each) when I shouldnt. foreach($sires[$id] as $keyS => $valueS){ foreach($dams[$id] as $keyD => $valueD){ $ico = pow(.5,($valueS + $valueD + 1)) + $ico; } } What would be the best approach to break out of that and and potentially pair either $sires or $dams with empty $valueD/S?
  4. Are you getting that on my thing? http://play.ratsofnimh.com/pedigree/inbreeding2.php or somewhere else?
  5. Yes, this is correct but I was talking about getting U's ICO...
  6. OK, after some digging, I think I've decided the green site isnt accurate... I found this site http://www.fao.org/docrep/006/x3840e/X3840E03.htm (at the bottom) "Pedigree illustrating the fact that the mating of two inbred, but unrelated, fish will produce offspring with no inbreeding: FJ = 25% and FU = 37.5%, but because they are not related, FZ= 0%." Based on given info I get .5 (50%) as inbreeding on FU (ID#: 59) instead of .375 (37.5%).... but my stuff is calculating FJ (ID#: 52) @ .25 (25%) & FZ (ID#: 60) @ 0 correctly. If my program leaves out either O (#53) or P (#54) from the equation it calculates correctly at .375 (37.5%) for FU but I'd of thought that both the great grandparents should have been counted... | ID | NAME | SIRE | DAM | | | | DIST | DIST | |-----|--------------------|------|------| | 53 | O | 2,2| 2,2| 0.03125 0.03125 0.03125 0.03125 | 54 | P | 2,2| 2,2| 0.03125 0.03125 0.03125 0.03125 | 55 | Q | 1| 1| 0.125 | 56 | R | 1| 1| 0.125 I'm going to try and get some better help to understand the equation because I'm missing something or misunderstanding something in the equation.
  7. From my reading I'm beginning to wonder if that site is wrong. Based on the sites I've read and calculated by hand I keep getting different than that site... I get the .1875 so maybe that is more accurate than the site I was checking myself against? Especially since it wasnt counting certain instances? How did you find that Dog 20 was being ignored on that site and only 2 of the 3 instances of 17 were being used? http://www.fao.org/docrep/006/x3840e/X3840E03.htm Which I've been calculating FA as 0 since we don't know for sure. Thank you for your continued help.
  8. I'd of thought the 2nd method would have been correct but according to the site I'm using to check myself (http://www.czerwonytrop.com/inb/) neither are right. I'm going to have to go back through the equation and work by hand and see where I'm screwing up. i'll come back once I've ironed out my error in the equation.
  9. Dog Id Dog Name Dog Sire Dog Dam 1 Nimh's Delorean 2 3 2 Dog B 4 9 3 Dog C 7 8 4 Dog E 7 9 5 Dog F 10 11 7 Dog H 14 15 8 Dog I 16 17 9 Dog J 16 17 10 Dog K 18 19 11 Dog L 20 21 14 Dog O 20 17 15 Dog P 0 0 16 Dog Q 14 17 17 Dog R 0 0 18 Dog S 0 0 19 Dog T 0 0 20 Dog U 0 0 21 Dog V 0 0 22 Dog W 0 0 23 Dog X 0 0 24 Cedric 25 26 25 Phantom 27 0 26 Walton Mare 27 0 27 Walton 0 0 28 A 0 0 29 B 0 0 30 C 29 28 31 D 29 28 32 E 0 30 33 F 0 31 34 I 33 32 35 J 0 0 36 K 0 0 37 L 0 0 38 M 0 0 39 N 0 0 40 Dog1 0 0 41 Dog2 0 0 42 Dog3 40 41 43 Dog4 42 41 hope this is what you were looking for. 0 means no ancestor registered, so isnt counted.
  10. Thank you for helping... The above code does not give correct output. I've got it working on some scenarios while not working on others. My monkey wrench is basically with multiple positions. http://play.ratsofnimh.com/pedigree/inbreeding2.php inputting ID: 9 ICO = .375 ; this is correct Then, branching a little further to input id: 4 /Id 4's dam is ID 9/ it totals .1875 ; this is wrong, it should be .15625 So if you look at id4 and it's relative 17, 17's data looks like this: | ID | NAME | SIRE | DAM | | | | DIST | DIST | |----|--------------------|------|------| | 17 | Dog R | 2 | 3,2,1| I think it would fix the problem if I could get the respective numbers to line up and everyone else is paired with 0. something like: | ID | NAME | SIRE | DAM | | | | DIST | DIST | |----|--------------------|------|------| | 17 | Dog R | 2 | 1| | 17 | Dog R | 0 | 2| | 17 | Dog R | 0 | 3| I dont know if that makes any sense or not and I dont know if that would actually solve my problem. I just know that probably not every number should be added to one another. I'm positive it stems from my foreach statement since I have it nested, because numbers are being added together that shouldnt be but unsure of how to match the other numbers with 0 if needed. I'm not sure what another option would be, just know it needs to be unnested.
  11. Looks like I got this working... my only issue seems to be if a certain dog is behind the sire or dam multiple times... which i think stems from the array_intersect_key().... I'd like to list every apparence of a dog, even if shown multple times and calculate that appear in the table to use that data in the calculate... does that make sense? http://play.ratsofnimh.com/pedigree/inbreeding2.php Putting in ID 34 returns the proper ICO: 0.0625 (6.25 %) Putting in ID 9 returns the wrong ICO of 0.25 (25 %) because it's only counting dog ID 17 twice, instead of the 3 times it shows. The ICO should be 0.375 (37.5%)... any suggestions? Thanks
  12. I really appreciate the help. I got it to work... now I have the following: http://play.ratsofnimh.com/pedigree/inbreeding2.php I'm trying to figure out how to take the given data and plug it into the equation... Sire Dist and Dam Dist would be plugged into N1 and N2... I guess i need to figure out where to put the equation because Fa will be the already calculated inbreeding COI
  13. I couldnt find out to edit my post above... Correction... it works on your data but not my data.
  14. @Barand I apologize, I had not seen replies to this topic and just happened to stumble across it again on a google search. I've tried your code and I'm not receiving results, my thought as to why is because $common = array_intersect_key($sires,$dams); $sires[] & $dams[] will not intersect since they aren't of the same gender.
  15. I am in the process of trying to create a pedigree website (php/mysql)... I want to be able to calculate a dog's inbreeding coefficient on 10 generations. I am so not sure where to even begin. I have a database table: dogs: Fields: id name sireid damid equation: FX = å [ (½) n1+n2+1 (1 + FA)] http://www.highflyer.supanet.com/coefficient.htm Can someone give me a starting point? Do I need to learn bianary trees? could I do this with an array? Thanks
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.