template<typename T>
class Sequence::PolyTableSlice< T >
A container class for "sliding windows" along a polymorphism table.
This class is a simple container to store "sliding windows" along an object in the inheritance hierarchy of Sequence::PolyTable.
Sliding windows are used in population genetics to look at variation in levels of diversity along a region. This class supports two simple ways to make such windows. The first is the slide a window of some length (in base pairs) along your sequence, recording the SNPs in each window. The number of base pairs that you move the window each time is the "step length." The second type of window is to slide a window of a constant number of segregating sites along the SNP table. In the latter case, the step length is the number of segregating sites by which to move the beginning of the window each time. The two different constructors for this class correspond to these two different window types.
These two types of window are useful in different contexts, and it's up to the user to decide which one s/he wants. Please note that all this class does is facilitate the generation of the windows. It does not address any of the statistical headaches that arise from sliding window analyses. These issues include multiple test correction, non-independence of overlapping windows, variation in selective constraing along a sequence, and variation in power from window to window with respect to hypothesis testing.
The user should be aware that the approach used in Kreitman and Hudson (1991) "Inferring the evoltionary histories of the Adh and Adh-dup loci in
Drosophila melanogaster from patterns of polymorphism and divergence." Genetics 127: 565 describe a clever variant of the sliding window. They slide along the physical sequence, but keep the number of synonymous/silent sites constant. Their procedure mitigates some of the difficulties mentioned above, but it is not implemented here because it relies on having an annotation for the SNP table available.
The user is also referred to Andolfatto, P., J. D. Wall and M. Kreitman, 1999 "Unusual haplotype structure at the proximal breakpoint of In(2L)t in a
natural population of Drosophila melanogaster." Genetics 153:1397-1399, which discusses the multiple testing issue.
The following example reads in data from Hudson's program ms. Tajima's D is calculated for non-overlapping windows of size 0.1:
#include<iostream>
#include<cstdio>
int main(int argc, char **argv)
{
std::cin >> p;
int i;
while( (i=d.fromstdin()) && i != EOF)
{
while(itr < windows.cend())
{
SimData window = windows.get_slice(itr);
PolySIM analyze(&window);
std::cout << analyze.
TajimasD() <<
'\t';
}
std::cout << std::endl;
}
}
- Note
- The two constructors are left ambiguous intentionally! See their documentation below. The ambiguity is so that the progammer is forced to thing about which type of slding window to use.
- Examples:
- slidingWindow.cc, and slidingWindow2.cc.
Definition at line 117 of file PolyTableSlice.hpp.