Detecting evidence of selection and evolution in population genomes is crucial to understanding the history and the selective pressures experienced by a population. While there are many statistics for identifying regions of the genome under selection, there is a need for software to enable reproducible, standardised results. The statistics implemented in the `zalpha` R package use the relationships and correlations in genetic variation to find patterns that could be indicative of a selective sweep.
The methods contained within this R package are a development of the statistics published by `@Jacobs:2016`. This package allows users to run a range of selection statistics on genetic data, which previously were not made publicly available in software. The software is designed to be flexible to allow users to efficiently combine statistics and is open source.
The methods contained within this R package are a development of the statistics published by @Jacobs:2016. This package allows users to run a range of selection statistics on genetic data, which previously were not made publicly available in software. The software is designed to be flexible to allow users to efficiently combine statistics and is open source.
The package also allows users to utilise a linkage disequilibrium (LD) profile, taking into account expected relationships between alleles, ultimately increasing the power of the statistics. This is important as LD varies immensely along the genome, with recombination the biggest contributor to LD fluctuations `[@Jeffreys:2001]`.
The package also allows users to utilise a linkage disequilibrium (LD) profile, taking into account expected relationships between alleles, ultimately increasing the power of the statistics. This is important as LD varies immensely along the genome, with recombination the biggest contributor to LD fluctuations [@Jeffreys:2001].
# Statement of Need
The purpose of the `zalpha` package is to
The purpose of the `zalpha` package is to:
* Allow users to accurately apply the $Z_{\alpha}$ suite of statistics to find candidate regions of the genome for a selective sweep
* Generate results that are reproducible
...
...
@@ -51,13 +52,13 @@ The purpose of the `zalpha` package is to
# Software and Methodology
The `zalpha` package examines correlations between SNPs (single nucleotide polymorphisms) along a chromosome. If SNPs are highly correlated in a region of a chromosome in relation to other regions of the chromosome, this could indicate the presence of a selective sweep `[@Vitti:2013]`.
The `zalpha` package examines correlations between SNPs (single nucleotide polymorphisms) along a chromosome. If SNPs are highly correlated in a region of a chromosome in relation to the rest of the genome, this could indicate the presence of a selective sweep [@Vitti:2013].
Correlation, in the context of genetics, is the ability to predict the value of one SNP, given the value of another. An example is given in \autoref{fig:Figure1}A. The metric used to measure correlation is r^2^ `[@Cutter:2019]`.
Correlation, in the context of genetics, is the ability to predict the value of one SNP, given the value of another. An example is given in \autoref{fig:Figure1}A. The metric used to measure correlation is r^2^ [@Cutter:2019].


