magnusdv / pedtools

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

`swapSex()` messes up X-chromosomal markers #40

Closed magnusdv closed 1 year ago

magnusdv commented 1 year ago
library(pedtools)

x = nuclearPed(1) |> 
  addMarker(chrom = "X", geno = c("a", "a/b", "a")) |> 
  swapSex(3)
x
#>  id fid mid sex <1>
#>   1   *   *   1   a
#>   2   *   *   2 a/b
#>   3   1   2   2   a
plot(x, marker = 1)


y = nuclearPed(1, sex = 2) |> 
  addMarker(chrom = "X", geno = c("a", "a/b", "a/b")) |> 
  swapSex(3)
y
#>  id fid mid sex <1> 
#>   1   *   *   1   a 
#>   2   *   *   2 a/b 
#>   3   1   2   1 a/b?
plot(y, marker = 1)

Created on 2023-01-29 with reprex v2.0.2