Learn R Programming

haplotypes (version 1.0)

pairnei-methods: Provides the average number of pairwise Nei's (D) differences between populations

Description

Function provides pairwise Nei's raw number of nucleotide differences between populations.

Usage

# S4 method for Dna
pairnei(x,populations,indels="sic")
# S4 method for dist
pairnei(x,populations)
# S4 method for matrix
pairnei(x,populations)

Arguments

x

an object of class Dna, "dist" or "matrix".

populations

a vector giving the populations, with one element per individual.

indels

the indel coding method to be used. This must be one of "sic", "5th" or "missing". Any unambiguous substring can be given. See distance for details.

Value

a list with following components:

Between

a matrix giving the average number of pairwise Nei's (D) differences between the populations.

Within

a numeric vector giving the average number of pairwise Nei's (D) differences within the populations.

Uniquepopulations

a character vector giving the names of the populations.

Methods

signature(x = "Dna")

signature(x = "dist")

signature(x = "matrix")

References

Nei, M. and Li, W. H. (1979) Mathematical model for studying genetic variation in terms of restriction endonucleases. Proceedings of the National Academy of Sciences of the United States of America 76, 5269-5273.

Examples

Run this code
# NOT RUN {
data("dna.obj")
x<-dna.obj[1:6,,as.matrix=FALSE]
populations<-c("pop1","pop1","pop2","pop3","pop3","pop3") 

## Method for signature 'Dna'.
pairnei(x, populations)

## Method for signature 'dist'.
d<-distance(x)
pairnei(d, populations)

## Method for signature 'matrix'.
d<-as.matrix(distance(x))
pairnei(d, populations)


# }

Run the code above in your browser using DataLab