Skip to main content

Module rt_cache

Module rt_cache 

Source
Expand description

On-disk cache of abstract RT predictions.

The RT model’s abstract RT is a pure function of (model, peptide sequence) — it does not depend on the run being searched (the run-specific part is the on-data calibration applied downstream). So predicting ~1.2M unique peptides (~18s) is repeated in full on every search over the same FASTA/digest/model. This module memoizes those predictions to a file keyed by the model’s content fingerprint, so repeat runs only predict sequences not seen before.

Cache values are the model’s exact f64 output, written with Rust’s round-trippable float formatting, so a cache hit yields a bit-identical prediction to recomputing — search output is unchanged whether cached or not.

Location: $UNO_RT_CACHE_DIR if set, else $XDG_CACHE_HOME/uno/rt, else ~/.cache/uno/rt. Set UNO_RT_CACHE=0 to disable (always recompute, never read or write).

Functions§

predict_many_cached
Predict abstract RT for seqs, reusing an on-disk cache keyed by the model fingerprint. Only sequences missing from the cache are run through the model; newly predicted (seq, rt) pairs are appended to the cache file. The returned vec is aligned to seqs and bit-identical to model.predict_many(seqs).
with_memory_cache
Retain prediction maps across sequential per-run searches on this thread. The guard restores the previous scope even on early return or panic.