On the Distribution of Tract Lengths During Adaptive Introgression

Admixture is increasingly being recognized as an important factor in evolutionary genetics. The distribution of genomic admixture tracts, and the resulting effects on admixture linkage disequilibrium, can be used to date the timing of admixture between species or populations. However, the theory used for such prediction assumes selective neutrality despite the fact that many famous examples of admixture involve natural selection acting for or against admixture. In this paper, we investigate the effects of positive selection on the distribution of tract lengths. We develop a theoretical framework that relies on approximating the trajectory of the selected allele using a logistic function. By numerically calculating the expected allele trajectory, we also show that the approach can be extended to cases where the logistic approximation is poor due to the effects of genetic drift. Using simulations, we show that the model is highly accurate under most scenarios. We use the model to show that positive selection on average will tend to increase the admixture tract length. However, perhaps counter-intuitively, conditional on the allele frequency at the time of sampling, positive selection will actually produce shorter expected tract lengths. We discuss the consequences of our results in interpreting the timing of the introgression of EPAS1 from Denisovans into the ancestors of Tibetans.

Admixture-a process wherein genetically distinct populations hybridize and exchange alleles-is increasingly recognized as a dominant force in evolutionary genomics. In particular, admixture has the potential to introduce adaptive alleles from a donor population to a recipient, particularly if the donor population has already adapted to e.g., unique environmental conditions. For example, when the ancestors of modern ethnic Tibetans first colonized the extremely high elevation Tibetan Plateau their success in adapting to these harsh conditions stemmed in part from genes acquired from a Denisovan-like ancestral population (Huerta-Sánchez et al. 2014). More generally, as genome sequence data continues to accumulate, it is increasingly clear that introgression has played a major role in shaping adaptive outcomes across a wide range of species, e.g., (Hufford et al. 2013;Martin et al. 2013). However, the specific genetic signature of adaptive introgression and its impact on patterns of genetic variation remains less explored (but see e.g., (Setter et al. 2019)). There is, therefore, a clear need to develop a theoretical framework to investigate the impacts of adaptive introgression on the genomes of natural populations.
When two ancestral populations hybridize, the genome of each individuals is a mixture of the ancestral populations, and the ancestry at each site in the genome can be traced back to a single population. Because alleles from a given ancestral population are initially on the same chromosomes, and therefore strongly linked within the admixed population, this process can dramatically shape linkage disequilibrium within admixed populations (commonly termed admixture LD (Stephens et al. 1994;Falush et al. 2003)). Admixture LD, and the haplotypic analog, ancestry tracts, which are unbroken stretches of sites from one ancestral population, have become the key elements of genomic inference in studying admixed populations. These two features of genetic variation are the primary units of demographic model inference within admixed populations. For example, the decay of LD (Loh et al. 2013) and the ancestry tract length distribution (Gravel 2012;Corbett-Detig and Nielsen 2017) (Skov et al. 2018) are commonly used for timing the onset of admixture assuming a neutral model during admixture. (Hill 1974;Nielsen, 2014b 2016) showed recombination, genetic drift, and migration processes act as linear operators on the 2-locus and 3-locus linkage disequilibrium coefficients (as defined in (Lewontin and ichi Kojima 1960) and (Slatkin 1972) respectively). In contrast, natural selection is not a linear operator on the LD coefficients, and these approaches can, therefore, not be extended to accommodate the impacts of natural selection. Instead, other methods are required to analyze the impact of selection. A recent study (Sachdeva and Barton 2018) derives the ancestry tract length distribution under an infinitesimal selection model. Such a model assumes that there are many different sites and each of them is under weak selection. However, another potent force that affects admixed populations is adaptive introgression, where one or a few adaptive genes is acquired via hybridization and each has potentially strong effects on fitness. The analysis of adaptive introgression and its impacts on linkage disequilibrium and the ancestry tract length distribution is a largely unexplored topic and requires a novel theoretical framework.
The distribution of tract lengths during adaptive introgression is closely related to the study of the strength of linkage disequilibrium. Two main models that address this question are 2-locus and 3-locus linkage models, which model the joint behavior of 2 and 3 linked loci respectively. Substantial theory and numerical simulations are known from earlier works, e.g., (Kimura 1956;Maynard and Haigh 2007;Thomson 1977;Lewontin and ichi Kojima 1960;Ewens 1968;Karlin and Feldman 1970;Feldman et al. 1974;Karlin and Carmelli 1975;Karlin 1975;Lewontin, 1964a, b;Franklin and Lewontin 1970)). There are two main differences between these works and our approach. The first is the problem itself: in the aforementioned works the object of interest is primarily the strength of LD in different selection scenarios, so all the sites are considered to be segregating in a single ancestral population, and allele frequencies at all the sites affect the strength of LD. In this paper we are instead interested in the length of an admixture tract covering a selected site. The second difference is that aforementioned works consider forward time models, and we consider coalescent models.
There are many other works which have used coalescent theory to study the dynamics of selective sweeps. In particular, (Kaplan et al. 1989) examine how the number of polymorphic sites changes due to selective sweeps using a deterministic logistic approximation to the selected allele frequency trajectory. (Barton 1998) expanded on this by considering the stochastic phase of the allele frequency trajectory when the allele frequency is close to 0 or 1. He showed that conditioning on the selected allele not being lost, its spread in the population is faster than exponential. (Durrett and Schweinsberg 2004) also showed, through simulations, that the logistic approximation performs poorly if the allele frequency is close to the boundaries (0 or 1).
The distribution of ancestry tract lengths around a locus under selection can reveal the strength of selection and the timing of admixture without requiring the assumption of neutrality. In this work, we present an efficient way to calculate the expected ancestry tract length distribution, and we analyze the dependence of this distribution on a range of different biological parameters. In particular, it is evident that for a given admixture proportion, selection results in longer tract lengths of introgressed segments. On the other hand, when conditioning on the allele frequency at the time of sampling, positive selection actually results in shorter ancestry tracts during adaptive introgression.

