Description Usage Arguments Author(s) References See Also Examples
View source: R/abbababa.xyioStats.R
This function calculates ABBA-BABA statistics 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 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 as follows [x:P3 y:P2 i:P1 o:P4].
1 2 3 | abbababa.xyioStats(tmpSEQ, x.pos, y.pos, i.pos, o.pos, x.freq = 1,
y.freq = 1, i.freq = 1, o.freq = 1, x.name = "x", y.name = "y",
i.name = "i", o.name = "o")
|
tmpSEQ |
|
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.freq |
minimal frequency for population X to keep site [default: 1.0] |
y.freq |
minimal frequency for population Y to keep site [default: 1.0] |
i.freq |
minimal frequency for population I to keep site [default: 1.0] |
o.freq |
minimal frequency for population O to keep site [default: 1.0] |
x.name |
population X name [default: "x"] |
y.name |
population Y name [default: "y"] |
i.name |
population I name [default: "i"] |
o.name |
population O name [default: "o"] |
Kristian K Ullrich
Reich, D., Thangaraj, K., Patterson, N., Price, A. L., & Singh, L. (2009). Reconstructing Indian population history. Nature, 461(7263), 489.
Patterson, N., Moorjani, P., Luo, Y., Mallick, S., Rohland, N., Zhan, Y., ... & Reich, D. (2012). Ancient admixture in human history. Genetics, 192(3), 1065-1093.
Martin, S. H., Davey, J. W., & Jiggins, C. D. (2014). Evaluating the use of ABBA–BABA statistics to locate introgressed loci. Molecular biology and evolution, 32(1), 244-257.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.