- Open Access
Fregene: Simulation of realistic sequence-level data in populations and ascertained samples
© Chadeau-Hyam et al; licensee BioMed Central Ltd. 2008
Received: 18 April 2008
Accepted: 08 September 2008
Published: 08 September 2008
FREGENE simulates sequence-level data over large genomic regions in large populations. Because, unlike coalescent simulators, it works forwards through time, it allows complex scenarios of selection, demography, and recombination to be modelled simultaneously. Detailed tracking of sites under selection is implemented in FREGENE and provides the opportunity to test theoretical predictions and gain new insights into mechanisms of selection. We describe here main functionalities of both FREGENE and SAMPLE, a companion program that can replicate association study datasets.
We report detailed analyses of six large simulated datasets that we have made publicly available. Three demographic scenarios are modelled: one panmictic, one substructured with migration, and one complex scenario that mimics the principle features of genetic variation in major worldwide human populations. For each scenario there is one neutral simulation, and one with a complex pattern of selection.
FREGENE and the simulated datasets will be valuable for assessing the validity of models for selection, demography and population genetic parameters, as well as the efficacy of association studies. Its principle advantages are modelling flexibility and computational efficiency. It is open source and object-oriented. As such, it can be customised and the range of models extended.
FREGENE (FoRward Evolution of GENomic rEgions) is C++ code for simulating sequence-level genetic data over large genomic regions in large populations. Unlike coalescent-based simulators it runs forward-in-time, which allows it to provide a wide range of scenarios for selection, recombination (crossovers and gene conversion), population size and structure, and migration. The advantages of forward simulators over coalescent simulators are discussed in . A recent study  has shown that coalescent-based approaches can have serious limitations when there is a large recombination rate over the simulated genomic region. The main limitation of alternative forward-in-time simulators (FPG and SIMU POP ) is the size of genome and population that can be accommodated. A primary objective in the development of FREGENE has been computational efficiency. We implement a rescaling technique that greatly extends the feasible simulation size at the cost of some approximation. As a result, FREGENE can simulate a 20 Mb genome in 10 K diploid individuals over 300 K generations in a few days on a standard computer without rescaling, and only a few hours with rescaling.
Since its first publication , FREGENE has been extended to incorporate several new features. A general migration model has now been included. Selection at a locus can be switched off at a random time, and can be geographically restricted. The rescaling technique has also been fully automated. A new program, SAMPLE, has been developed that samples individuals from a FREGENE population, returning genotype and/or haplotype data. SAMPLE can also assign binary and/or continuous phenotypes generated under a user-specified model, and can replicate SNP and individual ascertainment schemes. Thus methods for the analysis of genetic association studies can be tested under realistic scenarios.
In this article we recap the main features of FREGENE, detail new developments, and illustrate its application by generating and analysing six large datasets. These datasets may serve as useful standards for testing methods to infer population genetic parameters, such as recombination rates and selection coefficients, and together with SAMPLE can be used to assess genetic association methods. We model three populations: two with constant population size (one panmictic and one with migration among three subpopulations) and one population that mimics the major features of worldwide human genetic variation . The latter incorporates bottlenecks, periods of growth, and subdivision into three major continental groups. For each population there are two simulations, one neutral and the other adopting a complex selection model. Analyses of genetic diversity and the role of selection in these datasets are reported below.
FREGENE has been developed and tested under a Linux environment and uses the GNU scientific library (GSL). It can also be installed on a Mac platform (for installation details, see FREGENE documentation). Source code, executables, datasets and R scripts for generating figures such as those shown below are all freely available for download from http://www.ebi.ac.uk/projects/BARGEN, together with extensive documentation (see also Additional File 1).
FREGENE simulates the evolution of a monoecious, diploid, potentially subdivided, population over non-overlapping generations. The genome consists of a single, linear chromosome, whose sequence is recorded as a list of sites at which the minor allele is present. Allele frequencies are checked at regular intervals, and if the minor allele has become the major allele at a site the sequence lists are appropriately updated. These updating operations are recorded such that it can always be determined whether the minor allele is ancestral or derived.
Parameters characterising the mutation, recombination, demographic and selection processes, are specified by the user, via either input files or the command line. A starting population is also specified, typically either a 'null' population with no diversity, or a population that is the result of a previous run of FREGENE. At the start of a FREGENE run, a C++ recombination object is invoked and uses the recombination parameters specified in the input file to stochastically assign recombination rates over the genome, including the locations and intensities of hotspots. The resulting 'recombination map' remains unchanged throughout the simulation.
Subsequently, each new generation is created one individual at a time. A parent is chosen at random, weighted by fitness, and a new sequence is generated by randomly recombining its two sequences. New mutations arise uniformly at random on the new sequence, regardless of current allelic status. Thus a mutation can arise on an already polymorphic site, in which case a 'double hit' mutation (affecting an ancestral allele) or 'back' mutation (derived allele reverts to the ancestral type) can occur, both of which are recorded. A second sequence is generated in the same way from a parent that is either the same as the first with probability equal to the selfing coefficient, or is a different individual chosen at random in the same way as the first parent. The pair of new sequences becomes an individual in the next generation.
Although recombination rates are computed for each run, the random number seed used by the recombination module is recorded so that the recombination map can be maintained between successive runs.
Currently, FREGENE accommodates constant population size, and growth/decline that is either exponential or instantaneous at the start of the run.
The population may be subdivided, in which case migration between subpopulations can occur according to arbitrary 'backward' migration rates: for an offspring in subpopulation i, its two parents are chosen from subpopulation j with probability m ij , which for i ≠ j is specified by the user, and m ii = 1 - ∑j≠im ij .
To allow successive runs of FREGENE where the output of one run becomes the input for the next, the main output file has the same structure as the input file: it contains the sequences in the final generation, and all the simulation parameters required as input. This facility allows complex demographic scenarios to be constructed from the simple demographic models offered within each FREGENE run. For example, in successive runs populations can split or subpopulations merge, and bottlenecks can be implemented in some subpopulations or the entire population.
A key feature of FREGENE is that complex selection scenarios can be implemented: FREGENE allows for positive, negative and directional selection, as well as dominance and over-dominance at each site. The latter can lead to quasi-stable polymorphisms maintained under balancing selection. Crucially, the combined effects of multiple forms of selection at linked sites can be studied.
Novel mutant alleles are under selection with a specified probability. If so, two coefficients are assigned at random according to parameters set in an input file: s, which we call the 'selection' coefficient, and h the 'dominance' coefficient. The contribution to an individual's fitness at a site is s for a derived-allele homozygote, sh for a heterozygote, and zero for an ancestral-allele homozygote. Thus, for s > 0, a site is recessive if h = 0; co-dominant if 0 <h < 1; and over-dominant if h > 1. Individual fitness is one plus the sum of these contributions over all selected sites. After a derived allele reaches fixation it makes no contribution to fitness.
To model geographical variation in selection, due to differing environments, FREGENE allows subpopulation-specific selection. Each selected site is under selection either globally, or locally in the subpopulation where it arose, according to a probability specified by the user.
The selection coefficients of a site are constant over time until fixation, except that with a fixed probability at each generation selection is switched off, potentially reflecting a change in environment that eliminates the previous selective effect. The rate at which selection is switched off can be set to control the number of balancing polymorphisms at equilibrium.
Details of sites under selection (selection coefficients, generations when the selected mutant arose, and when fixed, lost, or switched off if any of these has occurred) are recorded.
Scaling the population: Computation time and memory savings
A scaling technique, described in , can lead to dramatic reductions in computing time and memory use at the cost of some approximation. Scaling involves increasing all rate parameters (mutation, recombination, selection, migration) by a common factor λ > 1, while reducing by a factor of λ both the population size and the number of generations. FREGENE allows the user to specify λ, and it calculates the appropriate scaled parameters from the target values specified by the user. An undesirable feature of scaling is that the output population size is reduced by a factor of λ, but FREGENE now offers an option either to output this reduced population or to run additional generations during which scaling is relaxed and the population size expands linearly from N/λ to N.
Generating genotype, haplotype and phenotype data: SAMPLE
The program SAMPLE samples individuals or chromosomes from FREGENE output to give, respectively, genotype or haplotype data. Association studies can be simulated by assigning continuous or binary (case and control) phenotypes to individuals according to a user-defined model. In the continuous case, the user specifies the phenotypic standard deviation, the number of causal SNPs (SNPs that affect the phenotype) and their heritabilities. In the binary case, the user specifies the prevalence of the trait, the number of cases and controls, the number of causal SNPs and their risk ratios. In either case the user can also supply a range for the allele frequency for each causal SNP. The SNP ascertainment scheme can be controlled by the user: the user can set the minimum minor allele frequency, or to simulate any given SNP ascertainment bias , a list of SNPs to be output can be specified by location of individual SNPs or ranges of SNP locations.
Ascertainment bias in structured populations, where cases and controls are sampled unequally in different subpopulations, is a potential problem in association analyses as it may result in false positives . SAMPLE can simulate ascertainment bias, from a FREGENE subpopulation simulation, by allowing the user to specify the numbers of cases and controls from each subpopulation. This facility will be useful for testing methods that aim to correct for the effects of population structure.
'Ready to use' simulated data sets
Two standard population models, each with 10.5 K individuals, have been simulated over 20 Mb genomes, and the final generations are available as test datasets: population A is panmictic, while population B is subdivided into three subpopulations each of 3.5 K individuals. Migration rates in population B are all equal, and the common migration rate is chosen such that F ST , measuring the genetic distance between populations , is equal to 10%.
A third and more complex simulation (population C), over a 10 Mb genomic region, uses parameter values found by  to provide the neutral model that best fits the major features of current worldwide human genetic variation. This simulation used a per-site and per generation mutation rate of 1.5 × 10-5 and required seven steps (note that all population expansions are instantaneous):
Founding population in Africa: an homogeneous population (N = 25 K sequences) evolves for 125 K generations.
Expansion in Africa: the population expands from 25 K to 48 K sequences and evolves during 17 K further generations.
Out of Africa (OoA) split and bottleneck: among the 48 K sequences, 8.5% (= 4,080) leave Africa. Simultaneously, the population in Africa encounters a bottleneck of size ratio 0.8%, leaving 380 sequences in that subpopulation.
African and OoA expansion: African population expands back to N = 48 K. Similarly the OoA population expands to N = 15.4 K and evolves for 3.5 K generations.
Asian and European split: the OoA population encounters a bottleneck of size N = 1,360, and splits with N = 320 moving to Europe and N = 1,040 to Asia.
Asian and European expansion: Asian and European populations both expand to N = 15.4 K, and evolve for 2 K generations. During this stage, migration occurs symmetrically, first between Asia and Africa (with rate 0.8 × 10-5 per chromosome), and between Europe and Africa (with rate 3.2 × 10-5 per chromosome).
Independent evolution of the three populations: African, Asian and European populations evolve, without migration, during 200, 400 and 350 generations respectively, while each population expands to reach a final population size of N = 50 K sequences.
General parameters (only applies to populations A and B)
Per-site mutation rate
2.3 × 10-8
Per site crossover rate:
1.1 × 10-8
Per site Gene conversion rate:
4.5 × 10-9
Proportion of recombination events occurring in hotspots
Gene conversion length:
Mean distance between hotspots:
Selection parameters (if applicable)
Prop. of sites under selection:
5 × 10-4
Proportion of selected sites locally under selection:
Mean # generations before selected sites are switched off
s ~ 0.1 × (0.005, 0.052) + 0.9 × (-0.01, 0.0052)
h ~ 0.8 × (0.5, 0.2) + 0.3 × (1.2, 0.22)
Results available for download include the main FREGENE output files, from which genotype, haplotype and phenotype data can be generated using SAMPLE. It is possible to generate haplotype data for subsequences with length defined by the user up to the full simulation length (20 Mb for populations A and B, 10 Mb for population C). In addition, the datasets available also include most of the optional FREGENE outputs to allow various analyses and plots.
Genetic diversity in the worldwide human simulation (population C)
During the first 125 K generations (step 1), diversity increases to reach an equilibrium value, which for the neutral model is close to the expected value under neutrality (horizontal green line), given by E h = 2Nμ/(1+2Nμ), where μ denotes the mutation rate per site and per generation. For the selection model, the diversity approaches an equilibrium value that is lower than E h . During the next 17 K generations (step 2), diversity under neutrality increases towards the new equilibrium expected value (E h ≈ 1.4 × 10-3) but does not reach it, whereas under selection diversity is little affected by the population expansion. During steps 1 and 2, when a strongly selected site (s > 0.075) reaches fixation (vertical dotted lines), a trough in diversity is typically observed, corresponding to the effect of a selective sweep.
After the OoA split (generation 142 K), diversity slightly drops in the African population, due to the bottleneck, and then increases almost linearly until the end of the simulation. Diversity for the OoA population decreases linearly during step 3, approaching the equilibrium value of 7.1 × 10-4. The Asian and European populations have the same size (N = 15.4 K) during step 5, but diversity in Europeans is slightly higher than in Asians, due to a fourfold higher migration rate between Africa (with higher diversity) and Europe than between Africa and Asia. Trends highlighted for the neutral model also generally apply to the selection simulation, but with reduced diversity due primarily to the effect of selective sweeps in reducing diversity.
Assessing the effect of selection: analysis of populations A and B
Mean diversity for populations A and B.
Population A (panmictic)
Population B (subdivided)
9.33 × 10-4
9.82 × 10-4
9.58 × 10-4
6.72 × 10-4
7.82 × 10-4
Under selection, there is a greater proportion of polymorphic sites with low AAF: for population A, 49% of polymorphic sites have AAF < 1%, compared with 44% in the neutral model. The impact of selection on the distribution of allele frequencies differs between panmictic (A) and subdivided (B) populations: sites with AAF < 5% are slightly less frequent in the subdivided population (67% vs. 69%), while sites with AAF > 50% are slightly over-represented (7.7% vs. 6.9%). The number of selected sites that went to fixation is 261 in population A, compared with only 146 in population B.
The probability of a double hit mutation is proportional to the number of polymorphic sites, and hence these are more common in population B (1.35 M vs. 1.26 M in population A, results not shown). The probability of a back mutation on a given site is an increasing function of the allele frequency on that site, and thus there were fewer back mutations in population A (117 K) than in population B (148 K). In Figure 4, we only represented back mutations occurring on selected sites (148 for population A, and 123 for population B). In both populations, back mutations mainly occur on sites that remain for a long time in the population, and thus often arise at balancing sites.
FREGENE incorporates many useful features for population biologists and genetic epidemiologists, and has already been used to assess methods for the analysis of genome-wide association studies [10–12]. An important feature that overcomes a limitation of other software for simulation under selection is that the combined effects of different forms of selection – adaptive, purifying and balancing – can be studied in a single FREGENE run. Its flexibility could be improved further: for instance, users can define their own recombination model by altering the existing C++ object. Moreover, structural variants, such as genomic inversions and copy number polymorphisms, could be incorporated into the model with further work. In contrast, accommodating structural variation within coalescent-based simulators presents a distinct challenge. Individual variability in the recombination map could also be considered: for instance, each individual could have their own recombination map, with hotspot intensity/presence dependent on sequence-content for example, which is transmitted to their offspring with minor changes. FREGENE and SAMPLE are open source and as such users are free to contribute additional features, or make any other improvements.
Availability and requirements
Project name: FREGENE
Project home page: http://www.ebi.ac.uk/projects/BARGEN/
Operating system(s): Linux/Unix – Mac
Programming language: C++
Other requirements: GNU Scientific Library (GSL)
License: GNU GPL
Any restrictions to use by non-academics: none
MCH and CH were funded by the UK Medical Research Council and POR by the Biotechnology and Biological Sciences Research Council. This work has been carried out within the BARGEN project, under the LINK scheme operated by the UK Department of Trade and Industry. We thank Will Astle and Ernest Turro for testing FREGENE and SAMPLE, and for their constructive suggestions.
- Hoggart CJ, Chadeau-Hyam M, Clark TG, Lampariello R, De Iorio M, Whittaker JC, Balding DJ: Sequence-level population simulations over large genomic regions. Genetics 2007, 177(3):1725–1731. 10.1534/genetics.106.069088PubMed CentralView ArticlePubMedGoogle Scholar
- Davies JL, Simancik F, Lyngso R, Mailund T, Hein J: On recombination-induced multiple and simultaneous coalescent events. Genetics 2007, 177(4):2151–2160. 10.1534/genetics.107.071126PubMed CentralView ArticlePubMedGoogle Scholar
- Hey J: FPG – A computer program for forward population genetic simulation.2004. [http://lifesci.rutgers.edu/~heylab/heylabsoftware.htm#FPG]Google Scholar
- Peng B, Kimmel M: simuPOP: a forward-time population genetics simulation environment. Bioinformatics 2005, 21: 3686–7. 10.1093/bioinformatics/bti584View ArticlePubMedGoogle Scholar
- Schaffner S, Foo C, Gabriel S, Reich D, Daly M, Altshuler D: Calibrating a coalescent simulation of human genome sequence variation. Genome Research 2005, 15: 1576–1583. 10.1101/gr.3709305PubMed CentralView ArticlePubMedGoogle Scholar
- Clark AG, Hubisz MJ, Bustamante CD, Williamson SH, Nielsen R: Ascertainment bias in studies of human genome-wide polymorphism. Genome Res 2005, 15(11):1496–1502. 10.1101/gr.4107905PubMed CentralView ArticlePubMedGoogle Scholar
- Setakis E, Stirnadel H, Balding DJ: Logistic regression protects against population structure in genetic association studies. Genome Res 2006, 16(2):290–6. 10.1101/gr.4346306PubMed CentralView ArticlePubMedGoogle Scholar
- Balding DJ: Likelihood based inference for genetic correlation coefficients. Theoretical Population Biology 2003, 63: 221–230. 10.1016/S0040-5809(03)00007-8View ArticlePubMedGoogle Scholar
- Weir BS: Genetic Data Analysis II. Sunderland, MA 01375, USA: Sinauer Associates, Inc.; 1996.Google Scholar
- Minichiello MJ, Durbin R: Mapping trait loci by use of inferred ancestral recombination graphs. Am J Hum Genet 2006, 79(5):910–22. 10.1086/508901PubMed CentralView ArticlePubMedGoogle Scholar
- Tachmazidou I, Verzilli CJ, De Iorio MD: Genetic Association Mapping via Evolution-Based Clustering of Haplotypes. PLoS Genet 2007, 3(7):e111. 10.1371/journal.pgen.0030111PubMed CentralView ArticlePubMedGoogle Scholar
- Hoggart CJ, Clark TG, De Iorio M, Whittaker J, Balding DJ: Genome-wide significance for dense SNP and resequencing data. Genet Epidemiol 2008, 32(2):179–85. 10.1002/gepi.20292View ArticlePubMedGoogle Scholar
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/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.