magnusdv / ibdsim2

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

haploDraw #13

Closed thoree closed 1 year ago

thoree commented 2 years ago

I need to remove (change?) the pos argument to see the colorinG

library(ribd)
#> Loading required package: pedtools
library(ibdsim2)
x = avuncularPed("u", "ni") |> addSon(parents = c(3,6))
sims = ibdsim(x, N = 1, ids = 3, seed = 123, verbose = F)
s = sims[[1]]
haploDraw(x, s, chrom = 1, cols = 2:7, pos = 2, 
          height = 5, margin = c(2,1,1,1),ids = 3)

Created on 2022-06-14 by the reprex package (v2.0.1)

magnusdv commented 1 year ago

The problem here is that the haplotypes were drawn outside the margins.

As of e2fd834 the margins are adjusted automatically, so this should be ok now. For example:

library(ibdsim2, quietly = T)

x = avuncularPed("u", "ni") |> 
  addSon(parents = c(3,6))
sims = ibdsim(x, N = 1, seed = 123, verbose = F)

# Default position: Below
haploDraw(x, sims, chrom = 1, cols = 2:7)

# Better positions
haploDraw(x, sims, chrom = 1, cols = 2:7, pos = c(2,4,1,1,1,1,2))

Created on 2022-12-17 with reprex v2.0.2