Conceptual overview
We model the tract length distribution around a selected locus. In other words, we want to find the probability that an ancestry tract ends at a certain distance from the selected locus because of a recombination event within the admixed population. We imagine a stochastic process along the length of the chromosome where transitions between ancestries at a given locus are caused by recombination (at this locus) such that chromosomes on the left and on the right of the recombination site are derived from different ancestral populations. As shown in (Thomson 1977), the strength of linkage disequilibrium between two neutral loci depends on the distance of the region containing those loci from the selected site. Similarly, transition rates between ancestry types are not uniform in recombination units with regards to the distance from the selected site.
Indeed, if a neutral locus is far away from the selected locus, the surrounding genomic region is nearly independent of the impact of selection, and the transitions between the ancestry types should occur almost as expected under neutrality. On the other hand, if a given site is tightly linked to a selected locus, the probability of transitions to a different ancestry would be affected by the allele frequency changes in the selected locus. Because a 2-locus framework cannot model this dependency, it does not provide enough information regarding the local transition rates in genomic regions proximal to a selected site. Instead, in this work, we use a 3-locus model to calculate transition rates between different ancestries in two loci as a function of the distance to a third selected locus.

Selected allele trajectory
Let a denote a locus under selection with two possible alleles A standing for the selected allele and a standing for neutral allele. We are interested in the scenario when allele A is introduced into the population through an adaptive introgression event that includes instantaneous replacement of a given proportion of individuals, the admixture fraction, in the recipient population. Such an introgression event is commonly termed an "ancestry pulse" in related works, e.g., (Gravel 2012;Corbett-Detig and Nielsen 2017). We assume that allele A was fixed in the donor population, and that prior to admixture, allele a was fixed in the recipient population.
The expected trajectory of an allele under selection can be well approximated using a logistic function (see e.g., (Kaplan et al. 1989)) under the following conditions: First, selection should be strong (N e s 1, where N e is effective population size, and s is selection coefficient such that an individual with two selected alleles has fitness 1 þ s and a heterozygous individual has fitness 1 þ s=2). Second, the frequency of the selected allele is above a critical threshold, so in our model, the admixture fraction must not be too small. Finally, the time since adaptive introgression is not too large compared to the selection coefficient, so that the frequency of A is not too close to 1 at the time of sampling (Smith 1971;Messer and Neher 2012).
Approximating the allele frequency trajectory of the adaptive allele using a deterministic logistic trajectory, as in (Kaplan et al. 1989), allows us to avoid integration over the stochasticity caused by genetic drift, which makes our approach similar to the mean field theory widely used in physics (Weiss 1907) and epidemiology (Kermack William Ogilvy and Thomas 1927). We show that this approximation is highly accurate, in a certain range of parameters, for estimating the expected tract lengths. In this range, the expected tract length can be considered invariant under the order of integration over genetic drift and over the tract length distribution.
Outside this range, when the proportion of introgression is very small, which means that drift is strong relative to selection, the logistic function will yield inaccurate predictions. This observation matches that of (Durrett and Schweinsberg 2004). In this case the expected trajectory can be estimated by generating a large random sample of stochastic trajectories. This can be done efficiently, because, in practice, the selection coefficient s 1 is small, and the diploid population can be approximated by a haploid population under genic selection. At each generation the selected allele frequency is simulated from a binomial distribution with probability weighted by the total fitness contributed of the selected allele. We average allele frequencies at each generation over the simulated trajectories (conditioning on observing the selected allele at the time of sampling). We will show that such an approach vastly extends the applicability of our method to cases that require greater stochasticity. In particular, we use it to analyze the Denisovan introgression in the ancestry of Tibetans, where the proportion of introgression is estimated to be as small as 0:06% (Huerta-Sánchez et al. 2014), and therefore is outside the range of parameters where the logistic approximation to the allele frequency trajectory yields accurate results.

