genotypes2alleles: Convert wide format Genotypes to wider format Alleles

View source: R/genotypes2alleles.R

genotypes2allelesR Documentation

Convert wide format Genotypes to wider format Alleles

Description

A function that will return a data frame in allele per column format from genotype per column format.

Usage

genotypes2alleles(df, loci, fixed_A = NULL, delim = NULL, name_sep = ".")

Arguments

df

Data frame that contains genotypic data and metadata

loci

Numeric column positions or names of loci

fixed_A

The number of characters of alleles in input. A diploid genotype "AT" has a fixed_A=1. Only use when the delimiter between alleles is "".

delim

A non-zero length character string separating alleles in input. For example, ":" for "A:T" or "-" 114-116"

name_sep

The desired locus allele name separator for output column names e.g., "_" for Loc1_A1. Defaults to "."

Details

This function is meant to conveniently wrap tidyr and dplyr operations to convert data between two common wide formats. At present, it's just set up for diploid data.

Value

Data frame in allele per column format

Author(s)

Zak Robinson, Contact: <zrobinson@critfc.org>

See Also

alleles2genotypes

Examples

data("wgp_example")
alleles <- genotypes2alleles(wgp_example,loci = grep("locus",colnames(wgp_example)),fixed_A = 1)

zakrobinson/RLDNe documentation built on Oct. 24, 2024, 5:37 p.m.