BACKGROUND
in recent years, genome-wide association studies  became widely used to uncover the genetic basis of complex traits by comparing patterns of genetic and phenotypic variation  <cit> .
the power of such studies depends on various factors that include the genetic architecture of the trait, the demographic history of the population, and variation in mutation and recombination rates  <cit> .
in addition, the trait under investigation may be adaptive or  can evolve under purifying selection, which both would result in a non-neutral pattern of genetic diversity in the genomic neighborhood of the causal mutation.
coalescent simulations are widely used to simulate genotypes under complex demographies  <cit>  with recent extensions to include recombination hotspots  <cit>  and selection  <cit> , or to simulate whole genomes  <cit> .
simulations are often used to test population genetic hypotheses by comparing simulated and observed data.
however, such simulations produce only genotypes but not phenotypes, which are also required to test methods for detecting significant associations between genetic and phenotypic variation.
although some tools provide an option to map phenotypes onto simulated genotypes, they only allow the simulation of qualitative phenotypes  <cit>  or require time-consuming forward-in-time simulations to create genotypes from complex demographic scenarios  <cit> .
here, we present phenosim, a tool written in python  <cit>  that was designed to add a phenotype to genotypes simulated by coalescent-based simulation tools.
simulated phenotypes may either be qualitative or quantitative traits with different effect sizes and may show epistatic interactions.
hence, the simulation of case/control studies as well as the search for quantitative trait nucleotides  of a complex trait with a user-defined architecture is possible.
by combining simulated genotypes and phenotypes, researchers can assess the influence of different factors on the power of new methods for association mapping, compare different methods or estimate an optimal sample size and number of markers for a given study design.
implementation
the general work flow of phenosim is shown in figure  <dig>  first, the user simulates genotypes with one of four different programs for coalescent simulations.
in the current version, phenosim is able to read the output of the ms <cit> , mshot <cit> , msms <cit>  and genome <cit>  programs.
after the import of genotypes, a phenotype generated under a user-defined model is assigned to each genotype.
the trait can either be qualitative or quantitative.
for qualitative traits, one- and two-locus models are supported.
the user defines the model by setting the penetrance  for all genotypes.
in the two-locus model, this is done by a penetrance table for all possible allelic combinations among the two loci.
therefore, the user may define arbitrary interactions between all alleles of the loci.
the case/control-status of all simulated individuals is then assigned according to the model.
in many cases, disease states are caused by risk alleles segregating at low allele frequencies in the overall population.
as such low frequency variants share a genealogy that may differ from high frequency variants and thus the linkage pattern around these variants may be different  <cit> , the user can restrict causal mutations to a certain frequency range to obtain realistic risk loci.
however, as this may result in a low number of cases in the final sample, users need to simulate larger populations and optionally enter a minimum number of cases to be sampled from the population.
this procedure reflects the sampling procedure of many case/control studies.
for quantitative traits, multiple qtns with additive effects or epistatic interactions between two qtns are possible.
by default locations of causal variants are selected randomly.
nevertheless, the user can determine the position of a qtn manually and/or restrict the selection to an allele frequency range.
a phenotype is generated based on the formulas of  <cit> , which we generalize for additive effects among multiple qtns as follows.
the trait value is calculated by adding a fixed variance proportion explained by the qtn to a random number drawn from a standard normal distribution with mean  <dig> and standard deviation  <dig>  n. we provide two different models, depending on the ploidy of the individuals.
the effect of the j-th qtn is πj and the qtn has a derived allele frequency of fj.
it should be noted that the sum of all qtn effects, ∑j πj, equals the heritability, h <dig>  of the trait.
if the individuals are haploid, the allelic state of the i-th individual at the j-th qtn is aij, where aij :=  <dig> if the allele is ancestral and aij :=  <dig> if it is derived.
then the phenotype y of individual i is calculated as:
the phenotype of diploid individuals under an additive model without dominance is calculated as:
where qij :=  <dig> if the j-th qtn is homozygous derived, qij :=  <dig> if the qtn is heterozygous and qij := - <dig> if the qtn is homozygous ancestral.
dominant effects at each qtn and additive effects between loci are also supported for diploids.
in this case, equation  is used with aij :=  <dig> for homozygous ancestral qtns and aij :=  <dig> for heterozygous and homozygous derived individuals.
if exactly two qtns are selected, a positive, additive epistatic effect πe between these qtns can be simulated.
this epistasis is modeled as a fictive third qtn, whose allelic state aie is  <dig>  if the individual carries at least one derived allele at both basal qtns.
for users with a some python scripting experience, other types of epistasis can easily be simulated by modifying the code of phenosim.
to simulate a causal haplotype or allelic heterogeneity among two causal variants within a single gene, both qtns may also be located on a common haploblock defined by the four-gamete test  <cit> .
to our knowledge, quantinemo <cit>  is the only software that currently supports the simulation of interactions between qtns.
however, quantinemo utilizes time-consuming forward simulations, whereas phenosim allows to include epistasis between qtns within a time-efficient coalescent framework.
after phenotypes have been generated, a predefined number of markers and/or individuals can be sub sampled from the total simulated population.
the causal marker can be optionally removed from the sample, since frequently the causal mutation itself is not genotyped in a genome-wide study.
finally, genotypes and phenotypes are written into different output file formats that can be directly used as input for commonly used association programs such as blossoc/qblossoc <cit> , emma/emmax <cit> , plink <cit> , qtdt/merlin <cit>  and tassel  <dig>   <cit> .
a snapshot of phenosim is available as additional file  <dig> whereas the most current version is maintained at http://evoplant.uni-hohenheim.de
RESULTS
to demonstrate the ability of phenosim to simulate data for gwas, we utilized genome <cit>  and simulated populations ne =  <dig>  with a population recombination parameter of ρ =  <dig> · 10- <dig> and  <dig>  snps distributed over a  <dig> mbp genome.
these settings are comparable to data sets used for recent gwas in a. thaliana  <cit> .
phenosim was then used to generate phenotypes under three different models:   <dig> qtns, each with an effect of  <dig> ;   <dig> qtns at random positions, each with an effect of  <dig> , and epistatic interaction of πe =  <dig> ; and   <dig> qtns, located on a common haploblock, each with an effect of  <dig>  and epistatic interaction of πe =  <dig> .
in all three scenarios, the total proportion of variance explained by these qtns and their interaction was identical .
four hundred chromosomes were sub-sampled and the causal polymorphisms were removed from the data.
emmax <cit>  was used to detect marker-trait associations and the causal locus for this hypothetical trait.
in figure  <dig> we show the proportion of significant markers that were found at a given distance from the causal locus.
in the first model , less than 10% of the detected significant markers are located within a distance of  <dig> kbp to the causal locus.
a larger sample size may increase the power to detect such small additive effects in genome-wide scans.
despite the smaller additive effect in model , the number of significant markers within  <dig> kbp of the qtn was comparable to model .
additionally, there is an increased number of significant associations further than  <dig> kbp from the qtns.
these may represent false positive associations caused by epistasis, such as markers that are in strong linkage disequilibrium with the fictive epistatic marker  <cit> .
the highest power was observed in the third model.
qtns on a common haploblock with epistatic effects create a strong joint qtl and therefore in more than 75% of simulations, a significant marker was located within a distance of  <dig> kbp to the causal locus.
the results show that single marker association methods as emmax are able to detect qtns with small additive effects and a strong positive epistatic interaction.
however, in certain situations larger samples than simulated sizes are needed and some results may be confounded by false positives as discussed earlier  <cit> .
on average, a single simulation ran  <dig> min with genome <cit>  and  <dig> min with phenosim on a single core of an intel xeon x <dig>  processor.
to compare this running time with other software tools, we simulated two qtns and  <dig>  neutral loci in a population of  <dig> diploid individuals using quantinemo <cit> .
in six minutes, quantinemo generated ~ <dig> generations.
as the expected coalescent time for a sample is ~ 4ne generations  <cit> , this is by far not enough to get a realistic variation pattern comparable to what can be achieved by genome in the same time.
although forward simulations like quantinemo allow more complex demographic, selection and trait scenarios, the combination of coalescent simulators and phenosim is much more suitable for generating multiple simulations of large sample sizes.
CONCLUSIONS
demographic effects, genetic architecture, selection, and different mutation and recombination rates affect the ability to detect the genetic basis of complex traits in natural populations  <cit> .
such population genetic parameters can now be estimated from genome-wide marker sets prior to further analyses.
since gwas are widely used in plant and animal genetics, there is a great interest in assessing the power of a particular study or method.
using coalescent simulations in conjunction with phenosim, one can investigate the statistical power and other characteristics of gwas methods efficiently.
additionally, as different causal markers may contribute different effects to a trait, the essential sample size and number of markers to detect a certain pattern can be estimated.
competing interests
the authors declare that they have no competing interests.
availability and requirements
• project name: phenosim
• project home page: http://evoplant.uni-hohenheim.de
• operating system: platform independent
• programming language: python
• other requirements: python  <dig> x
• license: no license required
• any restrictions to use by non-academics: none
authors' contributions
tg, ig and kjs conceived the project.
tg and ig designed the software.
tg wrote the code.
ig analyzed the data.
kjs supervised the project.
all authors contributed to writing of the manuscript.
all authors read and approved the final manuscript.
supplementary material
additional file 1
phenosim v <dig> .
the archive includes the current version of phenosim as well as a documentation of its usage.
for updated versions, please visit the authors' website http://evoplant.uni-hohenheim.de.
click here for file
acknowledgements
this work is supported by the bmbf under the german plant genomics program gabi  and the bioenergy  <dig> initiative ; tg is funded by a volkswagen foundation evolutionary biology scholarship .
we thank two anonymous reviewers for their comments and sariel hübner for testing the scripts and comments on the software features.

 in recent years, genome-wide association studies became widely used to uncover the genetic basis of complex traits by comparing patterns of genetic and phenotypic variation. the power of such studies depends on various factors that include the genetic architecture of the trait, the demographic history of the population, and variation in mutation and recombination rates. in addition, the trait under investigation may be adaptive or can evolve under purifying selection, which both would result in a non-neutral pattern of genetic diversity in the genomic neighborhood of the causal mutation. coalescent simulations are widely used to simulate genotypes under complex demographies with recent extensions to include recombination hotspots and selection, or to simulate whole genomes. simulations are often used to test population genetic hypotheses by comparing simulated and observed data. however, such simulations produce only genotypes but not phenotypes, which are also required to test methods for detecting significant associations between genetic and phenotypic variation. although some tools provide an option to map phenotypes onto simulated genotypes, they only allow the simulation of qualitative phenotypes or require time-consuming forward-in-time simulations to create genotypes from complex demographic scenarios. here, we present phenosim, a tool written in python that was designed to add a phenotype to genotypes simulated by coalescent-based simulation tools. simulated phenotypes may either be qualitative or quantitative traits with different effect sizes and may show epistatic interactions. hence, the simulation of case/control studies as well as the search for quantitative trait nucleotides of a complex trait with a user-defined architecture is possible. by combining simulated genotypes and phenotypes, researchers can assess the influence of different factors on the power of new methods for association mapping, compare different methods or estimate an optimal sample size and number of markers for a given study design. implementation the general work flow of phenosim is shown in figure first, the user simulates genotypes with one of four different programs for coalescent simulations. in the current version, phenosim is able to read the output of the ms, mshot, msms and genome programs. after the import of genotypes, a phenotype generated under a user-defined model is assigned to each genotype. the trait can either be qualitative or quantitative. for qualitative traits, one- and two-locus models are supported. the user defines the model by setting the penetrance for all genotypes. in the two-locus model, this is done by a penetrance table for all possible allelic combinations among the two loci. therefore, the user may define arbitrary interactions between all alleles of the loci. the case/control-status of all simulated individuals is then assigned according to the model. in many cases, disease states are caused by risk alleles segregating at low allele frequencies in the overall population. as such low frequency variants share a genealogy that may differ from high frequency variants and thus the linkage pattern around these variants may be different, the user can restrict causal mutations to a certain frequency range to obtain realistic risk loci. however, as this may result in a low number of cases in the final sample, users need to simulate larger populations and optionally enter a minimum number of cases to be sampled from the population. this procedure reflects the sampling procedure of many case/control studies. for quantitative traits, multiple qtns with additive effects or epistatic interactions between two qtns are possible. by default locations of causal variants are selected randomly. nevertheless, the user can determine the position of a qtn manually and/or restrict the selection to an allele frequency range. a phenotype is generated based on the formulas of, which we generalize for additive effects among multiple qtns as follows. the trait value is calculated by adding a fixed variance proportion explained by the qtn to a random number drawn from a standard normal distribution with mean and standard deviation n. we provide two different models, depending on the ploidy of the individuals. the effect of the j-th qtn is πj and the qtn has a derived allele frequency of fj. it should be noted that the sum of all qtn effects, ∑j πj, equals the heritability, h of the trait. if the individuals are haploid, the allelic state of the i-th individual at the j-th qtn is aij, where aij:= if the allele is ancestral and aij:= if it is derived. then the phenotype y of individual i is calculated as: the phenotype of diploid individuals under an additive model without dominance is calculated as: where qij:= if the j-th qtn is homozygous derived, qij:= if the qtn is heterozygous and qij:= - if the qtn is homozygous ancestral. dominant effects at each qtn and additive effects between loci are also supported for diploids. in this case, equation is used with aij:= for homozygous ancestral qtns and aij:= for heterozygous and homozygous derived individuals. if exactly two qtns are selected, a positive, additive epistatic effect πe between these qtns can be simulated. this epistasis is modeled as a fictive third qtn, whose allelic state aie is if the individual carries at least one derived allele at both basal qtns. for users with a some python scripting experience, other types of epistasis can easily be simulated by modifying the code of phenosim. to simulate a causal haplotype or allelic heterogeneity among two causal variants within a single gene, both qtns may also be located on a common haploblock defined by the four-gamete test. to our knowledge, quantinemo is the only software that currently supports the simulation of interactions between qtns. however, quantinemo utilizes time-consuming forward simulations, whereas phenosim allows to include epistasis between qtns within a time-efficient coalescent framework. after phenotypes have been generated, a predefined number of markers and/or individuals can be sub sampled from the total simulated population. the causal marker can be optionally removed from the sample, since frequently the causal mutation itself is not genotyped in a genome-wide study. finally, genotypes and phenotypes are written into different output file formats that can be directly used as input for commonly used association programs such as blossoc/qblossoc, emma/emmax, plink, qtdt/merlin and tassel. a snapshot of phenosim is available as additional file whereas the most current version is maintained at http://evoplant.uni-hohenheim.de  to demonstrate the ability of phenosim to simulate data for gwas, we utilized genome and simulated populations ne = with a population recombination parameter of ρ = · 10- and snps distributed over a mbp genome. these settings are comparable to data sets used for recent gwas in a. thaliana. phenosim was then used to generate phenotypes under three different models: qtns, each with an effect of; qtns at random positions, each with an effect of, and epistatic interaction of πe =; and qtns, located on a common haploblock, each with an effect of and epistatic interaction of πe =. in all three scenarios, the total proportion of variance explained by these qtns and their interaction was identical. four hundred chromosomes were sub-sampled and the causal polymorphisms were removed from the data. emmax was used to detect marker-trait associations and the causal locus for this hypothetical trait. in figure we show the proportion of significant markers that were found at a given distance from the causal locus. in the first model, less than 10% of the detected significant markers are located within a distance of kbp to the causal locus. a larger sample size may increase the power to detect such small additive effects in genome-wide scans. despite the smaller additive effect in model, the number of significant markers within kbp of the qtn was comparable to model. additionally, there is an increased number of significant associations further than kbp from the qtns. these may represent false positive associations caused by epistasis, such as markers that are in strong linkage disequilibrium with the fictive epistatic marker. the highest power was observed in the third model. qtns on a common haploblock with epistatic effects create a strong joint qtl and therefore in more than 75% of simulations, a significant marker was located within a distance of kbp to the causal locus. the results show that single marker association methods as emmax are able to detect qtns with small additive effects and a strong positive epistatic interaction. however, in certain situations larger samples than simulated sizes are needed and some results may be confounded by false positives as discussed earlier. on average, a single simulation ran min with genome and min with phenosim on a single core of an intel xeon x processor. to compare this running time with other software tools, we simulated two qtns and neutral loci in a population of diploid individuals using quantinemo. in six minutes, quantinemo generated ~ generations. as the expected coalescent time for a sample is ~ 4ne generations, this is by far not enough to get a realistic variation pattern comparable to what can be achieved by genome in the same time. although forward simulations like quantinemo allow more complex demographic, selection and trait scenarios, the combination of coalescent simulators and phenosim is much more suitable for generating multiple simulations of large sample sizes.  demographic effects, genetic architecture, selection, and different mutation and recombination rates affect the ability to detect the genetic basis of complex traits in natural populations. such population genetic parameters can now be estimated from genome-wide marker sets prior to further analyses. since gwas are widely used in plant and animal genetics, there is a great interest in assessing the power of a particular study or method. using coalescent simulations in conjunction with phenosim, one can investigate the statistical power and other characteristics of gwas methods efficiently. additionally, as different causal markers may contribute different effects to a trait, the essential sample size and number of markers to detect a certain pattern can be estimated. competing interests the authors declare that they have no competing interests. availability and requirements • project name: phenosim • project home page: http://evoplant.uni-hohenheim.de • operating system: platform independent • programming language: python • other requirements: python x • license: no license required • any restrictions to use by non-academics: none authors' contributions tg, ig and kjs conceived the project. tg and ig designed the software. tg wrote the code. ig analyzed the data. kjs supervised the project. all authors contributed to writing of the manuscript. all authors read and approved the final manuscript. supplementary material additional file 1 phenosim v. the archive includes the current version of phenosim as well as a documentation of its usage. for updated versions, please visit the authors' website http://evoplant.uni-hohenheim.de. click here for file acknowledgements this work is supported by the bmbf under the german plant genomics program gabi and the bioenergy initiative; tg is funded by a volkswagen foundation evolutionary biology scholarship. we thank two anonymous reviewers for their comments and sariel hübner for testing the scripts and comments on the software features.