3-locus model during adaptive introgression
Let b and g be two neutral loci near a (the locus under selection) so that there are 3 loci on the chromosome: a; b, and g, following each other sequentially in this order on the chromosome. Let r 1 be the distance (in Morgans) between a and b, r 2 is the distance between b and g. We are following the ancestry of b and g. In other words, we track the lineage leading to each locus to the time of introgression, while simultaneously tracking how recombination and coalescence act on the segment. If at the time of introgression the ancestral locus is on a haplotype carrying allele A, then, by definition, its ancestry is from the introgressed population (denoted ancestry type 1). If, in contrast, the ancestral locus is linked to allele a, then it comes from the recipient population (denoted ancestry type 0). Ancestry type 0 corresponds to the recipient population and ancestry type 1 corresponds to the donor population.
The importance of this 3-locus model is that we can calculate transition rates between ancestry types, and hence, we can numerically calculate the distribution of tract lengths of ancestry type 1 (or type 0) near the locus a.

Model derivation
Under the coalescent with recombination, the model can be considered Markovian backward in time, when conditioned on the allele frequency path. To describe the dynamics of the adaptive introgression 3-locus model, we need to enumerate the possible states, which describes the ancestry configurations across the three loci, and we need to find the transition rates between them.
The model has 6 possible states. Each state represents an ancestral configuration for an observed chromosome with three loci: a, b and g. At a we track the allelic state, A or a, which also indicates ancestry. In b and g we only need to know if the given chromosome is ancestral to the observed chromosome or not. We use the notation b a and g a to indicate DNA in b or g that is ancestral to the observed chromosome. b n and g n is used to indicate DNA that is not ancestral to the observed chromosome. The six states are then: • ðA 2 b a 2 g a Þ: ancestral material for the observed chromosome at b and g on a chromosome carrying allele A at the selected locus a, • ðA 2 b a 2 g n ; A 2 b n 2 g a Þ: ancestral material at b and g on different chromosomes, both carrying allele A, • ðA 2 b a 2 g n ; a 2 b n 2 g a Þ: ancestral material at b and g on different chromosomes, and the chromosome ancestral to the observed chromosome at b is carrying allele A, while the chromosome ancestral to the observed chromosome at g is carrying allele a, • ða 2 b a 2 g n ; A 2 b n 2 g a Þ: ancestral material at b and g on different chromosomes, and the ancestral chromosome at b is carrying allele a, while the ancestral chromosome at g is carrying allele A, • ða 2 b a 2 g n ; a 2 b n 2 g a Þ: the ancestral material of b and g are on different chromosomes, both carrying allele a, • ða 2 b a 2 g a Þ: ancestral material at both b and g are on the same chromosome carrying allele a.
We denote the frequency of the selected allele at time t by vðtÞ. As we indicated previously, we assume that vðtÞ deterministically follows a logistic function: because we are working in backward time. This is a reflection of a logistic function relative to t ¼ 0. The time of introgression corresponds to a point, t 1 , on the deterministic allele frequency trajectory such that vðt 1 Þ equals the admixture proportion v 1 . Notice, that the time of sampling t 0 ¼ t 1 2 T, where T is the time since introgression, does not necessarily equal t ¼ 0.
Recombination acts at a rate proportional to the recombination distances between loci. We assume that recombination between loci a and b occurs at rate r 1 and recombination occurs between loci b and g at rate r 2 . In other words, we measure distance between the loci in Morgans.
Consider for example the ancestry configuration state ðA 2 b a 2 g a Þ at time t. If recombination occurs between loci a and b, then ancestral material at loci b and g remain on the same ancestral chromosome. The allele at the site a on this ancestral chromosome will be A with probability vðtÞ (state does not change) and a with the probability 1 2 vðtÞ. Hence, the transition rate from state ðA 2 b a 2 g a Þ to the state ða 2 b a 2 g a Þ is r 1 ð1 2 vðtÞÞ at time t. If a recombination event occurs on a chromosome with configuration ðA 2 b a 2 g a Þ between loci b and g, then it is split into two chromosomes, and there are two different possible ancestry configurations. In both configurations the first ancestral chromosome is A 2 b a 2 g n . The second chromosome is either A 2 b n 2 g a with probability vðtÞ, or a 2 b n 2 g a with probability 1 2 vðtÞ. So, recombinations are the first type of transition in our model. The other type of transition is coalescence, which is possible between chromosomes that carry the same allele (A or a) at the selected locus a at the rate l=vðtÞ for A and l= vðtÞ for a, where l ¼ 1=2N e and 2N e is the haploid effective population size. The full transition rate matrix is where vðtÞ ¼ 1 2 vðtÞ is the allele frequency of allele a, and the equation describing the probability of being at a certain state at time t is ℙ9ðtÞ ¼ ℙðtÞMðtÞ: (1) The initial condition for this differential equation is for the dynamics of introgressed tracts (hence, carrying allele A), and ℙðt 0 Þ ¼ ð0; 0; 0; 0; 0; 1Þ for the tracts from the recipient population (individuals with allele a). Equation 1 cannot be solved analytically, because eigenvalues of the matrix MðtÞ cannot be derived analytically in general. However, it is easy to solve it with standard numerical methods. Our implementation uses scipy.integrate.odeint() (Jones et al. 2001) which is based on lsoda (Hindmarsh 1983) from the FORTRAN library odepack.
Again, we assume that allele a is private to the recipient ancestral population, and allele A is private to the donor ancestral population. To estimate the ancestry of loci b and g, it is necessary to trace the ancestral chromosomes to the time of introgression t 1 .
If ancestral locus appears on a chromosome with allele a (allele A) at that time we conclude that it comes from the recipient population (donor population respectively), hence it has ancestry type 0 (ancestry type 1 respectively). Our goal is to calculate the expected length of the introgression tract containing the locus under selection, i.e., haplotypes with allele A. The fact that the tract ends at a certain position on a genome means that all loci (b) to the left of this position has ancestry type 1 and a loci (g) to the right of this position has ancestry type 0. Moreover, all the loci between a and b have ancestry type 1, and b and g are infinitesimally close to each other. The mathematical derivation of this idea is in the next subsection. We also note that this process is a type of of Sequentially Markov Coalescent (SMC) model (McVean and Cardin 2005) which considers two Markovian process: backward-in-time coalescent process and along-the-genome Markov chain which generates recombination breakpoints.
Transition rates between ancestry of type 0 and type 1 As previously discussed, we are interested in transitions of ancestry in loci near the introgressed selected allele. More precisely, we seek the distribution of lengths of ancestry tracts that contain A, i.e., the set of ancestry tracts with ancestry type 1 at the selected site. In the given model the probability that a locus is of ancestry type 1 or type 0 is equal to the probability that the ancestral chromosome carries the allele A or a respectively at time of introgression t 1 . In the previous subsection we described a Markovian process (with regards to the backward time) under which we can calculate those probabilities. Now we consider a new Markov process, which describes the ancestry at a locus while moving along the chromosome away from the selected locus. The process is only approximate because the real process along the length of the chromosome is not Markovian. The states of this Markov process are again ancestries of type 0 or 1. By definition, transition rate between states s 1 and s 2 at position r of a Markov process SðrÞ is t s 1 ;s 2 ðrÞ ¼ lim The transition rate is t 10 ðrÞ between ancestries of type 1 and type 0, which corresponds to recombination breaking the introgressed ancestry tract, is The numerator PðSðr þ drÞ ¼ 0; SðrÞ ¼ 1Þ is the probability of being at the third state ðA 2 b a 2 g n ; a 2 b n 2 g a Þ, and the denominator PðSðrÞ ¼ 1Þ is the marginal probability of ancestry type 1, hence it is the sum of probabilities of the first three ancestral configurations ðA 2 b a 2 g a Þ, ðA 2 b a 2 g n ; A 2 b n 2 g a Þ and ðA 2 b a 2 g n ; a 2 b n 2 g a Þ. Expression 2 is easy to evaluate numerically by considering sufficiently small values of r 2 .

