
Set the ploidy of a gen_tibble
to include pseudohaploids
Source: R/gt_pseudohaploid.R
gt_pseudohaploid.Rd
The ploidy of a gen_tibble
is set to -2, to indicate that some individuals
are coded as pseudohaploids. The ploidy of the individuals is updated, with
pseudohaploids set to 1 and diploids set to 2. However, the dosages are not
changed, meaning that pseudohaploids are still coded as 0 or 2.
Value
a gen_tibble
object with the ploidy set to -2 and the individual
ploidy values updated to 1 or 2.
Examples
example_gt <- example_gt("gen_tbl")
# Detect pseudohaploids and set ploidy for the whole gen_tibble
example_gt <- example_gt %>% gt_pseudohaploid(test_n_loci = 3)
# Ploidy is now set to -2
show_ploidy(example_gt)
#> [1] -2
# Individual ploidy now varies between 1 (pseudohaploid) and 2 (diploid)
indiv_ploidy(example_gt)
#> [1] 2 2 1 2 2 1 2