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

Wrong spouse pairing #5

Open
magnusdv opened this issue Jan 31, 2022 · 1 comment
Open

Wrong spouse pairing #5

magnusdv opened this issue Jan 31, 2022 · 1 comment

Comments

@magnusdv
Copy link

Hi! I may have stumbled upon a bug in your (usually brilliant) plotting algorithm:

library(kinship2)
x = pedigree(id    = 1:15,
             dadid = c(0,0,0,0,0,1,3,3,5,6,8,8,10,12,13),
             momid = c(0,0,0,0,0,2,2,4,4,7,7,9,11,11,14),
             sex   = c(1,2,1,2,1,1,2,1,2,1,2,1,1,2,1))
as.data.frame(x)
#>    id dadid momid    sex
#> 1   1     0     0   male
#> 2   2     0     0 female
#> 3   3     0     0   male
#> 4   4     0     0 female
#> 5   5     0     0   male
#> 6   6     1     2   male
#> 7   7     3     2 female
#> 8   8     3     4   male
#> 9   9     5     4 female
#> 10 10     6     7   male
#> 11 11     8     7 female
#> 12 12     8     9   male
#> 13 13    10    11   male
#> 14 14    12    11 female
#> 15 15    13    14   male

A correct plot of the pedigree is shown below. I’m only able to produce this by specifying the complete spouse order data:

sp = rbind(c(1,2), c(2,3), c(3,4), c(4,5), c(6,7), c(7,8), c(8,9), c(10,11), c(11,12), c(13,14))
x$hints = list(order = 1:15, spouse = cbind(sp, 0))
plot(x)

Without the hints, the top row gets botched:

x$hints = NULL
plot(x)

For some reason individuals 1 and 4 are connected as spouses, although they aren't.

Created on 2022-01-31 by the reprex package (v2.0.1)

@sinnweja
Copy link
Member

sinnweja commented Feb 1, 2022

Thank you for pointing out this bug. I'm glad you found a work-around with the hints, but I'll add this to my list of bugs to address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants