magnusdv / pedtools

Tools for working with pedigrees in R
GNU General Public License v3.0
23 stars 3 forks source link

Malformed random pedigrees with selfing #30

Closed magnusdv closed 1 year ago

magnusdv commented 2 years ago
library(pedtools)

x = randomPed(2, 2, selfing = TRUE, seed = 2)
x
#>  id fid mid sex
#>   1   *   *   1
#>   2   *   *   2
#>   3   1   2   1
#>   4   1   1   0

validatePed(x)
#> Error: Malformed pedigree.
#>  Individual 1 is male, but appear as the mother of 4

Created on 2022-03-08 by the reprex package (v2.0.1)

paleomariomm commented 1 year ago

Hi @magnusdv , I am having also this problem when using as.ped(). Did you find out how to solve this? I created a Stackoverflow question (https://stackoverflow.com/questions/74361363/convert-a-dataframe-into-a-ped-object-in-r-pedtools)

Thanks

magnusdv commented 1 year ago

Hi, sorry for the late answer. This bug is still present, but will be dealt with soon - a major overhaul of randomPed() is on its way (hopefully early 2023).