dist.multidna: Pairwise distances for multiple gene data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/dist.R

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

1
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 dist.dna.

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

dist.dna

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## 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)

apex documentation built on April 14, 2020, 5:32 p.m.