Skip to content

Commit

Permalink
Merge pull request #111 from AudreyAAMartin/patch-1
Browse files Browse the repository at this point in the history
Fix to issue 110 (sortPed)
  • Loading branch information
gaynorr authored Feb 9, 2023
2 parents d5dff24 + 2215f29 commit 6bf1b1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/crossing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 6bf1b1d

Please sign in to comment.