perm_gs_by_pops {gscramble}R Documentation

Take the output of rearrange_genos and permute everyone by population

Description

This is done prior to assigning random genomic fragments of individuals in the sample to the founders of the GSP, to be dropped to the samples.

Usage

perm_gs_by_pops(GS, preserve_haplotypes = FALSE, preserve_individuals = FALSE)

Arguments

GS

the tibble that is the output from rearrange_genos

preserve_haplotypes

If TRUE then the Geno data is assumed phased (first allele at an individual on one haplotype and second allele on the other) and those haplotypes are preserved in this permutation of genomic material amongst the founders.

preserve_individuals

If TRUE then whole individuals are permuted around the data set and the two gene copies at each locus are randomly permuted within each individual. If preserve_individuals = "BY_CHROM", then the the two copies of each chromosome in an individual are permuted together. Thus a permuted individual may have two copies of one chromosome from one individual, and two copies of another chromosome from a different individual. (If preserve_haplotypes = TRUE then the gene copies are not permuted within individuals. You should only ever use preserve_haplotypes = TRUE if you have phased data.)

Value

Returns a list of the same format as the output of rearrange_genos. Plus one additional component. Each component of the return list is itself an unnamed list with one component (makes it easier to use bind_rows to create a tibble of list columns from these). The components, once unlisted are:

Examples

# first get the output of rearrange_genos
RG <- rearrange_genos(Geno, I_meta, M_meta)

# then permute by the populations
PG <- perm_gs_by_pops(RG)

[Package gscramble version 1.0.1 Index]