magnusdv/pedtools

Duplicated individuals

Closed this issue · 3 comments

Apparenty nuclearPed and likelihood(https://github.com/magnusdv/pedprobr) tolerate some duplication, not plot :

library(pedtools)
library(pedprobr)
x = nuclearPed(children = c("sib1", "sib1"))
m = marker(x, sib1 = 1:2, sib1 = 1, alleles = 1:2)
likelihood(x,m)
#> [1] 0.25
plot(x,m)
#> Error in kinship2::pedigree(id = ped$id, dadid = ped$fid, momid = ped$mid, : Duplicate subject id: sib1

Created on 2018-08-13 by the reprex package (v0.2.0).

Good catch, duplicated id's should definitely raise an error during pedigree construction.

Plot labels can be duplicated, of course, when they are given explicitly in the plot() call using the id.labels argument. (For instance, it is often useful to use empty labels for many pedigree members.)

On a side note, this reminds me of something I've swept under the rug so far: The class of pedigrees allowed in pedtools is larger than for the kinship2 package (which does the plotting). Hence certain pedigrees (e.g. pedigrees involving selfing) cannot be plotted as of yet.

With 44598d5 duplicated IDs are caught in relabel(), resolving the original error here.