- Software
- Open Access

*AFLPsim*: an R package to simulate and detect dominant markers under selection in hybridizing populations

- Francisco Balao
^{1, 2}Email author and - Juan Luis García-Castaño
^{1}

**10**:40

https://doi.org/10.1186/1746-4811-10-40

© Balao and García-Castaño; licensee BioMed Central. 2014

**Received:**24 July 2014**Accepted:**24 November 2014**Published:**13 December 2014

## Abstract

### Background

In spite of a large diversity of approaches to investigate loci under selection from a population genetic perspective, very few programs have been specifically designed to date to test selection in hybrids using dominant markers. In addition, simulators of dominant markers are very scarce and they do not usually take into account hybridization.

### Results

Here, we present a new, multifunctional, R package for dominant genetic markers, *AFLPsim*. This package can simulate dominant markers in hybridizing populations and implements genome scan methods for detecting outlier dominant loci in hybrids. In addition, it includes tools for further manipulating the results, plotting them and other tasks. We describe and tabulate the major functions implemented in *AFLPsim*. In addition, we provide some demonstration of its use and we perform a comparative study with other software. Finally, we conclude by briefly describing the input and output formats.

### Conclusions

The R package *AFLPsim* application provides several useful tools in the context of hybridization studies. It can simulate dominant markers in hybridizing populations and predict their demographic evolution. In addition, we implement a new genome scan method for detecting outlier dominant loci in hybrids, which shows a rather high sensitivity and is very conservative in comparison with Gagnaire *et al*.’s, Bayescan and *introgress*. The application is downloadable at http://cran.r-project.org/web/packages/AFLPsim/.

## Keywords

- Demographic simulation
- Dominant markers
- Genome scan
- Hybridization
- Outlier loci
- R package

## Background

The study of natural hybridization has been the focus of much attention in Evolutionary Biology [1, 2]. Hybridization has recently been perceived as a catalyst not only for speciation but also for major evolutionary innovations [3]. Hybrid zones offer a “window on the evolutionary process” involving divergence at many loci by a balance between dispersal and selection [4]. Cline theory has provided a conceptual framework to understand the forces maintaining hybrid zones and to help infer the relevant evolutionary parameters describing the introgression of traits across hybrid zones [5]. However, in non-stable hybrid zones, selection in early generations has a central role in the establishment and fate of hybrids and progenitors [1, 4]. In these early generations, several hybrid categories can be easily distinguished (first generation hybrids –F_{1}–, outcrosses between F_{1} individuals –F_{2}–, or backcrosses to parental “A” –BxA– and backcrosses to parental “B” –BxB–, for instance). Hence, identifying markers under selection on these early-generated hybrids can provide tremendous knowledge about the stability of hybrid zones.

Although next generation sequencing (NGS) has transformed our ability to identify the genes underpinning selection/adaptation [6], a complementary approach with potentially neutral markers such as Amplified Fragment Length Polymorphisms (AFLPs) allows a cost-effective screening of the genomes of a large number of individuals [7]. AFLP has been very successfully used in the identification of hybrids [8, 9] and outlier loci presumably under selection [10–12]. However, in spite of a large diversity of approaches to investigate loci under selection from a population genetic perspective [13–15], no program has been specifically designed to date to test selection in hybrids using dominant markers. Nevertheless, genomic clines have been used to identify molecular markers with patterns of introgression inconsistent with neutrality (e.g. *introgress*[16, 17]). However, detecting outliers in a hybridizing framework using dominant markers can be a real challenge. Long periods of time are needed to identify loci that have experienced a history of weak selection, as cumulative effect is necessary to produce a detectable signal in the DNA polymorphism of the underlying loci [18]. Therefore, for hybrids in early generations, loci under weak selection would remain undetectable. In addition, dominance imposes difficulties to estimate allelic frequencies, especially when the frequency of the presence-allele is high [19]. Scoring errors and a low sample size can also affect the correct estimate of the allelic frequencies. Furthermore, previous methods used to detect dominant loci under selection have shown a substantial proportion of false positives among the detected outliers [20]. Hence, genome scan in hybrid zones should be capable to correctly estimate expected allelic frequencies under neutrality in hybrids overcoming these problems. Moreover, it should be sensitive enough to detect loci under moderate selection as well as keeping the false positive rate close to null.

Additionally, being able to simulate dominant markers in a hybrid zone is important to obtain a better knowledge about expected patterns of hybridization. When experimental treatments are not feasible, in-silico simulations have been widely used to test population genetic hypotheses [21]. Furthermore, genetic simulations have been also used to understand the statistical efficiency of several genetic methods and to compare different approaches [20]. Finally, simulations are of practical use when analysing data from a real system, as they can compare observed genetic distributions with the theoretically expected ones. In spite of its importance, simulators of dominant markers are very scarce [22] and they do not usually take into account hybridization, but see [23]. Again, dominance of markers is one of the major problems in the simulation process, as allele frequencies have to be estimated from phenotypic data.

