View source: R/individual_distance.R
assignClones | R Documentation |
assignClones
uses a distance matrix such as that produced by
meandistance.matrix
or meandistance.matrix2
to place individuals into groups representing asexually-related ramets,
or any other grouping based on a distance threshold.
assignClones(d, samples = dimnames(d)[[1]], threshold = 0)
d |
A symmetrical, square matrix containing genetic distances between
individuals. Both dimensions should be named according to the names
of the individuals (samples). A matrix produced by
|
samples |
A character vector containing the names of samples to analyze. This
should be all or a subset of the names of |
threshold |
A number indicating the maximum distance between two individuals that will be placed into the same group. |
This function groups individuals very similarly to the software GenoType
(Meirmans and van Tienderen, 2004). If a distance matrix from
polysat is exported to GenoType, the results will be the same as
those from assignClones
assuming the same threshold is used. Note
that GenoType requires that
distances be integers rather than decimals, so you will have to
multiply the distances produced by polysat by a large number and
round them to the nearest integer if you wish to export them to GenoType.
When comparing the
results of assignClones
and GenoType using my own data, the only
differences I have seen have been the result of rounding; a decimal that
was slightly above the threshold in when analyzed in R was rounded down
to the threshold when analyzed in GenoType.
Note that when using a distance threshold of zero (the default), it is advisable to exclude all samples with missing data, in order to prevent the merging of non-identical clones. At higher thresholds, some missing data are allowable, but samples that have missing data at many loci should be excluded.
The write.table
function can be used for exporting the results to
GenoDive. See the R documentation for information on how to
make a tab-delimited file with no header.
A numeric vector, named by samples
. Each clone or group is given
a number, and the number for each sample indicates the clone or group
to which it belongs.
Lindsay V. Clark
Meirmans, P. G. and Van Tienderen, P. H. (2004) GENOTYPE and GENODIVE: two programs for the analysis of genetic diversity of asexual organisms. Molecular Ecology Notes 4, 792–794.
genotypeDiversity
# set up a simple matrix with three samples test <- matrix(c(0,0,.5,0,0,.5,.5,.5,0), ncol=3, nrow=3) abc <- c("a", "b", "c") dimnames(test) <- list(abc,abc) # assign clones with a threshold of zero or 0.5 assignClones(test) assignClones(test, threshold=0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.