magnusdv/pedtools

consolidate function - feature request

Opened this issue · 0 comments

A function, say consolidate ensuring that ped objects are defined for
the same markers would be nice. Example:

library(forrel)
#> Loading required package: pedtools
x1 = singleton("s1")
x1 = setMarkers(x1, locusAttributes = NorwegianFrequencies[1:2])
x2 = singleton("s2")
x2 = setMarkers(x2, locusAttributes = NorwegianFrequencies[2:3])

# The function should ensure that  x1 and x2 are defined for the samme markers

miss1 = setdiff(name(x2), name(x1))
miss2 = setdiff(name(x1), name(x2))

x1 = x1 |> addMarkers(locusAttributes = NorwegianFrequencies[miss1])
x2 = x2 |> addMarkers(locusAttributes = NorwegianFrequencies[miss2])
list(x1, x2)
#> [[1]]
#>  id fid mid sex D3S1358 TH01 D21S11
#>  s1   *   *   1     -/-  -/-    -/-
#> 
#> [[2]]
#>  id fid mid sex TH01 D21S11 D3S1358
#>  s2   *   *   1  -/-    -/-     -/-

Created on 2022-04-27 by the reprex package (v2.0.1)