Here, we describe *AFLPsim*, a software package designed to overcome these limitations by implementing a dominant marker simulator of hybridization and two genome scan algorithms (Gagnaire *et al*.’s [11] and a new method called bal&gar-ca) specifically designed to detect outlier markers in recent generated hybrids (F_{1}, F_{2}, BxA and BxB). The software is written in a statistical, open source, scripting R language [24], and released under the GPL license to guarantee the continuing availability of the source code.

## Implementation

*AFLPsim*library is shown in Table 1. These functions cover methods in simulation, genome scan, and manipulation and visualization of results, which are detailed below. More details can be found in the software manual, which is available at https://github.com/fbalao/AFLPsim.

**Functions of the**
AFLPsim
**package**

Function name | Description |
---|---|

| |

demosimhybrid | conducts demographic analysis in hybrid populations. |

hybridize | generates multilocus dominant hybrids individuals from parental profiles. |

hybridsim | generates multilocus dominant parental and hybrid individuals. |

| |

bayescan | calls Bayescan 2.1 program [12] from R to a set of populations. |

gscan | conducts genome scan on F |

hybridindex | estimates the hybrid index calling the |

| |

plot.hybridsim | plots phenotypic frequencies of hybrids on a neutral hybridization model. |

plot.demosimhybrid | plots results of ‘demosimhybrid’ function. |

| |

sim2adegenet | converts simulation to the |

sim2arlequin | writes the input file for Arlequin[26] from the simulation results. |

sim2bayescan | writes the input file for Bayescan[12] from the simulation results. |

sim2popgene | writes the input file for Popgene[27] from the simulation results. |

sim2introgress | converts simulation to the |

sim2newhybrids | writes the input file for Newhybrids[8] from the simulation results. |

sim2structure | writes the input file for Structure[28] from the simulation results. |

### Simulating hybridization and demographic evolution

_{1}, F

_{2}and backcrosses in both directions). Observed frequencies can be calculated from simulated parental populations with the ‘hybridsim’ function (following a beta distribution – [25]) or from two user-specified parental phenotypes (‘hybridize’ function), being the allele frequencies of dominant markers calculated using a square-root procedure [19]. For the F

_{1}hybrids the expected phenotypic frequency of each band is

*p*

_{A}is the frequency of the presence-allele in the parental population A:

and *p*_{B} is the frequency of the presence-allele in the parental population B (${p}_{\mathrm{B}}=1\phantom{\rule{0.25em}{0ex}}-\phantom{\rule{0.25em}{0ex}}\sqrt{1\phantom{\rule{0.25em}{0ex}}-\phantom{\rule{0.25em}{0ex}}\mathit{frequency}\phantom{\rule{0.25em}{0ex}}\mathit{of}\phantom{\rule{0.25em}{0ex}}\mathit{the}\phantom{\rule{0.25em}{0ex}}\mathit{band}}$).

*s*), which ranges from -1 to +∞. This coefficient is 0 when there is no selection and it varies following negative and positive directional selection (negative and positive values, respectively). The expected frequency is calculated with the formula

*w*is the ‘fitness’ , which relates to the selection coefficient (

*s*) through the equation

Users can choose both the intensity of this coefficient (*s*) and the number of markers under selection.

_{1}, F

_{x}and backcrosses (with both parentals) individuals for each generation. The contribution of each taxon following admixture and hybridization depends on three independent variables: (1) the initial proportion of parental taxa; (2) the fitness gradient among parental and hybrid taxa; and, (3) the assortative mating between these taxa. Composition at any time (

*t*, in generations) is calculated by multiplying its initial abundance by its relative fitness, and then, by the probability of mating, using the general equations 6 & 7.

*S*

_{ G }is the proportion of a taxon

*G*surviving to reproduction,

*ϕ*

_{ t }is the frequency, before selection, of the taxon at the beginning of the generation

*t*, and

*ω*

_{ G }is its fitness. The expected contribution of a taxon to the subsequent generation is determined by the equation

where *M* is the assortative mating matrix.

Epifanio & Philipp’s model suffers from several pitfalls, e.g. migration is not taken into account and it is not spatially explicit [26, 28]. However, it has been successfully used to explain the extinction of progenitors in several hybrids zones [28, 29].

### Genome scan

*AFLPsim*performs two approaches for statistically seeking outlier loci (‘gscan’) in different hybrid classes (F

_{1}and backcrosses). The first one, called ‘gagnaire’ [11] is based on a binomial test to assess any significant deviation between the observed and the expected frequencies for each marker. Briefly, Gagnaire