Model validation
In order to estimate how accurate our deterministic approximation is, we compared our results with the average tract length estimated from simulations using the forward-in-time simulation framework SELAM (Corbett-Detig and Jones 2016). Briefly, we used the software to simulate a Wright-Fisher population of constant size 5000 hermaphroditic diploid individuals. We simulated a single chromosome of length one Morgan with a single selected site at position 0.5 Morgans.
At each sampling point, we extracted 50 individuals (100 chromosomes) at random from within the population and output the ancestry across each chromosome. We performed 10 to 100 thousand replicates of each combination of selective coefficient, times since admixture and admixture proportion.

Data availability
The authors state that all data necessary for confirming the conclusions presented in the article are represented fully within the article. The code is available at the GitHub repository associated with this project https://github.com/vlshchur/DAIM.

Accuracy of deterministic approximation
We simulate both relatively weak and strong selection, and we allow selection to act in different periods of time. We mostly explore the accuracy through the comparison of expected tract length and its variance. We also present the distribution of break-points of tracts containing selected allele. The tract length is the sum of two independent random variables, one representing the distance to the left of the selected mutation and the other representing the distance to the right of the selected mutation. As the waiting time to a recombination event along the length of the genome is exponentially distributed, one might be inclined to think that tracts lengths also are exponentially distributed. However, this is not the case as illustrated in Figure 1. The figure shows the distribution of the distance from the selected locus to one end of the tract, estimated from simulations, from the deterministic vðtÞ 2 r 2 r 2 vðtÞ r 2 vðtÞ 0 0 r 1 vðtÞ l=vðtÞ 2l=vðtÞ 2 ð2r 1 þ r 2 Þ vðtÞ ðr 1 þ r 2 Þ vðtÞ r 1 vðtÞ 0 0 0 ðr 1 þ r 2 ÞvðtÞ 2r 1 2 r 2 vðtÞ 0 r 1 vðtÞ 0 0 r 1 vðtÞ 0 2r 1 2 r 2 vðtÞ ð r 1 þ r 2 Þ vðtÞ 0 0 0 r 1 vðtÞ ðr 1 þ r 2 ÞvðtÞ 2l= vðtÞ 2 ð2r 1 þ r 2 ÞvðtÞ l= vðtÞ r 1 vðtÞ 0 0 r 2 vðtÞ r 2 vðtÞ 2r 1 vðtÞ 2 r 2 approximation, and an exponential distribution with the rate equal to the inverse of the mean of the simulated distribution. In this scenario, the approximation provides an accurate estimate of the empirical distribution. The exponential distribution provides a much worse fit. The reason why the exponential distribution fits so poorly is that it does not incorporate the possibility of back-recombination and coalescence. In the presence of these processes, the tract length distribution is not exponential (see also (Liang and Nielsen, 2014a) for more discussion of this). In all of the scenarios that we explored, the relative error does not exceed 5%, and in more than half of all cases it is within 2% (Tables 1  and 2). This level of precision should be sufficient for most applications given that the uncertainty in the real data analysis is usually much greater than the error of the approximation model.
As previously discussed, the logistic function is a good approximation for the allele frequency trajectory only when selection is strong. Still, we wondered if the deterministic approach would give consistent results for a case of neutral admixture without adaptive introgression. Following Liang, Nielsen (Liang and Nielsen, 2014a) the expected tract length under a neutral admixture model can be calculated as under the SMC' model (Marjoram and Wall 2006). Notice that there is a factor of two in the numerator due to the fact that we condition on observing the introgressed allele on a haplotype. We find that in the limiting case of no selection, the approximation closely approximates the analytical result from (Liang and Nielsen, 2014a) (Table 3). Another case where the logistic function is not expected to be a good approximation of the mean trajectory, is when the admixture proportion is close to zero. To explore this issue, we chose a set of parameters, which are similar to Neanderthal introgression into non-Africans (2.5%), and to the Denisovan introgression into Tibetans (0.06%). We found that the logistic approximation performs poorly for the Denisovan-like scenario, and is not very accurate (up to 10% relative error) for the Neanderthal-like introgression with week n■ Table 1 The accuracy of the deterministic approximation for the expected tract length under adaptive introgression compared to estimates from simulations. For every set of parameters (introgression fraction, selection coefficient, and time of introgression), we performed 10 5 replicate= simulations. The haploid effective population size was 10,000 chromosomes, with 100 chromosomes sampled from each population. The relative error was calculated by comparing the simulated expected tract length to the prediction given by the deterministic model.

