dist.multidna {apex} | R Documentation |
Pairwise distances for multiple gene data
Description
This function computes pairwise genetic distances between individuals using genes in a multidna object.
By default, one distance matrix (dist object) is created for each each, but a single distance can be derived by pooling all genes (argument pool=TRUE
)
Usage
dist.multidna(x, pool = FALSE, genes = TRUE, ...)
Arguments
x |
a multidna object. |
pool |
a logical indicating if all genes should be pooled (concatenated) to obtain a single distance matrix; defaults to FALSE. |
genes |
an optional vector indicating the genes to retain for the concatenation; any way to subset the list in x@dna is acceptable; by default, all genes are used. |
... |
further arguments passed to |
Value
a list of dist objects (pool=FALSE) or a single dist object (pool=TRUE)
Author(s)
Thibaut Jombart t.jombart@imperial.ac.uk
See Also
Examples
## simple conversion with nicely ordered output
data(woodmouse)
genes <- list(gene1=woodmouse[,1:500], gene2=woodmouse[,501:965])
x <- new("multidna", genes)
x
plot(x)
## get separate distance matrix and pooled one
lD <- dist.multidna(x)
D <- dist.multidna(x, pool=TRUE)
## get corresponding NJ trees
ltrees <- lapply(lD, nj)
tree <- nj(D)
opar <- par(no.readonly=TRUE)
par(mfrow=c(3,1))
for(i in 1:2) plot(ltrees[[i]], main=names(ltrees)[i])
plot(tree, main="Pooled distances")
par(opar)
[Package apex version 1.0.6 Index]