Learn R Programming

polysat (version 0.1)

distance.matrix.1locus: Pairwise Genetic Distances at One Locus

Description

Given all genotypes for one locus, create a pairwise genetic distance matrix.

Usage

distance.matrix.1locus(gendata, distmetric = Bruvo.distance,
progress = TRUE, ...)

Arguments

gendata
A sublist from a genotype object in the standard polysat format, representing all samples for one locus. A list of vectors, where each vector contains all unique alleles for a given sample at this locus. Sample names are used to name the list.
distmetric
This is the function that will be used to calculate each pairwise distance. This should be a function that, given two vectors of alleles, returns a numerical distance.
progress
If TRUE, distance.matrix.1locus will print the names of sample pairs as it finishes each calculation with distmetric. For large datasets, this is intended so that the user can monitor the progress of
...
These arguments will be passed to distmetric. For example, with Bruvo.distance, maxl, usatnt, or missing may be used.

Value

  • A symmetrical matrix of distances, with the names of samples used as row and column names.

Details

Given a list of genotypes at one locus, distance.matrix.1locus produces a symmetrical matrix of pairwise distances between genotypes. If using a polysat genotype object such as that produced by read.GeneMapper, the gendata argument should be one of the sublists, for example mygenotypedata[,"locus1"]. The measure of distance can be any that is provided with polysat, or any function written by the user, so long as it takes genotypes as vectors of alleles (or any other type of object that is given as elements of the list gendata) and returns a numerical distance. Any arguments that need to be passed to the distmetric function can be given to distance.matrix.1locus. To save processing time, each pairwise distance is only calculated once and then written to both locations in the matrix simultaneously. The user also has the option to have each pair of sample names printed after the distance is calculated, so that progress can be monitored if evaluation is expected to take a long time.

See Also

Bruvo.distance, Lynch.distance, meandistance.matrix

Examples

Run this code
mygenotypes <- list(IND1=c(124,127,133), IND2=c(130,139,145,151),
    IND3=c(118,127,133,154))
distance.matrix.1locus(mygenotypes,usatnt=3)

Run the code above in your browser using DataLab