Installation

Install

SweepLink installs with conda, which brings the executable and all four companion scripts in one go:

$ conda install -c CHANNEL sweeplink

Note

The conda package is not published yet. Until it is, use Building from source below — the channel name will be filled in here on release.

That gives you five commands:

Command

What it is

sweeplink

The inference program itself — see sweepLink tasks.

sweeplink-vcf2input

Script that converts VCF → allele counts and meta file.

sweeplink-extract

Script to extract the loci under selection from the results.

sweeplink-plot

Script to plot the results of the inference.

sweeplink-plot-posteriors

Script to plot the posterior of the population size.

The four sweeplink-* scripts are documented under Companion scripts.

Check it works

Run the executable with no arguments to see the version and the available tasks:

$ ./sweeplink
                 sweepLink 1.0.0
                -----------------

            University of Fribourg
  https://bitbucket.org/wegmannlab/sweepLink

Commit 574598274fbe838e3655a47e6d38b417a038eab7

  - Used executable: ./sweeplink
  - Available tasks:
        - calculateLL        Calculate the log-likelihood for a set of parameters.
        - calculateLLForN    Calculate the log-likelihood for each site for a given grid on N.
        - calculateLLForS    Calculate the log-likelihood for each site for a given grid on s.
        - calculateLLForSH   Calculate the log-likelihood for each site for given grids on s and h.
        - help               Print a categorized reference of all command-line options.
        - infer              Inferring selection from time-series data.
        - simulate           Simulating under the SweepLink model.

  - Usage: ./sweeplink taskName [options]
  - sweepLink terminated successfully in 0 seconds!

The version and commit will be whatever you installed. Then simulate a small dataset and infer on it, which exercises the whole path:

$  # Simulate an allele counts file with 100 loci sampled from one population
$ ./sweeplink simulate --numLoci 100 --numPop 1 --binomialN 1000 --mu_a_A 1e-8
$  # Run inference of selection across those loci
$ ./sweeplink infer --meta sweeplink_meta.txt --counts sweeplink_alleleCounts.txt --mu_a_A 1e-8 --burnin 10 --iterations 100

Both should end with sweepLink terminated successfully, and the second writes the output files described in File formats.

Note

--mu_a_A is mandatory for every task — there is no sensible default mutation rate, so a command without it stops immediately.

Building from source

Needed if you want to develop sweepLink, or are on a platform the conda package does not cover.

Requirements, download and compile

SweepLink requires:

  • A compiler compatible with C++17 or higher. We recommend gcc version 9 or higher — check yours with gcc --version.

  • cmake version 3.14 or higher — check with cmake --version.

You should be able to build sweepLink without any problems.

Use Homebrew to install cmake, autoconf and automake:

$ brew install cmake autoconf automake

Build sweepLink under Windows Subsystem for Linux.

On most computing clusters you can load recent cmake and gcc versions using modules.

Download the repository:

$ git clone --depth 1 https://bitbucket.org/wegmannlab/sweeplink.git

Compile it with cmake:

$ cd sweeplink
$ mkdir -p build
$ cd build
$ cmake .
$ cmake --build .

This leaves a compiled sweeplink program in the repository directory.

The companion scripts are a separate Python package in the tools directory, and are not built by cmake. Install them with pip:

$ pip install ./tools

SweepLink itself only reads allele counts, not VCF files, and only writes raw posterior files, not figures — the scripts fill both gaps and are used throughout the tutorial.

Next

The tutorial walks through a complete analysis on a small bundled dataset.