genmat.bed: Get genotype matrix from genomic data

genmatR Documentation

Get genotype matrix from genomic data

Description

Get genotype matrix from genomic data

Usage

genmat(genfile, sample.id = NULL, snp.id = NULL, 
snpfirstdim = NA, .snpread = NA, with.id = FALSE, verbose = TRUE, ...)


## S3 method for class 'genmat.bed'
genmat.bed(genfile, sample.id = NULL, snp.id = NULL, 
snpfirstdim = NA, .snpread = NA, with.id = FALSE, verbose = TRUE, ...)



## S3 method for class 'genmat.vcf'
genmat.vcf(genfile, sample.id = NULL, snp.id = NULL, 
snpfirstdim = NA, .snpread = NA, with.id = FALSE, verbose = TRUE, ...)



## S3 method for class 'genmat.gds'
genmat.gds(genfile, sample.id = NULL, snp.id = NULL, 
snpfirstdim = NA, .snpread = NA, with.id = FALSE, verbose = TRUE, ...)


Arguments

genfile

Genetic datasets containg sample ID and SNP ID, format includes bed (plink), vcf, or GDS file.

sample.id

Sample ID

snp.id

SNP ID

snpfirstdim

whether genotypes are stored in the individual-major mode (TRUE), (i.e, list all SNPs for the first individual, and then list all SNPs for the second individual, etc) or (FALSE) for snp-major mode; if NA, determine automatically

.snpread

internal use

with.id

whether return "sample.id" and "snp.id".

verbose

whether printing information

...

more arguments

Details

Effectively get genoptype matrix from various genotype formats, including bed, vcf, or gds.

Value

The function returns an integer matrix with values 0, 1, 2 or NA representing the number of reference allele when with.id=FALSE; or list(genotype, sample.id, snp.id) when with.id=TRUE. The orders of sample and SNP IDs in the genotype matrix are actually consistent with sample.id and snp.id in the GDS file, which may not be as the same as the arguments sampel.id and snp.id specified by users.

References

Zheng, X., & Weir, B. S. (2016). Eigenanalysis of SNP data with an identity by descent interpretation. Theoretical population biology, 107, 65-76.

Examples


inp=SNPRelate::snpgdsExampleFileName()

genomat1=genmat.gds(inp)


VariantScan documentation built on June 30, 2022, 5:05 p.m.