---
title: Selective alignment & sketch mode
description: How salmon maps reads, and when to use --sketch.
---

salmon has two ways to map reads to the transcriptome. Both produce the
equivalence classes the optimizer needs; they trade accuracy against speed.

## Selective alignment (default)

The default mode. salmon finds maximal exact matches (MEMs) between each read and
the index, chains them with the chaining algorithm introduced in minimap2[^minimap2],
and then computes a fast banded alignment score for each candidate placement using
a native-Rust port of the ksw2[^ksw2] extension aligner, accepting a mapping only
if its score clears a fraction of the perfect score (`--minScoreFraction`, default
`0.65`). This rejects spurious mappings that share k-mers with a transcript but do
not actually align well — the key accuracy advantage of selective alignment[^selalign]
over plain pseudoalignment.

Useful knobs:

- `--minScoreFraction <f>` — acceptance threshold as a fraction of the perfect
  score.
- `--ma / --mp / --go / --ge` — match score, mismatch penalty, gap-open and
  gap-extend penalties.
- `--allowDovetail` — admit dovetailed (short-insert) fragments.
- `--orphanChainSubThresh`, `--postMergeChainSubThresh` — chain-pruning
  thresholds applied before alignment (see the note below).

## Sketch mode (`--sketch`)

Alignment-free pseudoalignment[^kallisto]. salmon maps reads using
k-mer/equivalence-class hits without computing per-placement alignment scores.
This is **faster** and is a good fit when you want throughput and your reference
is high-quality.

```sh
salmon quant -i salmon_index -l A --sketch \
  -1 r1.fq.gz -2 r2.fq.gz -p 16 -o out
```

### Orphan policy

When only one mate of a pair maps, salmon can still record an *orphan* mapping.
Sketch mode defaults to a **relaxed** orphan rule — orphan whenever the other
mate has no consistent target — which tracks selective alignment more closely
and improves agreement with the gold-standard results.

- `--sketchStrictOrphans` switches to the **conservative** rule: only orphan a
  pair when the other mate had *no matching k-mers at all*.

### Dovetail

`--allowDovetail` is honored in sketch mode as well, admitting dovetailed
short-insert fragments.

:::note[Parity with C++ salmon]
2.0 currently defaults `--orphanChainSubThresh` and `--postMergeChainSubThresh`
to `0.0` (align every candidate), which is marginally more sensitive than C++
salmon's `0.95` / `0.9`. Quantification is essentially unaffected
(per-transcript Pearson ≈ 0.999). To reproduce C++ mapping counts exactly, pass
`--orphanChainSubThresh 0.95 --postMergeChainSubThresh 0.9`.
:::

## References

[^kallisto]: Bray, N. L., Pimentel, H., Melsted, P., & Pachter, L. (2016). Near-optimal probabilistic RNA-seq quantification. *Nature Biotechnology*, 34(5), 525–527. https://doi.org/10.1038/nbt.3519

[^selalign]: Srivastava, A., Malik, L., Sarkar, H., Zakeri, M., Almodaresi, F., Soneson, C., Love, M. I., Kingsford, C., & Patro, R. (2020). Alignment and mapping methodology influence transcript abundance estimation. *Genome Biology*, 21, 239. https://doi.org/10.1186/s13059-020-02151-8

[^minimap2]: Li, H. (2018). Minimap2: pairwise alignment for nucleotide sequences. *Bioinformatics*, 34(18), 3094–3100. https://doi.org/10.1093/bioinformatics/bty191

[^ksw2]: Suzuki, H., & Kasahara, M. (2018). Introducing difference recurrence relations for faster semi-global alignment of long sequences. *BMC Bioinformatics*, 19(45). https://doi.org/10.1186/s12859-018-2014-8 — salmon 2.0 uses [ksw2rs](https://github.com/COMBINE-lab/ksw2rs), a native-Rust port of [ksw2](https://github.com/lh3/ksw2).