*et al*.’s method estimates the frequency of the presence-allele based on one minus the square-root of the absence (null homozygote) frequency (Eq. 2). Therefore, using these parental frequencies (

*f*

_{ A }and

*f*

_{ B }), expected band presence frequencies are then calculated for each hybrid category with the Eq. 1 (for F

_{1}individuals) and the derived ones (e.g., Eq. 3). A binomial test is then performed to test for significant deviation between observed and expected frequencies of band presence at each locus in each hybrid category. For example, for F

_{1}individuals:

where ${f}_{O{F}_{1}}$ is the observed frequency of band presence at one locus, ${n}_{{F}_{1}}$ is the number of F_{1} hybrids and ${f}_{{F}_{1}}$ is the expected frequency of band presence at that locus.

*f*

_{ A }and

*f*

_{ B }) can be biased by sampling error. For this reason, we implement a more conservative method (bal&gar-ca) calculating parental frequencies for each marker through √(1 -

*α*) confidence intervals (in this case,

*α*= 0.05) by the Clopper-Pearson ‘exact’ procedure, which is based on a beta distribution [30]. Every combination of one interval end from one parental and one interval end from the other parental lead to an expected value within the neutral expectation surface, and the four values delimit a 1 -

*α*probability portion of it.

*p*

_{ LEA },

*p*

_{ UEA },

*p*

_{ LEB },

*p*

_{ UEB }), and applying the Eq. 1, we finally obtain the four estimated values of the expected frequency of the presence-allele for F

_{1}under neutrality ($\mathit{fL}{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}\mathit{fL}{U}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{U}_{{F}_{1}}$). For instance:

- (i)If it is within the two most extreme values, we conclude the fragment is not under selection (i.e. $P\left({f}_{O{F}_{1}}=\phantom{\rule{0.25em}{0ex}}{f}_{{F}_{1}}\right)=1$).$\mathrm{If}\phantom{\rule{0.5em}{0ex}}{f}_{\mathit{min}}<\phantom{\rule{0.25em}{0ex}}{f}_{O{F}_{1}}<\phantom{\rule{0.25em}{0ex}}{f}_{\mathit{max}}\phantom{\rule{0.5em}{0ex}}\mathrm{then}\phantom{\rule{0.5em}{0ex}}P\left({f}_{O{F}_{1}}=\phantom{\rule{0.25em}{0ex}}{f}_{{F}_{1}}\right)=1$$\begin{array}{l}\mathrm{where}\phantom{\rule{0.5em}{0ex}}{f}_{\mathit{max}}=\mathit{max}\left\{\mathit{fL}{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}\mathit{fL}{U}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{U}_{{F}_{1}}\right\}\phantom{\rule{0.5em}{0ex}}\mathrm{and}\phantom{\rule{0.25em}{0ex}}\\ {f}_{\mathit{min}}=\mathit{min}\left\{\mathit{fL}{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{L}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}\mathit{fL}{U}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}fU{U}_{{F}_{1}}\right\}\end{array}$
- (ii)If not, we choose the closest of the four frequencies to be the expected value of the binomial test.$\mathrm{If}\phantom{\rule{0.5em}{0ex}}{f}_{O{F}_{1}}>{f}_{\mathit{max}}\phantom{\rule{0.5em}{0ex}}\mathrm{then}\phantom{\rule{0.5em}{0ex}}P\left({f}_{O{F}_{1}}={f}_{{F}_{1}}\right)~\phantom{\rule{0.25em}{0ex}}B\left({f}_{O{F}_{1}}\times \phantom{\rule{0.25em}{0ex}}{n}_{{F}_{1}},{n}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}{f}_{\mathit{max}}\right)$$\mathrm{If}\phantom{\rule{0.5em}{0ex}}{f}_{O{F}_{1}}<{f}_{\mathit{min}}\phantom{\rule{0.5em}{0ex}}\mathrm{then}\phantom{\rule{0.5em}{0ex}}P\left({f}_{O{F}_{1}}={f}_{{F}_{1}}\right)~\phantom{\rule{0.25em}{0ex}}B\left({f}_{O{F}_{1}}\times \phantom{\rule{0.25em}{0ex}}{n}_{{F}_{1}},{n}_{{F}_{1}},\phantom{\rule{0.25em}{0ex}}{f}_{\mathit{min}}\right)$

In both methods, the False Discovery Rate (FDR) correction is used to counteract for multiple comparisons and control for the expected proportion of the incorrectly rejected null hypotheses.

In addition, we also include a function that calls the Bayescan program [13] from R to perform a Bayesian estimation of selection; in this way, we facilitate the analysis and plotting of results of this efficient software. Moreover, the hybrid index (i.e. the genome-wide admixture) for the simulated hybrid individuals is calculated with the ‘hybridindex’ function. The maximum likelihood estimates (together with the 95% confidence intervals) of this hybrid index can be obtained with this function, which is a wrapper for the ‘est.h’ function of the package *introgress*[17].

