Learn R Programming

predhy (version 1.2.1)

convertgen: Convert Genotype

Description

Convert genotypes in HapMap format or in numeric format for hypred package.

Usage

convertgen(
  input_geno,
  type = c("hmp1", "hmp2", "num"),
  missingrate = 0.2,
  maf = 0.05,
  impute = TRUE
)

Value

A matrix of genotypes in numeric format, coded as 1, 0, -1 for AA, Aa, aa. Each row represents an individual and each column represents a marker. The rownames of the matrix are the names of individuals.

Arguments

input_geno

genotype in HapMap format or in numeric format. The names of individuals should be provided. Missing (NA) values are allowed.

type

the type of genotype. There are three options: "hmp1" for genotypes in HapMap format with single bit, "hmp2" for genotypes in HapMap format with double bit, and "num" for genotypes in numeric format.

missingrate

max missing percentage for each SNP, default is 0.2.

maf

minor allele frequency for each SNP, default is 0.05.

impute

logical. If TRUE, imputation. Default is TRUE.

Examples

Run this code
## load genotype in HapMap format with double bit
data(input_geno)

## convert genotype for hypred package
inbred_gen <- convertgen(input_geno, type = "hmp2")


## load genotype in numeric format
data(input_geno1)
head(input_geno1)

## convert genotype for hypred package
inbred_gen1 <- convertgen(input_geno1, type = "num")


Run the code above in your browser using DataLab