Introgression parameters
Expected tract length selection (s ¼ 0:001); in particular, the predicted allele frequency is strongly underestimated. Presumably these discrepancies reflect the increased impacts of genetic drift for small admixture proportions. To address this issue, we estimated the expected trajectory by forward-intime stochastic simulations of a large sample of possible allele frequency trajectories (see subsection Selected allele trajectory for details). The stochastically estimated expected trajectory is then used instead of the logistic function in Equation 1 to model the tract length distribution. The deterministic model (with numerically pre-computed expected trajectories) gives tract length estimates quite similar to those observed in the simulated data sets (Table 2).

Variance
The variance in the tract length distribution predicted by our method is an accurate approximation of the across population variance, that is, the variance among all the tracts obtained in many replicates with the same parameters (see Table 4). This is equivalent to the variance in tract length among tracts within a population if the tracts introgressed into the population independently of each other and have not coalesced or recombined with each other. Of course, in reality, two tracts might coalesce before the time of introgression, so their lengths are not independent of each other. Hence, we expect that the withinpopulation variance is smaller than across-population variance. On the other hand, if introgression is recent enough, then the chance of coalescence is small, and the correlation between tract lengths within population will be small. Indeed, for most of the scenarios with 50 and 100 generations since the time of introgression ( Table 4) the variances of the tract lengths are similar. For larger times, the across-populations and within-population variance are different by up to 20%, reflecting the increased probability of coalescence among selected haplotypes that share a recombination event within the admixed population.

