vcfR (version 1.8.0)

Format conversion: Convert vcfR objects to other formats

Description

Convert vcfR objects to objects supported by other R packages

Usage

vcfR2genind(x, sep = "[|/]")

vcfR2loci(x)

vcfR2genlight(x, n.cores = 1)

Arguments

x

an object of class chromR or vcfR

sep

character (to be used in a regular expression) to delimit the alleles of genotypes

n.cores

integer specifying the number of cores to use.

Details

After processing vcf data in vcfR, one will likely proceed to an analysis step. Within R, three obvious choices are: pegas, adegenet and poppr. The package pegas uses objects of type loci. The function vcfR2loci calls extract.gt to create a matrix of genotypes which is then converted into an object of type loci.

The packages adegenet and poppr use the genind object. The function vcfR2genind uses extract.gt to create a matrix of genotypes and uses the adegenet function df2genind to create a genind object. The package poppr additionally uses objects of class genclone which can be created from genind objects using poppr::as.genclone. A genind object can be converted to a genclone object with the function poppr::as.genclone.

The function vcfR2genlight calls the 'new' method for the genlight object. This method implements multi-threading through calls to the function parallel::mclapply. Because 'forks' do not exist in the windows environment, this will only work for windows users when n.cores=1. In the Unix environment, users may increase this number to allow the use of multiple threads (i.e., cores).

See Also

extract.gt, alleles2consensus, adegenet::df2genind, adegenet::genind, pegas, adegenet, and poppr. To convert to objects of class DNAbin see vcfR2DNAbin.

Examples

Run this code
# NOT RUN {
data(vcfR_test)
gl <- vcfR2genlight(vcfR_test)

# }

Run the code above in your browser using DataLab