magnusdv / ibdsim2

Simulate patterns of DNA sharing between pedigree members
https://magnusdv.github.io/pedsuite/
5 stars 2 forks source link

Implement alleleSummary() for X chromosomal simulations #1

Closed magnusdv closed 6 years ago

magnusdv commented 6 years ago

Need to think through what this should look like.

library(ibdsim2)
x = pedtools::nuclearPed(1)
sim = ibdsim(x, sims = 1, chrom = "X", seed = 111, verbose = F)

alleleSummary(sim[[1]])
#>      chrom    start       end   length 1p 1m 2p 2m 3p 3m
#> [1,]    23  0.00000  10.06673 10.06673  1  1  2  3  3  3
#> [2,]    23 10.06673  68.26989 58.20316  1  1  2  3  2  2
#> [3,]    23 68.26989 154.58261 86.31272  1  1  2  3  3  3

# In particular this output is meaningless for hemizygote males:
alleleSummary(sim[[1]], ids = c(1,3), ibd.status = TRUE)
#>      chrom    start       end   length 1p 1m 3p 3m ibd ibd_pp ibd_pm
#> [1,]    23  0.00000  10.06673 10.06673  1  1  3  3   0      0      0
#> [2,]    23 10.06673  68.26989 58.20316  1  1  2  2   0      0      0
#> [3,]    23 68.26989 154.58261 86.31272  1  1  3  3   0      0      0
#>      ibd_mp ibd_mm
#> [1,]      0      0
#> [2,]      0      0
#> [3,]      0      0

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

mdehli commented 6 years ago

Godt poeng! 😁

Den fre. 10. aug. 2018, 09.06 skrev Magnus Dehli Vigeland < notifications@github.com>:

Need to think through what this should look like.

library(ibdsim2)x = pedtools::nuclearPed(1)sim = ibdsim(x, sims = 1, chrom = "X", seed = 111, verbose = F)

alleleSummary(sim[[1]])#> chrom start end length 1p 1m 2p 2m 3p 3m#> [1,] 23 0.00000 10.06673 10.06673 1 1 2 3 3 3#> [2,] 23 10.06673 68.26989 58.20316 1 1 2 3 2 2#> [3,] 23 68.26989 154.58261 86.31272 1 1 2 3 3 3

In particular this output is meaningless for hemizygote males:

alleleSummary(sim[[1]], ids = c(1,3), ibd.status = TRUE)#> chrom start end length 1p 1m 3p 3m ibd ibd_pp ibd_pm#> [1,] 23 0.00000 10.06673 10.06673 1 1 3 3 0 0 0#> [2,] 23 10.06673 68.26989 58.20316 1 1 2 2 0 0 0#> [3,] 23 68.26989 154.58261 86.31272 1 1 3 3 0 0 0#> ibd_mp ibd_mm#> [1,] 0 0#> [2,] 0 0#> [3,] 0 0

Created on 2018-08-10 by the reprex package http://reprex.tidyverse.org (v0.2.0).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/magnusdv/ibdsim2/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ARtgBcAsgNuk3yN_koOnV9G5ir-8ZS4Xks5uPTD-gaJpZM4V3sfU .

magnusdv commented 6 years ago

A first attempt on this is now in place, with the function alleleSummaryX(). This may change substantially, but I like it as a decent starting point.