Run time
Calculation of the expected tract length for 100 introgression scenarios takes just 106 sec for a Python implementation executed on MacBook Pro (2.9 GHz Intel Core i5) when using the logistic function to approximate the allele frequency trajectory. Transition rates are n■ Table 2 The accuracy of the deterministic approximation for the expected tract length under adaptive introgression compared to the estimates from simulations for numerically estimated trajectory. For scenarios with relatively small admixture fractions (v 1 = Proportion = 0.0006), the logistic function does not accurately describe the allele frequency trajectory, so we numerically estimated the mean trajectory using stochastic simulations. The relative error is for the deterministic approximation with numerically estimated trajectories relatively to the simulation estimates.

Introgression parameters
Expected tract length

Dependence of mean tract length on different parameters
The deterministic approach facilitates the calculation of expected tract lengths for a wide array of parameters. In Figure 2 we illustrate the dependency of the mean tract length on the admixture fraction given the time of introgression and selection coefficient. As expected, a larger admixture fraction results in longer expected tract lengths. In Figure 3 we illustrate the dependency on the selection coefficient given the time of introgression and admixture proportion. Again, stronger selection results in longer expected ancestry tract lengths. The strength of selection has a stronger effect on the expected tract length than the admixture proportion. For example, consider an adaptive introgression model with time T ¼ 1000, selection coefficient s ¼ 0:01 and admixture proportion 0.025. The expected tract length is 0.0025 Morgans under this model. If we double the admixture proportion to 0.05, the expected tract length increases to 0.0029 Morgans, or approximately 13%. If on the other hand we increase the strength of selection by a factor of two, then the expected tract length increases by 41% and becomes 0.0036 Morgans.
The new approximation facilitates investigation of another important dependency, which would otherwise require prohibitively large numbers of simulations, namely the dependency of the expected tract length on the observed allele frequency. In Figure 4 we demonstrate that conditioning on the allele frequency at the time of sampling, stronger selection actually reduces the expected tract length. This is explained by the fact that stronger selection decreases (going backward in time) the allele frequency faster than weaker selection. Hence, the probability of recombining back to a haplotype that contains the selected allele following a recombination event is smaller for scenarios with stronger selection. More formally, assume that we compare two scenarios with selection coefficients s 1 and s 2 (all other parameters are the same), and that s 1 , s 2 . Let v ðiÞ be the logistic trajectory for selection coefficient s i . We condition on the observed allele frequencies at time t 0 , hence v ð1Þ ðt 0 Þ ¼ v ð2Þ ðt 0 Þ. Ancestral recombination occurs on a chromosome independent of the strength of selection. Assume that recombination occurred at time t r . t 0 . The expected allele frequency at time t r , which is defined by the logistic function, is larger for the smaller selection coefficient: n■ Table 4 Simulated across and within population variance and the across population variance estimated from the deterministic model. The percents show the relative error of the deterministic approximation compared to the simulations both for across and within population values. The introgression with 0.0006 (or, 0.06%) admixture proportion was chosen to approximate Denisovan introgression into Tibetans. The introgression with 0.025 (or, 2.5%) admixture proportion was chosen to approximate Neanderthal introgression into non-Africans.

