Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to issue 110 (sortPed) #111

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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