Tutorial¶
This tutorial takes you from a VCF of time-series genotypes to a final list of loci under selection, with an estimate of the selection coefficient at each of them. It uses a small dataset bundled with sweepLink, and every command and every number on these pages comes from actually running it.
The analysis has two rounds, and it is worth understanding why before you start.
Round 1 — a genome-wide scan
SweepLink looks at every locus at once, with its linkage model switched on. Neighbouring loci inform each other, which is what lets a sweep be detected from the shared signal of a whole region rather than from one lucky variant. At the same time it estimates the effective population size N from all the data together. The result is a shortlist of loci for which selection is supported.
Round 2 — focused estimates
The shortlist is then re-analysed on its own. Two things change:
N is fixed at the value round 1 estimated, instead of being inferred again from a handful of loci that could not constrain it.
The linkage model is switched off, because the shortlisted loci are no longer neighbours on the genome. The distances between them are meaningless, so the model that uses those distances has to go.
What comes out is a per-locus selection coefficient that is not being pulled toward its neighbours or shared with a population size that is still moving.
The steps
Step |
Page |
What happens |
|---|---|---|
1 |
VCF + sample list → allele counts and meta file |
|
2 |
The genome-wide scan |
|
3 |
Plot the scan and get the loci under selection |
|
4 |
The focused second round, and the final figure |
The example dataset¶
Everything below uses the files in the tutorial/data directory:
example.vcf.gz— genotypes for 241 individuals sampled at 11 timepoints.samples.txt— which individual belongs to which population and timepoint.
The data are simulated under a human-like model, with a sweep placed on one of the two small chromosomes. That makes it a good tutorial dataset: you know what the answer should look like, and the run finishes in minutes rather than hours.
Before you start¶
You need the sweepLink executable and the four companion scripts (sweeplink-vcf2input, sweeplink-extract, sweeplink-plot and sweeplink-plot-posteriors), all of which are used below. Installing sweepLink gives you all five — see Installation.
Every command below is written as if you are inside the tutorial directory, so start there:
cd tutorial