Skip to content

Wrong spouse pairing #5

@magnusdv

Description

@magnusdv

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions