From 2215f29d6df172868ad9f2a7fd69bf51f40f3a92 Mon Sep 17 00:00:00 2001 From: AudreyAAMartin <122282773+AudreyAAMartin@users.noreply.github.com> Date: Thu, 9 Feb 2023 21:02:40 +0000 Subject: [PATCH] Fix to issue 110 (sortPed) --- R/crossing.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/crossing.R b/R/crossing.R index dbbcb5a3..2be57efb 100644 --- a/R/crossing.R +++ b/R/crossing.R @@ -663,24 +663,24 @@ sortPed = function(id, mother, father, maxCycle=100){ for(i in which(unsorted)){ if(is.na(output$mother[i])&is.na(output$father[i])){ # Is a founder - output$gen[i] = gen + output$gen[i] = 1 unsorted[i] = FALSE }else if(is.na(output$mother[i])){ # Mother is a founder if(!unsorted[output$father[i]]){ - output$gen[i] = gen + output$gen[i] = output$gen[output$father[i]] + 1 unsorted[i] = FALSE } }else if(is.na(output$father[i])){ # Father is a founder if(!unsorted[output$mother[i]]){ - output$gen[i] = gen + output$gen[i] = output$gen[output$mother[i]] + 1 unsorted[i] = FALSE } }else{ # Both parents are in the pedigree if(!unsorted[output$mother[i]] & !unsorted[output$father[i]]){ - output$gen[i] = gen + output$gen[i] = pmax(output$gen[output$mother[i]], output$gen[output$father[i]]) + 1 unsorted[i] = FALSE } }