File formats¶
Every file sweepLink and its companion scripts read or write. All of them are plain tab-separated text.
Input files¶
Sample list¶
Read by sweeplink-vcf2input, not by
sweepLink itself. Tab-separated with a header; lines starting with #
are ignored. Three named columns, in any order:
# time in generations before present
sample population time_in_gen
HG_TP01_0017 Pop1 130
HG_TP01_0072 Pop1 130
sampleMust match the sample name in the VCF.
populationFree-form label. Becomes the population name everywhere downstream.
time_in_genInteger. Whether larger means older is set by
--time-direction(bp= before present,forward= forward in time).
Meta file (--meta)¶
Tab-separated, no header, three columns:
time_130BP_Pop1 0 Pop1
time_115BP_Pop1 15 Pop1
time_101BP_Pop1 29 Pop1
Column |
Meaning |
|---|---|
1 |
Sample label. Must appear as a column name in the counts file. |
2 |
Time in generations. Forward, so 0 is the oldest. |
3 |
Population name. |
One row per (time point, population) combination. Populations may be missing at individual time points — ragged designs are handled.
Allele counts (--counts)¶
Tab-separated with a header whose first two fields are placeholders:
- - time_130BP_Pop1 time_115BP_Pop1 time_101BP_Pop1
1 579 3/4 15/20 5/8
1 740 0/4 0/20 0/8
Column |
Meaning |
|---|---|
1 |
Chromosome. |
2 |
Position. |
3+ |
One per sample label in the meta file, in any order. |
Each cell is c/n: c copies of the derived allele out of n sampled
chromosomes. c > n is an error.
Important
Missing data is written 0/0, not NA. A cell with n = 0 contributes
nothing to the likelihood.
Labels file (--labels, plotting only)¶
Read by sweeplink-plot to annotate peaks.
Tab-separated with a header; needs chr, pos and label columns and ignores
any others — so a _selected.txt file with a label column added works
directly:
chr pos label label_bottom
2 50001 true sweep 2:50001
Column |
Meaning |
|---|---|
|
Text above the evidence panel, italic and rotated. |
|
Optional. Text beside the marker in the |s| panel, bold. Defaults to the locus’s own |
Rows where both labels are empty are skipped; leaving one empty annotates only the other panel.
Configuration and initial values (--config, --initVals)¶
--config takes a table with the same columns as <out>_config.txt below.
--initVals takes three columns — parameter name, value, jump size.
Output files¶
Every file below is prefixed with whatever --out was given (sweeplink if
omitted). Examples use the tutorial’s prefix, doc.
<out>.parameters — the reproducibility record¶
Every argument the run used, including the ones left at their defaults and the random seed. Two columns, name and value:
Note
This one file is named after --out; if you did not pass --out it is named
after the task instead — infer.parameters, simulate.parameters — not
after the default output prefix. Every other file below uses the prefix.
counts doc_alleleCounts.txt
grid_abs_s 0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08
iterations 100000
linkage true
log10N.alpha 16.0
...
Feed it straight back to repeat the run exactly:
$ ./sweeplink doc.parameters
This file is also how the companion scripts discover a run’s settings, which is
why they need nothing but --prefix.
<out>_config.txt — per-parameter setup¶
One row per model parameter: which files it was written to, whether it was updated, which proposal kernel it used, and its prior parameters.
name priorParameters traceFile meanVarFile ... update propKernel
log10N 16.0,4.0 doc doc 1 normal
h doc_h doc_h 0 randomInteger
The quickest way to confirm what was actually inferred: update is 0 for
anything held fixed.
<out>_trace.txt — the MCMC samples¶
One column per global parameter, one row per retained iteration (every
--thinning-th).
kappa_1 kappa_2 nu_1 nu_2 mu_0 m_Pop1_Pop1 log10N_Pop1 N_Pop1 ...
0.000130013 0.134935 0.226948 0.000106703 0.452903 1 4.25177 17855.4
Warning
Use the log10N_* column, not N_*. The chain samples log10N, so N is
strongly right-skewed and its arithmetic mean sits far out in the upper tail.
The right summary is 10^mean(log10N).
<out>_s_trace.txt holds the same for the per-locus selection coefficients.
The matching _h_ and _z_ files are not written by default — see
which per-locus files are written.
<out>_meanVar.txt — posterior summaries¶
name posterior_mean posterior_variance
kappa_1 7.3429e-05 1.47218e-09
Computed over all iterations, not just the retained ones — so its numbers will not exactly match a mean taken from the thinned trace.
<out>_{s,h,z}_statePosteriors.txt — the main result¶
For each locus, the posterior probability of every state on the grid. Row names
are <param>_<chr>_<pos>_<population>:
name state_0 state_1 ... state_8 state_9 ... state_17
s_1_579_Pop1 0 0 ... 0.50731 0.49064 ... 0
Important
The states are grid indices, not values. Map them back with grid_abs_s
from the .parameters file. Because the grid is symmetric, with the default
18 states both index 8 and index 9 mean neutral — any sum over states has to
add the two together.
Rows are accumulated over every iteration and sum to 1, so the underlying counts
recover as k = round(p × iterations).
<out>_{s,h,z}_posteriorMode.txt¶
The single most probable state per locus — again an index, not a value.
name posterior_mode
s_1_579_Pop1 8
<out>_LL*.txt — likelihood surfaces¶
Written by the four calculateLL* tasks, each to its own file —
<out>_LL.txt, <out>_LLForS.txt, <out>_LLForSH.txt, <out>_LLForN.txt —
so they can share an --out. Columns depend on the task; for calculateLLForN
with --sumLL there is a single row:
chr pos LL0_N_1.000000 LL1_N_1.149757 ...
sumLL - -4954.27 -4953.52 ...
<out>_selected.txt¶
Written by sweeplink-extract, not by
sweepLink:
chr pos direction mean_s samples_supporting samples_against posterior run
2 8126 negative -0.0220707 100000 0 0.99999 doc
mean_s is the signed posterior mean of the selection coefficient; posterior
is the smoothed probability that the sign is as reported.