salmon_core/refprovider.rs
1//! Access to reference sequences for alignment validation.
2//!
3//! The mapper needs the forward-strand bytes of a reference to align a read
4//! against. piscem's index does not retain reference sequences, so they are
5//! supplied through this trait (salmon-index persists and serves them). Keeping
6//! it a trait decouples `salmon-map` from the concrete index/store.
7
8/// Provides reference sequences (and decoy status) to the mapper.
9pub trait RefProvider {
10 /// Number of references.
11 fn num_refs(&self) -> usize;
12
13 /// Forward-strand sequence of reference `tid` (ASCII `ACGT`).
14 fn ref_seq(&self, tid: u32) -> &[u8];
15
16 /// Whether reference `tid` is a decoy (genomic) sequence. Reads that align
17 /// best to a decoy are discarded. Defaults to no decoys.
18 fn is_decoy(&self, _tid: u32) -> bool {
19 false
20 }
21}