vcfR2geno: Convert VCF object/file to genotypic matrix The object...

View source: R/run_SNMF.R

vcfR2genoR Documentation

Convert VCF object/file to genotypic matrix The object returned by vcfR2geno can be used as input in the LEA function snmf Optionally supply a character string with path where geno object will be saved This function is used in the function run_sNMFR

Description

Convert VCF object/file to genotypic matrix

The object returned by vcfR2geno can be used as input in the LEA function snmf Optionally supply a character string with path where geno object will be saved This function is used in the function run_sNMFR

Usage

vcfR2geno(vcf, out = NULL)

Arguments

vcf

Character string with path to input VCF file.

out

Character string with path where output geno file should be saved. Default is NULL.

Value

Matrix with genotypes in geno format

Examples

library(misc.wrappers)

## Example 1:
# Path to VCF with SNPs
vcf.path    <- file.path(system.file("extdata", package = "misc.wrappers"),"simK4.vcf.gz")
run_sNMF(x=vcf.path,format="VCF",kmax=10,reps=30,save.as="sNMF_simK4.pdf")

## Example 2: Same SNP dataset as example 1, but here we also provide Lon/Lat coordinates of individuals to geographically interpolate admixture coefficients.
vcf.path    <- file.path(system.file("extdata", package = "misc.wrappers"),"simK4.vcf.gz")
coords.path <- file.path(system.file("extdata", package = "misc.wrappers"),"simK4_coords.txt")
run_sNMF(x=vcf.path,format="VCF",coords=coords.path,samplenames=NULL,kmax=10,reps=30,entropy=TRUE,project="new",iter=500,save.as="sNMF_simK4_withCoords.pdf")

JeffWeinell/misc.wrappers documentation built on Sept. 20, 2023, 12:42 p.m.