This function first reorders individuals in the columns of the matrix so that every population is together. Then it rearranges genotypes into separate columns for each haplotype (or "halflotype" if they are unphased.) This prepares the matrix for different kinds of a permutation (within or between populations, for example).

rearrange_genos(G, Im, Mm)

Arguments

G

the genotype matrix (N rows and 2L columns)

Im

the meta data for the N samples.

Mm

the meta data for the L markers.

Value

Returns a list. 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:

  • G: a matrix---the rearranged genotype data matrix

  • I: the I_meta tibble

  • M: the M_meta tibble

Details

It returns a list. One component is the matrix, another is the updated individual meta data, and the third is the marker meta data.

Examples

RG <- rearrange_genos(Geno, I_meta, M_meta)