Introgression parameters
Standard deviation of tract length v ð1Þ ðt r Þ . v ð2Þ ðt r Þ. Hence, the chance that the remaining part of the chromosome coalesces back to a haplotype that contains the selected allele is higher for s 1 .

Denisovan introgression into Tibetans
A well-known example of adaptive introgression is Denisovan introgression into Tibetans which facilitated altitude adaptation by introducing an adaptive allele of EPAS1 affecting red blood cell production into the ancestors of modern Tibetans (Yi et al. 2010;Huerta-Sánchez et al. 2014). We wondered how selection might affect estimates of the time of introgression, conditioning on the presentday allele frequency of EPAS1 of 85% (Huerta-Sánchez et al. 2014) and an overal genomic admixture proportion of v 1 ¼ 0:0660:03% (Sankararaman et al. 2016). The admixture proportion is very small, and the logistic function will therefore be quite inaccurate. For a range of values of selection coefficient (s ¼ 0:005; 0:006; . . . ; 0:02), we numerically estimated the expected trajectories (using the stochastic trajectory simulator) for the given admixture proportion. Given the frequency of the adapted allele in the modern population, the time since introgression is estimated as the time needed for the allele to reach this observed allele frequency following the expected trajectory.
We summarize the dependency of the introgression time on the strength of selection in Table 5 for the mean value v 1 ¼ 0:06%. It is clear from the table that dating the time of introgression from the tract length under the hypothesis of neutrality, would cause underestimation of the time of introgression by about 20 2 25%. For example, if the estimated tract length is 0.00117 Morgans, the corresponding introgression time without selection affecting the allele frequency is 1791 generations, or about 45000 years. However, taking selection into account, this tract length corresponds to selection coefficient s ¼ 0:006 and an introgression time of 2282 generations, or 57000 years ago. Therefore, analyses that seek to understand the timing of introgression events of adaptively introgressed alleles will be greatly facilitated by incorporating the dependency on the strength of selection on the expected tract length distribution. The best option for providing bounds for the time of introgression of single tracts, if these tracts cannot be assumed to be part of a larger introgression pulse that included other fragments, would be to jointly estimate the introgression time, the selection coefficient, and the time of introgression, using tract length, allele frequency, and other information such as local haplotype homozygosity and/or local genealogical information.

