dist.xyioStats: dist.xyioStats

Description Usage Arguments Author(s) References See Also Examples

View source: R/dist.xyioStats.R

Description

This function calculates distIUPAC based distances comparing two populations (x: receiver; y: donor) with an ingroup population (i: ingroup) and an outgroup population (o: outgroup). In a four-taxon scenario (((P1,P2),P3),O) with geneflow from P3>>P2, the populations should be defined for deltaMean and deltaMin statistics as follows [x:P2 y:P3 i:P1 o:P4]. Accordingly in the four-taxon scenario (((P1,P2),P3),O) with geneflow from P2>>P3, the populations should be defined for deltaMean and deltaMin statistics as follows [x:P3 y:P2 i:P1 o:P4].

Usage

1
2
3
dist.xyioStats(tmpSEQ, x.pos, y.pos, i.pos, o.pos, x.name = "x",
  y.name = "y", i.name = "i", o.name = "o", dist = "IUPAC",
  ncores = 1)

Arguments

tmpSEQ

DNAStringSet [mandatory]

x.pos

population X positions [mandatory]

y.pos

population Y positions [mandatory]

i.pos

population I positions [mandatory]

o.pos

population O positions [mandatory]

x.name

population X name [default: "x"]

y.name

population Y name [default: "y"]

i.name

population I name [default: "i"]

o.name

population I name [default: "o"]

dist

distance to use, choose one model as in dist.dna or [default: "IUPAC"]

ncores

number of parallel cores to process pairwise distance calculation [default: 1]

Author(s)

Kristian K Ullrich

References

Slatkin, M. (1991). Inbreeding coefficients and coalescence times. Genetics Research, 58(2), 167-175.

Beerli, P. (1998). Structured Populations. Advances in molecular ecology, 306, 39.

Peter, B. M. (2016). Admixture, population structure, and F-statistics. Genetics, 202(4), 1485-1501.

Paradis, E., & Schliep, K. (2018). ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R. Bioinformatics, 35(3), 526-528.

Rosenzweig, B. K., Pease, J. B., Besansky, N. J., & Hahn, M. W. (2016). Powerful methods for detecting introgressed regions from population genomic data. Molecular ecology, 25(11), 2387-2397.

Hahn, M. W., Hibbins, M. S. (2019). A Three-Sample Test for Introgression. Molecular biology and evolution, msz178.

See Also

xyioStats, distIUPAC, rcpp_distIUPAC, dist.dna

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
##Use the 'xyioStats' function to handle population assignment automatically

##load sequence data
data("MySequences", package="distIUPAC")
CAS.pos<-5:34
AFG.pos<-82:87
IRA.pos<-71:78
APO.pos<-1

##Here, one needs to consider the changed x, y and i positions due
##to sub-sampling.
CAS.pos_<-seq_along(CAS.pos)
AFG.pos_<-seq(from=length(CAS.pos_)+1, to=length(c(CAS.pos, AFG.pos)))
IRA.pos_<-seq(from=length(c(CAS.pos, AFG.pos))+1,
to=length(c(CAS.pos, AFG.pos, IRA.pos)))
APO.pos_<-seq(from=length(c(CAS.pos, AFG.pos, IRA.pos))+1,
to=length(c(CAS.pos, AFG.pos, IRA.pos, APO.pos)))

##pairwise deletion
CAS_AFG_IRA_APO.pairwiseDeletion.dist<-distIUPAC(
  as.character(MySequences[c(CAS.pos,AFG.pos,IRA.pos,APO.pos)]))
CAS_AFG_IRA_APO.pairwiseDeletion.xyioStats<-dist.xyioStats(
  CAS_AFG_IRA_APO.pairwiseDeletion.dist, 
  x.pos=CAS.pos_, y.pos=AFG.pos_, i.pos=IRA.pos_, o.pos=APO.pos_,
  x.name="CAS", y.name="AFG", i.name="IRA", o.name="APO")

##global deletion
CAS_AFG_IRA_APO.globalDeletion.dist<-distIUPAC(
  as.character(globalDeletion(MySequences[c(CAS.pos,AFG.pos,
  IRA.pos,APO.pos)])))
CAS_AFG_IRA_APO.globalDeletion.xyioStats<-dist.xyioStats(
  CAS_AFG_IRA_APO.globalDeletion.dist,
  x.pos=CAS.pos_, y.pos=AFG.pos_, i.pos=IRA.pos_, o.pos=APO.pos_,
  x.name="CAS", y.name="AFG", i.name="IRA", o.name="APO")

##compare results
rbind(CAS_AFG_IRA_APO.pairwiseDeletion.xyiStats,
  CAS_AFG_IRA_APO.globalDeletion.xyiStats)

kullrich/distIUPAC documentation built on Jan. 9, 2020, 2:50 p.m.