Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
sweepLink documentation
Light Logo Dark Logo

Getting Started

  • Installation
  • Tutorial
    • Step 1: Preparing the Input
    • Step 2: Inference
    • Step 3: Results
    • Step 4: Refining
  • Using your own data

User Manual

  • How it works
  • sweepLink tasks
    • Inference
    • Simulation
    • Likelihood surfaces
  • Companion scripts
    • sweeplink-vcf2input
    • sweeplink-extract
    • sweeplink-plot
    • sweeplink-plot-posteriors
  • File formats
  • FAQ
Back to top

sweeplink-vcf2input¶

Converts a VCF and a sample list into the two files sweepLink reads: an allele counts file and a meta file.

$ sweeplink-vcf2input \
      --vcf data/example.vcf.gz \
      --samples data/samples.txt \
      --time-direction bp \
      --out-prefix doc

That writes doc_alleleCounts.txt and doc_meta.txt, and prints a table of how many samples and sites survived at each time point — worth reading before you rely on the oldest samples, which in ancient DNA are usually the thinnest.

Required¶

--vcf <file>

Input VCF or BCF; may be bgzipped. A .tbi/.csi index is only needed with --region.

--samples <file>

Tab-separated sample list with sample, population and time_in_gen columns — see file formats. Lines starting with # are ignored.

--out-prefix <prefix>

Prefix for the two output files.

--time-direction <bp|forward>

How to read the time_in_gen column. Required, with no default, because getting it wrong silently reverses your time series.

  • bp — before present: a larger number is older.

  • forward — forward in time: a smaller number is older.

Either way the meta file comes out in sweepLink’s own convention, where time runs forward and 0 is the oldest point.

Optional¶

--region <chr:start-end>

Convert only part of the VCF, e.g. chr2:1-5000. Needs an indexed VCF.

--ploidy <diploid|pseudo-haploid>

How to count alleles per individual. Default diploid — both alleles are counted, so each individual contributes 2 to n. Use pseudo-haploid for low-coverage ancient DNA, where one allele is sampled per individual and each contributes 1.

Filtering¶

All filters are applied while reading, and the counts of what they removed appear in the printed summary.

--min-mac <n>

Minimum minor allele count across all populations and time points. Default 1, i.e. keep everything. 2 drops singletons, 3 also drops doubletons.

--no-singletons

Equivalent to --min-mac 2. If --min-mac is set higher, the higher value wins.

--min-maf <f>

Minimum minor allele frequency across all time points and populations. Default 0.0.

--min-segregating-timepoints <n>

Keep only sites that segregate in at least this many time points. Default 1.

--segregating-scope <any|all>

What “segregating at a time point” means when there is more than one population — segregating in any population (default) or in all of them.

--max-missing-recent <f>

Maximum fraction of missing data allowed at the most recent time point, e.g. 0.2 for 20%. Default 1.0 (off).

--max-missing-total <f>

Maximum fraction of missing genotypes across all populations and time points. Default 1.0 (off).

Tip

Monomorphic sites carry no information about selection and are the largest single category dropped on most datasets. Filtering harder than that trades sensitivity for runtime — sweepLink handles low counts and missing data directly, so there is little to gain from aggressive minor-allele filtering.

Output¶

Both files are described in file formats. Missing data is written 0/0.

Next
sweeplink-extract
Previous
Companion scripts
Copyright © 2024, Ekaterina Noskova
Made with Sphinx and @pradyunsg's Furo
On this page
  • sweeplink-vcf2input
    • Required
    • Optional
    • Filtering
    • Output