1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! `salmon-model`: statistical models used during quantification.
//!
//! # What these models are for
//!
//! Sequencing is not a uniform sampler. A fragment's chance of being observed
//! depends on how long it is, what sequence sits at its ends, how GC-rich it is,
//! and where in the transcript it starts. Left uncorrected, those effects are
//! read as differences in *abundance*, which they are not. Each model here
//! measures one such effect from the data itself and hands the quantifier a
//! correction factor:
//!
//! * [`fld`] — the fragment-length distribution, and automatic library-type
//! detection ([`libdetect`]);
//! * [`seqbias`] — sequence-specific bias, from primer/ligation preferences at
//! fragment ends;
//! * [`gcbias`] — fragment GC bias, largely from PCR amplification efficiency;
//! * [`posbias`] — positional bias along the transcript body, e.g. 3' pileup from
//! degraded RNA;
//! * [`bias`] — combines them into a corrected effective length per transcript.
//!
//! Every model is *observed vs expected*: count what was actually seen, count
//! what would have been seen under no bias, and take the ratio. That framing is
//! why the dump files in [`dumps`] always come in `obs`/`exp` pairs.
/// Fixed-point scale for deterministic bias-model mass accumulation. Bias
/// observed models sum per-fragment posterior masses (each in `[0,1]`) into
/// bins; an f64 `+=` is non-associative, so the accumulated model — and hence
/// bias correction — varies with the worker-thread fragment partition (thread
/// count). Accumulating `round_down(mass * BIAS_WEIGHT_SCALE)` as integers makes
/// the sum associative (order/thread-count independent). `2^20` keeps the
/// per-contribution resolution at ~1e-6 (ample for these coarse models) while a
/// bin total (~num_fragments × 2^20) stays far below `u64::MAX`.
///
/// Same reasoning as the equivalence-class weight accumulator: integer addition
/// commutes, floating-point addition does not, so identical input must give
/// identical output regardless of how the work was split.
pub const BIAS_WEIGHT_SCALE: f64 = as f64;
/// Quantize a bias mass (`[0,∞)`, typically a `[0,1]` posterior) to the
/// fixed-point integer accumulator. Truncates (rounds toward zero) — cheaper
/// than `round()` and the ≤1-ULP downward bias is negligible and cancels under
/// the model's normalization.
///
/// ("ULP" is a unit in the last place: the smallest difference representable at
/// that magnitude.)
// Re-exports so callers can write `salmon_model::SBModel` rather than naming the
// submodule; the modules above remain the real homes.
pub use ;
pub use FragLengthSource;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;