magnusdv / forrel

Forensic pedigree analysis and relatedness inference
GNU General Public License v2.0
11 stars 0 forks source link

Genotypes are lost in conversion from Familias #15

Closed magnusdv closed 5 years ago

magnusdv commented 5 years ago

Moved from #13 (and slightly edited):

A small extension of the first example in the help for Familias2ped. Genotypes are lost when a singleton NN is added :

library(forrel, quietly = TRUE)
library(Familias, quietly = TRUE)

persons = c('mother', 'daughter', 'AF', 'NN')

ped1 = FamiliasPedigree(id = persons,
                        dadid = c(NA, 'AF', NA, NA),
                        momid = c(NA, 'mother', NA, NA),
                        sex = c('female', 'female', 'male', 'male'))

datamatrix = data.frame(THO1.1 = c(NA, 8,   NA, 8), 
                        THO1.2 = c(NA, 9.3, NA, 8),
                        row.names = persons)

# Genotypes are lost in conversion:
Familias2ped(ped1, datamatrix, loci = NULL)
#> $`_comp1`
#>        id fid    mid sex <1>
#>    mother   *      *   2 -/-
#>  daughter  AF mother   2 -/-
#>        AF   *      *   1 -/-
#> 
#> $`_comp2`
#>  id fid mid sex <1>
#>  NN   *   *   1 -/-

Created on 2019-01-16 by the reprex package (v0.2.1)

magnusdv commented 5 years ago

Note to self: This seems to be caused by a bug in pedtools::as.ped().