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

Description Usage Arguments Details Value Methods Author(s) References Examples

Description

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

Usage

1
2
3
4
5
6
## S4 method for signature 'Dna'
pairnei(x,populations,indels="sic",nperm=99, subset=NULL,showprogbar=FALSE)
## S4 method for signature 'dist'
pairnei(x,populations,nperm=99, subset=NULL,showprogbar=FALSE)
## S4 method for signature 'matrix'
pairnei(x,populations,nperm=99, subset=NULL,showprogbar=FALSE)

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.

nperm

the number of permutations. Set this to 0 to skip the permutation procedure.

subset

a vector of integers in the range [1, length(unique(populations))], only distances between selected population(s) and the rest of the populations are calculated. If it is NULL, all comparisons are done.

showprogbar

boolean; whether the progress bar is displayed or not displayed.

Details

The null distribution of pairwise Nei's differences under the hypothesis of no difference between the populations is obtained by permuting individuals between populations.

Value

a list with following components:

neidist

a matrix giving the average number of pairwise Nei's (D) differences between populations (below diagonal elements) and average number of pairwise differences within populations (diagonal elements).

p

a matrix giving the p-values, or NULL if permutation test is not performed.

Methods

signature(x = "Dna")
signature(x = "dist")
signature(x = "matrix")

Author(s)

Caner Aktas, caktas.aca@gmail.com

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
data("dna.obj")


### Method for signature 'Dna'.
x<-dna.obj
x<-dna.obj[c(1,20,21,26,27,28,30,3,4,7,13,14,15,16,23,24,25),,as.matrix=FALSE]
populations<-c("pop1","pop1","pop1","pop1","pop1","pop1","pop1","pop2",
"pop2","pop2","pop2","pop2","pop3","pop4","pop3","pop4","pop4")

##skip permutation testing
pn<-pairnei(x, populations, nperm=0)
pn

#Between populations
as.dist(pn$neidist)

#Within populations
diag(pn$neidist)

##Gaps as missing characters.
pn <-pairnei(x, populations, indels="m", nperm=0)
pn

##using subset, third population against others
pn<-pairnei(x, populations, nperm=0,subset=c(3))
pn

## Not run: 
## 999 permutations.
pn<-pairnei(x, populations, nperm=999, showprogbar=TRUE)
pn

## random populations
x<-dna.obj
populations<-sample(1:4,nrow(x),replace=TRUE)
pn<-pairnei(x, populations, nperm=999, showprogbar=TRUE)
pn

## populations based on clusters
x<-dna.obj
d<-distance(x)
hc<-hclust(d,method="ward.D")
populations<-cutree(hc,4)
pn<-pairnei(x, populations, nperm=999, showprogbar=TRUE)
pn

## End(Not run)

### Method for signature 'dist'.
x<-dna.obj
x<-dna.obj[c(1,20,21,26,27,28,30,3,4,7,13,14,15,16,23,24,25),,as.matrix=FALSE]
populations<-c("pop1","pop1","pop1","pop1","pop1","pop1","pop1","pop2",
"pop2","pop2","pop2","pop2","pop3","pop4","pop3","pop4","pop4")
d<-distance(x)
pn<-pairnei(d, populations,nperm=0)
pn

### Method for signature 'matrix'.
x<-dna.obj
x<-dna.obj[c(1,20,21,26,27,28,30,3,4,7,13,14,15,16,23,24,25),,as.matrix=FALSE]
populations<-c("pop1","pop1","pop1","pop1","pop1","pop1","pop1","pop2",
"pop2","pop2","pop2","pop2","pop3","pop4","pop3","pop4","pop4")
d<-as.matrix(distance(x))
pn<-pairnei(d, populations,nperm=0)
pn

haplotypes documentation built on Feb. 28, 2020, 5:08 p.m.