reindex_markers: re-index loci and or alleles given a data frame of markers

Description Usage Arguments Examples

View source: R/reindex_markers.R

Description

The data frame should be of the format of long_markers. This function will reset the values of AlleIdx and LocIdx in case some markers (or some alleles) were removed. It also rescales the allele frequencies to sum to one, and, of course, sorts the loci into map order along the chromosomes.

Usage

1

Arguments

M

a data frame of markers.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# subsample alleles from the long_markers data frame.
# Note, you would never subsample alleles like this but it
# helps to demonstrate the function.
set.seed(5);  # for reproducibility
A_few_markers <- long_markers %>%
  dplyr::sample_n(1000) %>%     # subsample 4000 alleles
  dplyr::group_by(Chrom, Locus) %>%
  dplyr::mutate(NumAlle = dplyr::n()) %>%
  dplyr::filter(NumAlle > 1)  %>%  # chuck out loci only one allele now...
  dplyr::select(-NumAlle)  # get rid of the NumAlle column we created

  reindex_markers(A_few_markers)   # then reindex them

eriqande/gdropR documentation built on Feb. 25, 2021, 2:59 p.m.