### Data manipulation and visualisation

*AFLPsim* functions do not require external input files out of the R environment (Table 1). However, for the simulation of hybrids from user-specified parental data, these should be loaded to R as a *matrix* or a *data.frame*. Simulation results can be readily used by multivariate and phylogenetic methods of other R packages (e.g. *ade4*[31]; *adegenet*[32]). Our package is also able to export Arlequin formatted data [33] and Popgene[34] to estimate summary statistics (e.g. *F*-statistics, Shannon index or polymorphic loci) from the data set. Our package is also able to export data formatted for several popular population genetic computer programs such as Structure[35] and Newhybrids[9]. In addition, *AFLPsim* contains functions that produce graphics for visualising the expected frequencies under neutrality for loci under selection across the different hybrid classes. Finally, our package includes a function that plots the results of the demographic evolution model in a hybrid zone.

## Results and discussion

To demonstrate the capacities of *AFLPsim*, we assessed some comparisons on the behaviour of our genome scan method vs. that of other software. We have also created several illustrative examples, which can be easily reproduced. An example of the application of *AFLPsim* for investigating introgression patterns (bal&gar-ca method) and demographic dynamics (Epifanio & Philipp’s model) in a hybrid zone can be found in [28].

### Genome scan comparisons

We investigated the performance of our method (bal&gar-ca) under different scenarios using a simulation study and its efficiency was compared with that of Gagnaire *et al*.’s, Bayescan and *introgress*. Although Bayescan is not specifically designed for hybrids, we used it for comparison, as it is one of the most popular genome scan software. In this case, we used both parentals and F_{1} hybrids as three independent populations. *introgress* has been used to explore introgression between genomes through the genomic cline method. This method is able to identify those molecular markers with introgression patterns inconsistent with neutrality and, therefore, detecting possible loci under selection.

We performed three different simulation experiments to compare the outlier detection efficiency of different genome scan methods, different selection coefficients, different sample sizes and different percentage of selected loci in the genome. We carried out all the simulations on the University of Oslo Bioportal (http://www.bioportal.uio.no) using the ‘hybridsim’ function.

*1) Comparison of different genome scan methods*

We compared the results obtained with four methods (bal&gar-ca, Gagnaire *et al*.’s, *introgress* and Bayescan), with three selection coefficients (*s* = 2.162, log (*s* + 1) = 0.5, weak selection; *s* = 99, log (*s* + 1) = 2, strong selection; *s* = 999, log (*s* + 1) = 3, very strong selection). 100 F_{1} hybrid individuals were simulated with ‘hybridsim’ from two parental populations (A and B) of 100 individuals each one. We simulated 1000 independent loci (i.e. based on linkage disequilibrium), where 100 were introgressed under directional selection in the F_{1}. Every scenario (i.e. every selection coefficient) was replicated 100 times. Genome scans were performed on simulations with our method (bal&gar-ca), that by Gagnaire *et al*., *introgress* and Bayescan 2.1, assessing the ability of each one for detecting selection of different intensities as well as the proportion of failures as false positives.

*et al*. [11] and

*introgress*; on the other hand, Bayescan almost invariably failed to detect outliers for the simulated datasets (Table 2). However, our method had a null false positive rate unlike Gagnaire

*et al*.’s and

*introgress*(~15% and ~13% false outlier detection, respectively).

**Summary of sensitivity (true positive rate ± SD) and type I error rate (false positive rate ± SD) for outlier methods tested with 100 simulated data for three regimes of divergent selection**

Method | Weak selection (s = 2.162) | Strong selection (s = 99) | Very strong selection (s = 999) | |||
---|---|---|---|---|---|---|

Sensitivity | Type I error | Sensitivity | Type I error | Sensitivity | Type I error | |

bal&gar-ca | 0.124 ± 0.039 | 0.000 ± 0.000 | 0.479 ± 0.050 | 0.000 ± 0.000 | 0.487 ± 0.049 | 0.000 ± 0.000 |

Gagnaire | 0.572 ± 0.052 | 0.147 ± 0.012 | 0.621 ± 0.048 | 0. 149 ± 0.012 | 0.619 ± 0.049 | 0.147 ± 0.013 |

| 0.454 ± 0.034 | 0.127 ± 0.015 | 0.717 ± 0.061 | 0.126 ± 0.010 | 0.723 ± 0.052 | 0.128 ± 0.014 |

Bayescan | 0.025 ± 0.021 | 0.029 ± 0.001 | 0.035 ± 0.019 | 0.012 ± 0.004 | 0.080 ± 0.019 | 0.037 ± 0.005 |

