Companion scripts

A small Python package ships alongside the executable and covers everything around the inference itself — preparing input, extracting results, plotting. For the executable’s own options, see sweepLink tasks.

The four commands

Command

What it does

sweeplink-vcf2input

VCF + sample list → allele counts and meta file.

sweeplink-extract

Pull the loci under selection out of a run and set up the second round.

sweeplink-plot

The two-panel figure of the signal along the genome.

sweeplink-plot-posteriors

Violin plot of the posterior of N and other global parameters.

All four come with sweepLink — see installation. If you built from source they install separately, with pip install ./tools.

Dependencies (numpy, pandas, matplotlib, cyvcf2) come with the package. Only sweeplink-vcf2input needs cyvcf2.

Pointing a script at a run

Except for sweeplink-vcf2input, every script takes a run’s output prefix rather than a list of files:

$ sweeplink-plot --prefix doc

The script reads doc.parameters and finds everything else from there — the counts file, the number of iterations, the grid on s, whether linkage was on. This is why nothing else usually has to be passed, and why <prefix>.parameters should be kept next to the other output files.

Combining several runs

Large datasets are normally run one job per chromosome. Every script except sweeplink-vcf2input accepts several runs at once and treats them as one genome-wide analysis. There are two equivalent ways to say so.

--prefix with a list — full prefixes, which may include directories:

$ sweeplink-plot --prefix chr1/sweeplink chr2/sweeplink chr3/sweeplink

--dirs with --run-name — a shortcut for the common case where every run has the same name inside its own directory:

$ sweeplink-plot --dirs chr1 chr2 chr3 --run-name sweeplink

--run-name defaults to sweepLink, which is also sweepLink’s own default --out, so it can usually be omitted. The two forms are interchangeable — they resolve to exactly the same list of prefixes.

sweeplink-plot takes a second, independent pair of these arguments for the refined round: --round2-prefix / --round2-dirs / --round2-run-name.

How runs are combined

The rules differ per script, because what is safe to merge differs:

Script

Combining rule

sweeplink-plot

Loci are concatenated onto one genome axis. All runs must share the same iterations, since one threshold line is drawn for all of them. A locus appearing in two runs is an error.

sweeplink-extract

Each run is thresholded on its own, then the selected loci are concatenated. Runs may differ in length. Meta files and mu_a_A must match.

sweeplink-plot-posteriors

Every MCMC sample from every run goes into one pooled bucket.

Pooling the population size — used both for the violin and for the --N value suggested for round 2 — concatenates the raw log10N samples across runs and reports 10^mean. It is a plain pool, not a precision-weighted average: if two chromosomes genuinely disagree, that shows up as spread rather than being averaged away. --per-chromosome on sweeplink-plot-posteriors draws each run’s own violin next to the pooled one so you can check.