sweeplink-plot¶
The two-panel figure of the selection signal along the genome.
$ sweeplink-plot --prefix doc
Writes doc_selection.png. Nothing else is needed — the run’s settings come
from doc.parameters.
Panel A, evidence. One dot per locus at -log10(1 - P), where P is the
posterior probability that the sign of s is as inferred. Dots are coloured
only by chromosome, alternating grey and blue; the red dashed line is the
selection threshold. A locus is under selection by being above it, exactly as in
a Manhattan plot.
Panel B, effect size. The posterior mean of |s| along the genome as a
shaded area, with the loci that passed the threshold marked in red.
Note
The evidence axis is -log10(1 - P) rather than P because the posterior
saturates: with 100,000 samples nothing can exceed 100000/100001, so on a plain
0–1 axis every strong locus is crushed into the top sliver.
Input¶
--prefix/--dirs+--run-nameThe run(s) to plot. See combining several runs. All runs must share the same
iterations, since one threshold line is drawn for all of them, and a locus may not appear twice.--round2-prefix/--round2-dirs+--round2-run-nameA second, refined round to overlay. Its estimates appear as filled red markers, the first round’s as hollow ones, joined by a line so the shift of each locus is visible.
--counts <file>,--iterations <n>,--round2-iterations <n>Override what is recorded in the
.parametersfiles. Valid only with a single prefix.
Output¶
--out <file>Where to write. Default
<prefix>_selection.png. The extension picks the format —.png,.pdfor.svg.--dpi <n>Resolution for raster output. Default 200. Raise it for print —
--dpi 300or--dpi 600.
Tip
Which format depends on how many loci you are plotting. A vector file stores one element per locus, so it grows with the data, while a PNG is the same size whatever it plots:
Loci |
PNG |
SVG |
|---|---|---|
413 |
139 KB |
109 KB |
4,000 |
105 KB |
591 KB |
For a few thousand loci — the tutorial, a --region zoom, the --compare
scatter — vector wins on both size and quality, which is why the figures in
these docs are SVG.
Past roughly ten thousand loci that reverses. The growth is about 138 bytes per
locus, so a chromosome with 500,000 loci would make an SVG of around 69 MB:
slow to open, and awkward in a repository or a manuscript. There, use
--dpi 300 for a print-quality PNG at a fraction of the size.
--showOpen the figure in matplotlib’s own interactive window (pan, rubber-band zoom, save) instead of writing a file. With
--outas well, both happen. Needs a local display, so it will not work over a plain SSH session.
Appearance¶
--theme <light|dark>Colours for a light or a dark page. Default
light.--title <text>Replaces the default title.
--markers <dot|triangle>Marker shape in panel B.
triangleadditionally encodes direction — up for positive, down for negative. Defaultdot; the direction is in_selected.txteither way.--region <chr[:start-end]>Zoom both panels to one chromosome or a stretch of it, e.g.
2or2:10000-60000. Either side of the range may be left open (2:10000-). This is a data filter, so it works with or without--show.The chromosome is named exactly as it appears in the first column of the counts file. In the tutorial’s data that is
2, so--region chr2matches nothing; if your own file useschr2, thenchr2is what to pass.
Annotating peaks¶
--labels <file>A tab-separated file with
chr,posandlabelcolumns, plus an optionallabel_bottom— see file formats. The two panels say two different things about the same locus:Column
Panel
Style
labelA, evidence
italic, rotated, above the panel with a leader line down to the peak
label_bottomB,
|s|bold, horizontal, just to the right of the marker
chr pos label label_bottom 2 50001 true sweep 2:50001
Without a
label_bottomcolumn, panel B falls back to the locus’s ownchr:pos— which for the row above is2:50001anyway, so the column is only needed when you want different text there. Either label may be left empty to annotate just one panel.Keep the annotation short: it has to share the figure with the data, and a short label is far less likely to collide with a neighbour. Room above panel A is made automatically from the measured size of the text, so long labels do not overrun the axis — but many labels packed into one narrow region will still overlap, simply because there is no space.
The threshold¶
The same three forms as sweeplink-extract, and they mean the
same thing — pass at most one, and pass the same value you extracted with so the
line matches the shortlist:
--max-samples-against <n> · --min-posterior <p> · --min-evidence <e>
Comparing the two rounds¶
--compareOnly with a second round. Writes an additional figure,
<out-stem>_comparison.png: a scatter of every paired locus’s|s|in round 1 against round 2, with the line where the two would agree. The quickest way to see that removing the linkage model shifts estimates up, and by how much.
$ sweeplink-plot --prefix doc --round2-prefix doc_r2 --compare