*2) Impact of different scenarios on outlier detection*

In the second approach we compared specifically our method with Gagnaire *et al*.’s and we tested the effect of the sampling bias, selection coefficient and percentage of loci under selection on the detection of outliers. A range of possible scenarios were run regarding: (i) different parental sampling sizes (3, 5, 10, 30, 50, 100, 300, 500 and 1000 individuals, from the original populations of 1000 individuals each) for a *s* = 99 [log (*s* + 1) = 2]; (ii) different values of the selection coefficient (-0.999, -0.990, -0.900, -0.684, 0.000, 2.162, 9.000, 99.000 and 999.000; equivalent to log (*s* + 1) values of -3.00, -2.00, -1.00, -0.50, -0.25, -0.10, -0.05, 0.00, 0.05, 0.10, 0.25, 0.50, 1.00, 2.00 and 3.00, respectively) with a parental sampling of 100 individuals each (from the original populations of 1000 individuals each); (iii) different proportions of selected loci from the 1000 simulated ones (0.0%, 0.5%, 1.0%, 5.0% and 10.0%). Every scenario was replicated 100 times.

*et al*.’s. However, the bal&gar-ca method had a null false positive rate unlike Gagnaire

*et al*.’s (~15% false outlier detection). Regarding the sampling bias (affecting the estimates of parental frequency), although the sensitivity (Figure 1a) of the bal&gar-ca method is specially lower than Gagnaire

*et al*.’s at low sample sizes (i.e. with a high deviation in the parental frequency estimates), in these cases Gagnaire

*et al*.’s suffers from a much higher false positive rate (Figure 1b). Both methods behave in a similar way in relation to varying selection coefficients and percentage of selected loci (Figure 1c–f). In our simulation, the sensitivity of both methods decreases at low values of the selection coefficient. Although detection of loci under selection becomes null in the bal&gar-ca method, its rate of false positives is null as well. Otherwise, the type I error rate of Gagnaire

*et al.*’s method remains about 15% regardless of the selection coefficient values. Lastly, the mean rates of true and positive values obtained by both methods are not affected by the percentage of selected loci (Figure 1e–f). However, when the percentage of selected loci increases, the standard deviation of the sensitivity values decreases.

*3) Effect of the frequency estimation method*

The original formulation of Gagnaire *et al*.’s and bal&gar-ca methods use the square-root method to estimate the null-allele frequency. As the allele frequency estimation is difficult in dominant markers, we investigated the effect on the outlier detection of using a Bayesian estimator of the null-allele frequency, $\widehat{q}$, with non-uniform priors [36]. For the bal&gar-ca method, we also modified the calculation of the frequencies of the parental allele confidence intervals, by using a quantile-based 95% probability interval based on the Bayesian estimator of the squared standard error, ${s}_{\widehat{q}}^{2}$[36]. To compare this Bayesian method and the previous approach for a particular common scenario, 900 independent loci plus 100 selected loci (*s* = 99) were simulated in 100 F_{1} hybrid individuals from two parental populations (A and B) with 100 individuals each. One hundred simulations were carried out to compare the results of both methods (Gagnaire *et al*.’s and bal&gar-ca) with both different allelic frequencies estimation (square-root and Bayesian).

*et al*.’s method, using Bayesian estimations slightly decreased its sensitivity, but it highly decreased its rate of false positives (from 15% to 4%). For the bal&gar-ca method, using Bayesian estimations improved its sensitivity, but its rate of false positives also increased (reaching almost 3% –which, nevertheless, was not very high).

In stable hybrid zones with several generations of hybrids, *introgress* seems to be a compromise solution. However, in transitory recent hybrid zones, bal&gar-ca and Gagnaire *et al*.’s methods are better options, depending on the size of the hybrid zone, our sampling strategy and the scope of the genome scan. Gagnaire *et al*.’s is useful when we have a good population sampling. However, when the sample sizes are modest and we want to avoid any possible false positive, bal&gar-ca is the advised method. Although Bayesian estimation of frequency allele has been proved to be useful in many cases, it is not advised for the bal&gar-ca method as it increases its type I error rate. Finally, none of these methods is advisable when the selection coefficient shows low values, which is not strange as, in these cases, long periods of time would be needed to accumulate detectable signal in the DNA [18].

### Simulating hybridization with selection and genome scan for F_{1} individuals

In this example, we carry out the simulation of two parental populations of 100 individuals and 100 F_{1} hybrids for a total of 300 markers using the ‘hybridsim’ function. Positive selection was simulated with *s* = 10 for 15 out of 300 markers.

Firstly, we need to load *AFLPsim* and set the random seed number (arbitrarily to 123) for reproducibility.

> require(AFLPsim)

> set.seed(123)

