Learn R Programming

poppr (version 2.1.0)

bitwise.dist: Calculate a distance matrix comparing samples based on the number of alleles that differ in zygosity.

Description

This function does pairwise comparisons between diploid samples in a genlight object. The number representing the distance between two samples is equal to the number of alleles in the samples that do not have the same zygosity.

Usage

bitwise.dist(x, percent = TRUE, mat = FALSE, missing_match = TRUE,
  differences_only = FALSE, threads = 0)

Arguments

x
a genlight, genind, or genclone object.
percent
logical. Should the distance be represented from 0 to 1? Default set to TRUE. FALSE will return the distance represented as integers from 1 to n where n is the number of loci.
mat
logical. Return a matrix object. Default set to FALSE, returning a dist object. TRUE returns a matrix object.
missing_match
logical. Determines whether two samples differing by missing data in a location should be counted as matching at that location. Default set to TRUE, which forces missing data to match with anything. FALSE forces mis
differences_only
logical. Determines whether the matrix should count differences or distances. For instance, 0 to 2 would be a distance of 2 but a difference of 1.
threads
The maximum number of parallel threads to be used within this function. A value of 0 (default) will attempt to use as many threads as there are available cores/CPUs. In most cases this is ideal. A value of 1 will force the function to run serially, which

Value

  • Pairwise distances between individuals present in the genlight object.

Examples

Run this code
set.seed(999)
x <- glSim(n.ind = 10, n.snp.nonstruc = 5e2, n.snp.struc = 5e2, ploidy = 2)
x
system.time(xd <- bitwise.dist(x))
xd

Run the code above in your browser using DataLab