magnusdv/pedtools

Unplottable pedigrees

Closed this issue · 2 comments

The class of pedigrees allowed in pedtools is larger than for the kinship2 package, which does the plotting. Hence certain pedigrees cannot be plotted as of yet. In particular this concerns pedigrees with selfing:

x = pedtools::ped(1:2, fid=c(0,1), mid=c(0,1), sex=c(0,1))
x
#>  id fid mid sex
#>   1   *   *   0
#>   2   1   1   1
plot(x)
#> Warning in kinship2::pedigree(id = ped$id, dadid = ped$fid, momid =
#> ped$mid, : More than 25% of the gender values are 'unknown'
#> Error in kinship2::pedigree(id = ped$id, dadid = ped$fid, momid = ped$mid, : pedigree must have at least 2 founders

And a different error here:

library(pedtools)
y = nuclearPed(1, sex = 0)
y = addChildren(y, father = 3, mother = 3, nch = 1)
y
#>  id fid mid sex
#>   1   *   *   1
#>   2   *   *   2
#>   3   1   2   0
#>   4   3   3   1
plot(y)
#> Error in kinship2::pedigree(id = ped$id, dadid = ped$fid, momid = ped$mid, : Id not male, but is a father: 3

Idea: Plot the marriage graph in these cases?

Closing this as resolved; these pedigrees are now automatically plotted as DAGs.