> f1hybrid<-hybridsim(Nmarker=300, Na=100, Nb=100, Nf1=100, + type = 'selection', hybrid = 'F1', S=10, Nsel=15)

This is an object ‘hybridsim’ that contains the presence-absence matrices for the parentals (PA and PB) and for the hybrid classes (in this case, F_{1}). In addition, this object contains the loci under selection (f1hybrid$SelMarkers) and the selection coefficient used in the simulation (f1hybrid$S).

> f1hybrid$F1

$F1

M1 M2 M3 …

F1_1 0 1 0 …

F1_2 1 1 0 …

.

.

.

> f1hybrid$SelMarkers

[1] 13 26 46 55 69 78 149 158 161 177 183 229 230 289 290

> f1hybrid$S

[1] 10

_{1}hybrids). The results of the genome scan analysis are saved in a data object (outlier), which includes the

*P*-values of the binomial test after FDR (outlier$fdrf1), and the loci identity of those markers with

*P*< 0.05 (outlier$Outliers). Moreover, this object is used as the input for the ‘plot.hybridsim’ function to generate a plot of the outlier markers and the expected frequencies under neutrality (Figure 3).

> outlier<-gscan (f1hybrid, type = 'F1', method='bal&gar-ca')

> str (outlier)

List of 2

$ Pvalues :'data.frame': 300 obs. of 1 variable:

..$ fdrf1: num [1:300] 1 1 1 1 1 1 1 1 1 1 …

$ Outliers: num [1:10] 26 46 55 69 149 161 177 229 230 289

> plot.hybridsim(f1hybrid,hybrid = 'F1', + markers=outlier$Outliers)

In this example, we detected 10 out of 15 loci under selection (67% sensitivity) and we did not obtain any false positive.

### Simulating demographical evolution under hybridization

Finally, we simulated hybridization on one area and evaluated its demographical consequences. For the initial frequencies we created a vector with the frequencies of Parental A, Parental B, F_{1}, Backcross to Parental A, Backcross to Parental B and F_{x}. In our case, we fix Parental A and Parental B initial frequencies to 0.5.

> freqinit<-c (0.5,0.5,0,0,0,0)

Then, we create a matrix of assortative mating using the matrix function, and allow crosses between all taxa with the same probability.

> matingmat<-matrix (1,ncol=6,nrow=6)

In this example, parentals have similar fitness but F_{1} individuals’ is lower than parentals’. Here, we want to force asymmetrical introgression and breakdown occurs after F_{1} hybrids, with posterior hybrid generations (F_{x}) and backcrosses to Parental B being sterile, whereas backcrosses to Parental A (BxA) would have a similar fitness to F_{1} individuals. Hence, fitness would be modified as following:

> set.seed(123)

> results<-demosimhybrid(freqinit, matingmat, fitness)

> results

PA PB F1 BPA BPB Fx

G0 0.500 0.500 0.000 0.000 0 0

G1 0.333 0.333 0.333 0.000 0 0

G2 0.250 0.250 0.250 0.250 0 0

G3 0.500 0.167 0.167 0.167 0 0

G4 0.682 0.045 0.136 0.136 0 0

G5 0.838 0.003 0.040 0.120 0 0

G6 0.962 0.000 0.002 0.036 0 0

G7 0.998 0.000 0.000 0.002 0 0

G8 1.000 0.000 0.000 0.000 0 0

attr(,"class")

[1] "demosim.hybrid"

> plot.demosimhybrid (results)

## Conclusions

This simulation study showed the interest of performing comparative studies in hybridization analytical software. Here we fill an important gap in this kind of software, as the R package *AFLPsim* application provides several useful tools in the context of hybridization studies. This is true specifically in relation to dominant markers with low sample sizes, in order to obtain markers under selection with a low rate of false positives and with a rather high sensitivity. None of the methods used is advisable when the selection coefficient shows low values. Moreover, *AFLPsim* provides a demographic method to study evolution in this context. Finally, we hold an on-going project to implement the bal&gar-ca method with biallelic codominant markers as well as single nucleotide polymorphisms (SNPs).

### Availability and requirements

**Project name**: *AFLPsim*

**Project home page**: http://cran.r-project.org/web/packages/AFLPsim/

**Operating system(s)**: Windows, Mac OS, Linux

**Programming language**: R

**Other requirements**: R version 2.15 or higher

**License**: GPL-2 | GPL-3

**Any restrictions to use by non-academics**: None

## Declarations

### Acknowledgements

We thank Dr. M. Escudero for help in the ‘demosimhybrid’ code, for testing the software and providing feedback. Dr. O. Paun and two anonymous reviewers provided invaluable comments on a previous version of the manuscript. While working on this package, FB was partly funded by a Marie Curie Intra-European post-doctoral fellowship (‘TRANSADAPTATION’) at the Department of Systematic and Evolutionary Botany (University of Vienna) and Junta de Andalucía, Proyecto de Excelencia (2005/RNM484) and Ministerio de Educación y Ciencia, *Flora iberica* VIII (CGL2009-08178) and *Flora iberica* IX (CGL2012-32914), which were financed by FEDER funds.