When a selective sweep occurs, the locus under selection becomes more frequent in the population, as individuals possessing the beneficial allele are more likely to survive and reproduce. When this happens, variants nearby the selected locus will also sweep, a phenomenon known as “hitchhiking” `[@Maynard:1974]`. This creates a region of the genome that is highly correlated. Eventually recombination will erode away these correlations.
When a selective sweep occurs, the locus under selection becomes more frequent in the population, as individuals possessing the beneficial allele are more likely to survive and reproduce. When this happens, variants nearby the selected locus will also sweep, a phenomenon known as “hitchhiking” [@Maynard:1974]. This creates a region of the genome that is highly correlated. Eventually recombination will erode away these correlations.
`zalpha` allows the user to apply a range of statistics to genetic data. \autoref{fig:Figure1}B shows a target locus with a window, the size of which is set by the user, centred on the locus. Any SNPs either side that fall within the window to the left and right of the target locus are contained within sets L and R respectively. The statistic $Z_{\alpha}$, after which the package is named, is defined as:
\begin{equation}\label{eq:Zalpha}
...
...
@@ -71,7 +72,7 @@ The other base statistic supplied in the `zalpha` package is $Z_{\beta}$, as def
\end{equation}
In \autoref{fig:Figure1}B the r^2^ values for $Z_{\beta}$ are represented as purple squares.
Typically, a user will want to find the maximum $Z_{\alpha}$ statistic in a region of a chromosome, and compare this to other regions, to find possible evidence of selection for that region.
Typically, a user will want to find the maximum $Z_{\alpha}$ statistic in a region of a chromosome, and compare this to other regions, to find possible evidence of selection for that region.
The package is designed to be as user-friendly as possible and is reflected in the flexibility of the input requirements. The basic statistics only require three elements:
...
...
@@ -79,11 +80,11 @@ The package is designed to be as user-friendly as possible and is reflected in t
* a window size, and
* a matrix of SNP values where the rows are SNPs and the columns are chromosomes. This matrix could be binary, where the 0s represent ancestral alleles and the 1s derived, or it could be nucleotides (i.e. As, Cs, Gs, and Ts), or any other biallelic labelling system.
One of the benefits of this package is the ability to calculate multiple statistics simultaneously. During a selective sweep, the correlations between alleles near to the selected locus increase. This means both $Z_{\alpha}$ and $Z_{\beta}$ should be higher than in other areas of the genome not experiencing selective pressure. Towards the end of a selective sweep however, the correlations between the sets of alleles on the left and the right of the target locus are expected to diminish `[@Kim:2004]`. This suggests at the end of a sweep, $Z_{\alpha}$ should remain high, but $Z_{\beta}$ will reduce. Thus, it is advantageous to calculate and combine the different statistics to ascertain the strength and stage of sweeps. $Z_{\alpha}$/$Z_{\beta}$ is a simple way to achieve this.
One of the benefits of this package is the ability to calculate multiple statistics simultaneously. During a selective sweep, the correlations between alleles near to the selected locus increase. This means both $Z_{\alpha}$ and $Z_{\beta}$ should be higher than in other areas of the genome not experiencing selective pressure. Towards the end of a selective sweep however, the correlations between the sets of alleles on the left and the right of the target locus are expected to diminish [@Kim:2004]. This suggests at the end of a sweep, $Z_{\alpha}$ should remain high, but $Z_{\beta}$ will reduce. Thus, it is advantageous to calculate and combine the different statistics to ascertain the strength and stage of sweeps. $Z_{\alpha}$/$Z_{\beta}$ is a simple way to achieve this.
Recombination is a process that has the effect of breaking down the relationship between alleles. However, it is known that recombination does not occur uniformly across the genome. It is therefore imperative to consider recombination when calculating statistics based on LD measures. This package allows the user to supply a population LD profile, providing information on the expected relationships between alleles given the genetic distances between them. Supplying this data increases the power of the statistics and creates more opportunities for combinations and comparisons between statistics. Users can specify whatever units they wish for genetic distance (for example centimorgans (cM)), derived from an appropriate data source. The software contains a function for creating an LD profile from the data. Ideally, an LD profile would be created from a neutral data source without selection, for example from a simulation with relevant population parameters. However, this is not always possible, so creating an LD profile from the same data being analysed is sufficient.
There are many statistics included in the package for adjusting for expected r^2^ using the LDprofile and genetic distances between SNPs. For more details of how they are derived see the paper by `@Jacobs:2016`. It is recommended the user runs all the statistics using the `Zalpha_all()` function and then picks and chooses the ones they are interested in, perhaps even creating their own. For example, $Z_{\alpha}$/${Z_{\alpha}^{E[r^2]}}$ performs well as a simple way to adjust for expected r^2^. if it is known that the r^2^ values for each genetic distance are normally distributed, ${Z_{\alpha}^{Zscore}}$ is appropriate, otherwise ${Z_{\alpha}^{BetaCDF}}$ may be useful.
There are many statistics included in the package for adjusting for expected r^2^ using the LDprofile and genetic distances between SNPs. For more details of how they are derived see the paper by @Jacobs:2016. It is recommended the user runs all the statistics using the `Zalpha_all()` function and then picks and chooses the ones they are interested in, perhaps even creating their own. For example, $Z_{\alpha}$/${Z_{\alpha}^{E[r^2]}}$ performs well as a simple way to adjust for expected r^2^. if it is known that the r^2^ values for each genetic distance are normally distributed, ${Z_{\alpha}^{Zscore}}$ is appropriate, otherwise ${Z_{\alpha}^{BetaCDF}}$ may be useful.
The output of the functions is in list format. The SNP positions and the values of the statistic(s) are stored in vectors of equal length in the list.