Skip to main content

Module libdetect

Module libdetect 

Source
Expand description

Automatic library-type detection.

§What is being detected, and why

The library type (see salmon_core::libtype) says how reads relate to the RNA they came from: which way the mates point, and whether the protocol preserved strand information. Getting it wrong throws away good mappings or keeps bad ones, and it is a detail users routinely do not know for a public dataset. So salmon can work it out from the data: -l A.

The idea is simple. Map a prefix of the reads with no strand filter, and tally what orientation and strand each confident mapping actually had. A truly unstranded library produces both strands about equally; a stranded one is lopsided. Count ratios then name the format.

Port of salmon’s LibraryTypeDetector (include/.../model/LibraryTypeDetector.hpp). During the first reads of a run, the observed LibraryFormat of each confidently mapped fragment is tallied; once enough samples are seen, the most likely orientation and strandedness are inferred from the count ratios using salmon’s 30%/70% thresholds.

Structs§

LibraryTypeDetector
Accumulates observed library formats and infers the most likely type.

Constants§

DEFAULT_SAMPLES_NEEDED
Default number of samples to collect before guessing (matches salmon).

Functions§

infer_format_from_counts
Pure inference of the most likely library format from per-format counts (indexed by LibraryFormat::format_id), applying salmon’s orientation and strandedness thresholds. Order-independent — used both by the prefix-sampling LibraryTypeDetector and by RAD auto-detection, which tallies all unique fragments rather than a thread-order-dependent prefix. Falls back to inward/unstranded when there are no usable samples.