## Authors’ Affiliations

## References

- Burke JM, Arnold ML: Genetics and the fitness of hybrids. Annu Rev Genet. 2001, 35: 31-52. 10.1146/annurev.genet.35.102401.085719.View ArticlePubMedGoogle Scholar
- Soltis PS, Soltis DE: The role of hybridization in plant speciation. Annu Rev Plant Biol. 2009, 60: 561-588. 10.1146/annurev.arplant.043008.092039.View ArticlePubMedGoogle Scholar
- Mallet J: Hybrid speciation. Nature. 2007, 446: 279-283. 10.1038/nature05706.View ArticlePubMedGoogle Scholar
- Barton NH: The role of hybridization in evolution. Mol Ecol. 2001, 10: 551-568.View ArticlePubMedGoogle Scholar
- Barton NH, Hewitt GM: Analysis of hybrid zones. Annu Rev Ecol Syst. 1985, 16: 113-148. 10.1146/annurev.es.16.110185.000553.View ArticleGoogle Scholar
- Stapley J, Reger J, Feulner PGD, Smadja C, Galindo J, Ekblom R, Bennison C, Ball AD, Beckerman AP, Slate J: Adaptation genomics: the next generation. Trends Ecol Evol. 2010, 25: 705-712. 10.1016/j.tree.2010.09.002.View ArticlePubMedGoogle Scholar
- Meudt HM, Clarke AC: Almost forgotten or latest practice? AFLP applications, analyses and advances. Trends Plant Sci. 2007, 12: 106-117. 10.1016/j.tplants.2007.02.001.View ArticlePubMedGoogle Scholar
- O’Hanlon P, Peakall R, Briese D: Amplified fragment length polymorphism (AFLP) reveals introgression in weedy
*Onopordum*thistles: hybridization and invasion. Mol Ecol. 1999, 8: 1239-1246. 10.1046/j.1365-294X.1999.00646.x.View ArticlePubMedGoogle Scholar - Anderson EC: Bayesian inference of species hybrids using multilocus dominant genetic markers. Philos Trans R Soc Lond B Biol Sci. 2008, 363: 2841-2850. 10.1098/rstb.2008.0043.PubMed CentralView ArticlePubMedGoogle Scholar
- Liu Z, Nichols A, Li P, Dunham RA: Inheritance and usefulness of AFLP markers in channel catfish (
*Ictalurus punctatus*), blue catfish (*I. furcatus*), and their F1, F2, and backcross hybrids. Mol Gen Genet. 1998, 258: 260-268. 10.1007/s004380050730.View ArticlePubMedGoogle Scholar - Gagnaire PA, Albert V, Jónsson B, Bernatchez L: Natural selection influences AFLP intraspecific genetic variability and introgression patterns in Atlantic eels. Mol Ecol. 2009, 18: 1678-1691. 10.1111/j.1365-294X.2009.04142.x.View ArticlePubMedGoogle Scholar
- Zha H, Milne RI, Sun H: Asymmetric hybridization in
*Rhododendron agastum*: a hybrid taxon comprising mainly F_{1}s in Yunnan, China. Ann Bot. 2010, 105: 89-100. 10.1093/aob/mcp267.PubMed CentralView ArticlePubMedGoogle Scholar - Foll M, Gaggiotti O: A genome-scan method to identify selected loci appropriate for both dominant and codominant markers: a Bayesian perspective. Genetics. 2008, 180: 977-993. 10.1534/genetics.108.092221.PubMed CentralView ArticlePubMedGoogle Scholar
- Bazin E, Dawson KJ, Beaumont MA: Likelihood-free inference of population structure and local adaptation in a Bayesian hierarchical model. Genetics. 2010, 185: 587-602. 10.1534/genetics.109.112391.PubMed CentralView ArticlePubMedGoogle Scholar
- Antao T, Beaumont MA: Mcheza: a workbench to detect selection using dominant markers. Bioinformatics. 2011, 27: 1717-1718. 10.1093/bioinformatics/btr253.View ArticlePubMedGoogle Scholar
- Gompert Z, Buerkle CA: A powerful regression-based method for admixture mapping of isolation across the genome of hybrids. Mol Ecol. 2009, 18: 1207-1224. 10.1111/j.1365-294X.2009.04098.x.View ArticlePubMedGoogle Scholar
- Gompert Z, Buerkle CA:
*introgress*: a software package for mapping components of isolation in hybrids. Mol Ecol Resour. 2010, 10: 378-384. 10.1111/j.1755-0998.2009.02733.x.View ArticlePubMedGoogle Scholar - Storz JF: Using genome scans of DNA polymorphism to infer adaptive population divergence. Mol Ecol. 2005, 14: 671-688. 10.1111/j.1365-294X.2005.02437.x.View ArticlePubMedGoogle Scholar
- Bonin A, Ehrich D, Manel S: Statistical analysis of amplified fragment length polymorphism data: a toolbox for molecular ecologists and evolutionists. Mol Ecol. 2007, 16: 3737-3758. 10.1111/j.1365-294X.2007.03435.x.View ArticlePubMedGoogle Scholar
- Pérez-Figueroa A, García-Pereira MJ, Saura M, Rolán-Alvarez E, Caballero A: Comparing three different methods to detect selective loci using dominant markers. J Evol Biol. 2010, 23: 2267-2276. 10.1111/j.1420-9101.2010.02093.x.View ArticlePubMedGoogle Scholar
- Caballero A, Quesada H, Rolán-Alvarez E: Impact of Amplified Fragment Length Polymorphism size homoplasy on the estimation of population genetic diversity and the detection of selective loci. Genetics. 2008, 179: 539-554. 10.1534/genetics.107.083246.PubMed CentralView ArticlePubMedGoogle Scholar
- Laval G, Excoffier L: SIMCOAL 2.0: a program to simulate genomic diversity over large recombining regions in a subdivided population with a complex history. Bioinformatics. 2004, 20: 2485-2487. 10.1093/bioinformatics/bth264.View ArticlePubMedGoogle Scholar
- Nielsen EE, Bach LA, Kotlicki P: Hybridlab (Version 1.0): a program for generating simulated hybrids from population samples. Mol Ecol Notes. 2006, 6: 971-973. 10.1111/j.1471-8286.2006.01433.x.View ArticleGoogle Scholar
- R Development Core Team: R: a language and environment for statistical computing. 2014,http://www.R-project.org/,Google Scholar
- Wright S: Evolution in Mendelian populations. Genetics. 1931, 16: 97-159.PubMed CentralPubMedGoogle Scholar
- Hall R, Ayres DR: What can mathematical modeling tell us about hybrid invasions?. Biol Invasions. 2009, 11: 1217-1224. 10.1007/s10530-008-9387-y.View ArticleGoogle Scholar
- Epifanio J, Philipp D: Simulating the extinction of parental lineages from introgressive hybridization: the effects of fitness, initial proportions of parental taxa, and mate choice. Rev Fish Biol Fish. 2000, 10: 339-354. 10.1023/A:1016673331459.View ArticleGoogle Scholar
- Balao F, Casimiro-Soriguer R, García-Castaño JL, Terrab A, Talavera S: Big thistle eats the little thistle: Does unidirectional introgressive hybridization endanger the conservation of Onopordum hinojense?. New Phytol. in press doi:10.1111/nph.13156Google Scholar
- Bettles C, Docker M, Dufour B, Heath DD: Hybridization dynamics between sympatric species of trout: loss of reproductive isolation. J Evol Biol. 2005, 18: 1220-1233. 10.1111/j.1420-9101.2005.00935.x.View ArticlePubMedGoogle Scholar
- Clopper CJ, Pearson ES: The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika. 1934, 26: 404-413. 10.1093/biomet/26.4.404.View ArticleGoogle Scholar
- Dray S, Dufour AB: The
*ade4*package: implementing the duality diagram for ecologists. J Stat Softw. 2007, 22: 1-20.View ArticleGoogle Scholar - Jombart T:
*adegenet*: a R package for the multivariate analysis of genetic markers. Bioinformatics. 2008, 24: 1403-1405. 10.1093/bioinformatics/btn129.View ArticlePubMedGoogle Scholar - Excoffier L, Laval G, Schneider S: Arlequin ver. 3.0: An integrated software package for population genetics data analysis. Evol Bioinform Online. 2005, 1: 47-50.PubMed CentralGoogle Scholar
- Yeh FC, Boyle TJB: Population genetic analysis of co-dominant and dominant markers and quantitative traits. Belgian J Bot. 1997, 129: 157-Google Scholar
- Falush D, Stephens M, Pritchard JK: Inference of population structure using multilocus genotype data: dominant markers and null alleles. Mol Ecol Notes. 2007, 7: 574-578. 10.1111/j.1471-8286.2007.01758.x.PubMed CentralView ArticlePubMedGoogle Scholar
- Zhivotovsky LA: Estimating population structure in diploids with multilocus dominant DNA markers. Mol Ecol. 1999, 8: 907-913. 10.1046/j.1365-294x.1999.00620.x.View ArticlePubMedGoogle Scholar

## Copyright

This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly credited. The Creative Commons Public Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this article, unless otherwise stated.