DISCUSSION
Adaptive introgression is an important and common phenomenon in evolutionary genetics (Hedrick 2013). In this paper we derived an accurate approximation model for the ancestry tract length distribution under adaptive introgression, near a selected site, with a single admixture pulse. This framework facilitated calculations of the distribution of tract lengths under a range of plausible adaptive introgression scenarios. However, we emphasize that future work should consider additional demographic models including continuous migration or multiple pulses. We demonstrated, perhaps counter-intuitively, that conditioned on the observed allele frequency, stronger selection produces shorter admixture tracts. Furthermore, as an example, we showed that selection should be taken into account when dating the well-known case of altitude adaptation in Tibetans through the introgression of EPAS1 gene from Denisovans. When ignoring the impacts of selection, the time since introgression might be underestimated by as much as 20-25% if conditioning on the allele frequency. If the allele frequency is allowed to be random, the effect would be opposite. Our results illustrate that selection should be carefully considered and incorporated when studying adaptive introgression events. More generally, this framework opens new possibilities for understanding the timing of admixture and the strength of adaptive introgression across a wide range of populations. Our work therefore lays the groundwork for the development of new inference frameworks that  can detect adaptive introgression using tract lengths and allele frequencies. Particularly, in light of the fact that adaptive introgression is common historically, and may be accelerated in the future by anthropogenic impacts such as climate change, e.g., (Muhlfeld et al. 2014), developing a strong theoretical basis for understanding the impacts of adaptive introgression on patterns of genetic variation is crucial for interpreting the genomic consequences of admixture.
n■ Table 5 The effect of assumptions regarding the strength of selection on estimates of the time of the Denisovan introgression into Tibetans for EPAS1. We assume an initial introgression fraction of 0.06% (Sankararaman et al. 2016), and a present-day allele frequency for the EPAS1 allele of 85% in Tibetans (Huerta-Sánchez et al. 2014). Under deterministic approximation, the value of the selection coefficient then determines the time of introgression needed for the allele to reach the observed allele frequency at the time of sampling (present time). We calculate the expected length of introgressed Denisovan tracts overlapping EPAS1 allele for each such scenario. In the column "expected tract length (no selection)" we show the expected tract length for the given introgression proportion and time since introgression under hypothesis of no selection using formula 3. The last column shows the relative difference between the expected tract length estimated while taking into account selection and while ignoring it.

Selection
Time (