encode_geno: Encode a matrix of genotypes using a set of allele codes

View source: R/encode_geno.R

encode_genoR Documentation

Encode a matrix of genotypes using a set of allele codes

Description

Encode a matrix of genotypes using a set of allele codes.

Usage

encode_geno(
  geno,
  allele_codes,
  output_codes = c("-", "A", "H", "B"),
  cores = 1
)

Arguments

geno

Character matrix of genotypes (rows as markers, columns as individuals)

allele_codes

Two-column matrix of alleles (rows as markers)

output_codes

Vector of length four, with missing, AA, AB, BB codes

cores

Number of CPU cores to use, for parallel calculations. (If 0, use parallel::detectCores().) Alternatively, this can be links to a set of cluster sockets, as produced by parallel::makeCluster().

Value

Matrix of same dimensions as geno, but with values in output_codes.

See Also

find_consensus_geno(), find_unique_geno()

Examples

geno <- rbind(c("C", "G", "C",  "GG", "CG"),
              c("A", "A", "AT", "TA", "TT"),
              c("T", "G", NA,   "GT", "TT"))
codes <- rbind(c("C", "G"), c("A", "T"), c("T", "G"))
geno_encoded <- encode_geno(geno, codes)


qtl2convert documentation built on July 11, 2022, 5:08 p.m.