pub struct TimsTofSyntheticsDataHandle {
pub connection: Connection,
}Fields§
§connection: ConnectionImplementations§
Source§impl TimsTofSyntheticsDataHandle
impl TimsTofSyntheticsDataHandle
pub fn new(path: &Path) -> Result<Self>
pub fn read_frames(&self) -> Result<Vec<FramesSim>>
pub fn read_scans(&self) -> Result<Vec<ScansSim>>
pub fn read_peptides(&self) -> Result<Vec<PeptidesSim>>
pub fn read_ions(&self) -> Result<Vec<IonSim>>
Sourcepub fn read_mobility_env(&self) -> Result<MobilityEnv>
pub fn read_mobility_env(&self) -> Result<MobilityEnv>
Read the run’s mobility environment from experiment_conditions, falling
back to timsTOF defaults when the table/columns are absent (pre-P1 DB).
Requires all three env columns; a partially-migrated table falls back to
defaults rather than erroring on a missing column.
pub fn read_peptides_scalar(&self) -> Result<Vec<PeptideScalar>>
Sourcepub fn read_peptides_scalar_for_ids(
&self,
peptide_ids: &[u32],
) -> Result<Vec<PeptideScalar>>
pub fn read_peptides_scalar_for_ids( &self, peptide_ids: &[u32], ) -> Result<Vec<PeptideScalar>>
Read scalar peptides for a specific set of ids (chunked IN query), so
the lazy projector path loads only the batch’s candidates instead of the
whole table. Order matches read_peptides_scalar (ORDER BY peptide_id).
Sourcepub fn read_ions_scalar(&self, env: &MobilityEnv) -> Result<Vec<IonScalar>>
pub fn read_ions_scalar(&self, env: &MobilityEnv) -> Result<Vec<IonScalar>>
Read ions as scalar-native trunk entities (no scan-occurrence vectors).
CCS is read directly if a ccs column exists, otherwise derived from the
legacy inv_mobility_gru_predictor (1/K0) under env.
Sourcepub fn read_ions_scalar_for_peptides(
&self,
peptide_ids: &[u32],
env: &MobilityEnv,
) -> Result<Vec<IonScalar>>
pub fn read_ions_scalar_for_peptides( &self, peptide_ids: &[u32], env: &MobilityEnv, ) -> Result<Vec<IonScalar>>
Read scalar ions for a specific set of peptide ids (chunked IN query).
The lazy projector path uses this so it does NOT load + JSON-deserialize
every ion’s simulated spectrum per batch (that would restore eager-scale
memory). Within a peptide, ions are ordered by ion_id (chunking is by
peptide_id, so a peptide’s ions all live in one chunk).
Sourcepub fn read_peptides_with_source(
&self,
source: &DistributionSource,
) -> Result<Vec<PeptidesSim>>
pub fn read_peptides_with_source( &self, source: &DistributionSource, ) -> Result<Vec<PeptidesSim>>
Read peptides with their frame distribution from source.
Sourcepub fn read_ions_with_source(
&self,
source: &DistributionSource,
) -> Result<Vec<IonSim>>
pub fn read_ions_with_source( &self, source: &DistributionSource, ) -> Result<Vec<IonSim>>
Read ions with their scan distribution from source.
Sourcepub fn read_prediction_set(&self) -> Result<PredictionSet>
pub fn read_prediction_set(&self) -> Result<PredictionSet>
Read the fragment prediction set (P5). Returns the single registered set,
or PredictionSet::legacy_bruker() for pre-P5 DBs that have no
prediction_sets table (so existing data keeps rendering as the implicit
Bruker set). Distinguishes “verified provenance” from “assumed legacy” by
virtue of the table’s presence.
Sourcepub fn read_peptides_for_frame_range_with_source(
&self,
frame_min: u32,
frame_max: u32,
source: &DistributionSource,
) -> Result<Vec<PeptidesSim>>
pub fn read_peptides_for_frame_range_with_source( &self, frame_min: u32, frame_max: u32, source: &DistributionSource, ) -> Result<Vec<PeptidesSim>>
Lazy per-batch peptide read, source-aware. Columns returns the legacy
column-fed read_peptides_for_frame_range; Projector selects candidates
for the range, reads their scalars, and projects (same entities the eager
projector reader produces, restricted to the batch).
Sourcepub fn read_ions_for_peptides_with_source(
&self,
peptide_ids: &[u32],
source: &DistributionSource,
) -> Result<Vec<IonSim>>
pub fn read_ions_for_peptides_with_source( &self, peptide_ids: &[u32], source: &DistributionSource, ) -> Result<Vec<IonSim>>
Lazy per-batch ion read, source-aware. Columns returns the legacy
read_ions_for_peptides; Projector reads the scalars for these peptides
and projects their scan distributions.
pub fn read_window_group_settings(&self) -> Result<Vec<WindowGroupSettingsSim>>
pub fn read_frame_to_window_group(&self) -> Result<Vec<FrameToWindowGroupSim>>
pub fn read_pasef_meta(&self) -> Result<Vec<PASEFMeta>>
Sourcepub fn read_peptides_for_frame_range(
&self,
frame_min: u32,
frame_max: u32,
) -> Result<Vec<PeptidesSim>>
pub fn read_peptides_for_frame_range( &self, frame_min: u32, frame_max: u32, ) -> Result<Vec<PeptidesSim>>
Read peptides that are present in the given frame range. A peptide is included if its frame range overlaps with [frame_min, frame_max].
Sourcepub fn read_ions_for_peptides(&self, peptide_ids: &[u32]) -> Result<Vec<IonSim>>
pub fn read_ions_for_peptides(&self, peptide_ids: &[u32]) -> Result<Vec<IonSim>>
Read ions for specific peptide IDs. Uses batched queries for efficiency with large peptide ID lists.
Sourcepub fn read_fragment_ions_for_peptides(
&self,
peptide_ids: &[u32],
) -> Result<Vec<FragmentIonSim>>
pub fn read_fragment_ions_for_peptides( &self, peptide_ids: &[u32], ) -> Result<Vec<FragmentIonSim>>
Read fragment ions for specific peptide IDs. Uses batched queries for efficiency with large peptide ID lists.
pub fn read_fragment_ions(&self) -> Result<Vec<FragmentIonSim>>
pub fn get_transmission_dia(&self) -> TimsTransmissionDIA
pub fn get_transmission_dda(&self) -> TimsTransmissionDDA
pub fn get_collision_energy_dia(&self) -> TimsTofCollisionEnergyDIA
pub fn get_transmitted_ions( &self, num_threads: usize, dda_mode: bool, ) -> (Vec<i32>, Vec<i32>, Vec<String>, Vec<i8>, Vec<f32>)
Sourcepub fn get_transmitted_ions_for_frame_range(
&self,
frame_min: u32,
frame_max: u32,
num_threads: usize,
dda_mode: bool,
) -> (Vec<i32>, Vec<i32>, Vec<String>, Vec<i8>, Vec<f32>)
pub fn get_transmitted_ions_for_frame_range( &self, frame_min: u32, frame_max: u32, num_threads: usize, dda_mode: bool, ) -> (Vec<i32>, Vec<i32>, Vec<String>, Vec<i8>, Vec<f32>)
Lazy version of get_transmitted_ions that only loads data for a specific frame range. This reduces memory usage by only loading peptides and ions that are relevant to the specified frame range instead of all data from the database.
§Arguments
frame_min- Minimum frame ID to include (inclusive)frame_max- Maximum frame ID to include (inclusive)num_threads- Number of threads to use for parallel processingdda_mode- If true, use DDA transmission; if false, use DIA transmission
§Returns
Tuple of (peptide_ids, ion_ids, sequences, charges, collision_energies) for transmitted ions
Sourcepub fn build_peptide_to_ion_map(
ions: &Vec<IonSim>,
) -> BTreeMap<u32, Vec<IonSim>>
pub fn build_peptide_to_ion_map( ions: &Vec<IonSim>, ) -> BTreeMap<u32, Vec<IonSim>>
Method to build a map from peptide id to ions
Sourcepub fn build_peptide_map(
peptides: &Vec<PeptidesSim>,
) -> BTreeMap<u32, PeptidesSim>
pub fn build_peptide_map( peptides: &Vec<PeptidesSim>, ) -> BTreeMap<u32, PeptidesSim>
Method to build a map from peptide id to events (absolute number of events in the simulation)
Sourcepub fn build_precursor_frame_id_set(frames: &Vec<FramesSim>) -> HashSet<u32>
pub fn build_precursor_frame_id_set(frames: &Vec<FramesSim>) -> HashSet<u32>
Method to build a set of precursor frame ids, can be used to check if a frame is a precursor frame
pub fn build_peptide_to_events( peptides: &Vec<PeptidesSim>, ) -> BTreeMap<u32, f32>
pub fn build_frame_to_rt(frames: &Vec<FramesSim>) -> BTreeMap<u32, f32>
pub fn build_scan_to_mobility(scans: &Vec<ScansSim>) -> BTreeMap<u32, f32>
pub fn build_frame_to_abundances( peptides: &Vec<PeptidesSim>, ) -> BTreeMap<u32, (Vec<u32>, Vec<f32>)>
pub fn build_peptide_to_ions( ions: &Vec<IonSim>, ) -> BTreeMap<u32, (Vec<f32>, Vec<Vec<u32>>, Vec<Vec<f32>>, Vec<i8>, Vec<MzSpectrum>)>
pub fn build_fragment_ions( peptides_sim: &BTreeMap<u32, PeptidesSim>, fragment_ions: &Vec<FragmentIonSim>, num_threads: usize, ) -> BTreeMap<(u32, i8, i32), (PeptideProductIonSeriesCollection, Vec<MzSpectrum>)>
pub fn build_fragment_ions_annotated( peptides_sim: &BTreeMap<u32, PeptidesSim>, fragment_ions: &Vec<FragmentIonSim>, num_threads: usize, ) -> BTreeMap<(u32, i8, i32), (PeptideProductIonSeriesCollection, Vec<MzSpectrumAnnotated>)>
Sourcepub fn build_fragment_ions_with_transmission_data(
peptides_sim: &BTreeMap<u32, PeptidesSim>,
fragment_ions: &Vec<FragmentIonSim>,
num_threads: usize,
) -> BTreeMap<(u32, i8, i32), FragmentIonsWithComplementary>
pub fn build_fragment_ions_with_transmission_data( peptides_sim: &BTreeMap<u32, PeptidesSim>, fragment_ions: &Vec<FragmentIonSim>, num_threads: usize, ) -> BTreeMap<(u32, i8, i32), FragmentIonsWithComplementary>
Build fragment ions with complementary isotope distribution data.
This variant calculates both the fragment isotope distribution and the complementary fragment isotope distribution, which are needed for quad-selection dependent isotope transmission calculations.
§Arguments
peptides_sim- Map of peptide_id to PeptidesSimfragment_ions- Vector of FragmentIonSimnum_threads- Number of threads for parallel processing
§Returns
BTreeMapmapping (peptide_id, charge, collision_energy) to (PeptideProductIonSeriesCollection, fragment spectra, fragment distributions, complementary distributions) Build fragment ions with transmission data for both precursor scaling and per-fragment modes.
This function calculates:
- Precursor isotope distribution (for PrecursorScaling mode)
- Per-fragment isotope distributions with their complementary distributions (for PerFragment mode)
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TimsTofSyntheticsDataHandle
impl !RefUnwindSafe for TimsTofSyntheticsDataHandle
impl Send for TimsTofSyntheticsDataHandle
impl !Sync for TimsTofSyntheticsDataHandle
impl Unpin for TimsTofSyntheticsDataHandle
impl UnsafeUnpin for TimsTofSyntheticsDataHandle
impl !UnwindSafe for TimsTofSyntheticsDataHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.