Learn R Programming

rdiversity (version 2.3.0)

gen2dist: Genetic distance matrix

Description

Converts variant-call (VCF) genotype data into a matrix of pairwise genetic distances between samples.

Usage

gen2dist(vcf, biallelic = FALSE)

Value

gen2dist(x) returns an object of class distance

containing a matrix of pairwise genetic distances.

Arguments

vcf

object of class data.frame laid out like the body of a VCF file: a column named FORMAT followed by one column per sample, whose entries begin with the genotype (e.g. "0|0", "0|1", "1|1"). Such a data.frame can be obtained, for example, from the gt element of a vcfR object read in with vcfR::read.vcfR().

biallelic

logical describing whether the data is biallelic or not (default).