genome-wide association studies are becoming routine in human, animal and plant genetics to understand the connection between naturally occurring genotypic and phenotypic variation. both qualitative and quantitative phenotypes can be generated and it is possible to partition phenotypic variation between additive effects and epistatic interactions between causal variants. coalescent simulations are commonly used in population genetics to simulate genotypes under different parameters and demographic models. here, we present phenosim, a software to add a phenotype to genotypes generated in time-efficient coalescent simulations. by using the coalescent approach to generate genotypes and phenosim to add phenotypes, the data sets can be used to assess the influence of various factors such as demography, genetic architecture or selection on the statistical power of association methods to detect causal genetic variants under a wide variety of population genetic scenarios. phenosim is freely available from the authors' website http://evoplant.uni-hohenheim.de there is a great interest in understanding the genetic architecture of complex traits in natural populations.
 there is a great interest in understanding the genetic architecture of complex traits in natural populations. genome-wide association studies are becoming routine in human, animal and plant genetics to understand the connection between naturally occurring genotypic and phenotypic variation. coalescent simulations are commonly used in population genetics to simulate genotypes under different parameters and demographic models.  here, we present phenosim, a software to add a phenotype to genotypes generated in time-efficient coalescent simulations. both qualitative and quantitative phenotypes can be generated and it is possible to partition phenotypic variation between additive effects and epistatic interactions between causal variants. the output formats of phenosim are directly usable as input for different gwas tools. the applicability of phenosim is shown by simulating a genome-wide association study in arabidopsis thaliana.  by using the coalescent approach to generate genotypes and phenosim to add phenotypes, the data sets can be used to assess the influence of various factors such as demography, genetic architecture or selection on the statistical power of association methods to detect causal genetic variants under a wide variety of population genetic scenarios. phenosim is freely available from the authors' website http://evoplant.uni-hohenheim.de 