gt2num: Convert VCF GT fields to numeric format

View source: R/gt2num.R

gt2numR Documentation

Convert VCF GT fields to numeric format

Description

Convert VCF GT fields to numeric format

Usage

gt2num(genomat)

Arguments

genomat

A matrix of VCF-style genotype calls, with SNPs in rows, and samples/individuals in columns

Details

This function will convert a matrix of genotype calls from a VCF file into numeric format. It will convert homozygous reference allele calls to 0, heterozygous calls to 1, and homozygous alternate allele calls to 2. Note that the output IS NOT necessarily in minor-allele dosage format. See ?flip_alleles for more details. Loci with more than two alleles will be removed and reported. An input matrix of the required format can be generated with vcfR::extract.gt(), with bcftools query, or manually in R.

Value

A list containing the following elements:

  • genomat Converted numeric genotype matrix

  • removed_loci Vector of loci removed due to having greater than two alleles

See Also

flip_alleles


etnite/bwardr documentation built on Jan. 6, 2023, 7:12 a.m.