pub struct AcquisitionScheme {
pub version: u16,
pub instrument: InstrumentKind,
pub cycle: Vec<AcquisitionEvent>,
pub repeat: RepeatPolicy,
pub mz_range: (f64, f64),
pub provenance: Provenance,
}Expand description
A vendor-neutral DIA acquisition design.
Fields§
§version: u16§instrument: InstrumentKind§cycle: Vec<AcquisitionEvent>§repeat: RepeatPolicy§mz_range: (f64, f64)§provenance: ProvenanceImplementations§
Source§impl AcquisitionScheme
impl AcquisitionScheme
Sourcepub fn windows(&self) -> impl Iterator<Item = &DiaWindow>
pub fn windows(&self) -> impl Iterator<Item = &DiaWindow>
Iterate every DIA window across all MS2 frames in the cycle.
Sourcepub fn num_cycles(&self) -> Option<u64>
pub fn num_cycles(&self) -> Option<u64>
Number of full cycles that fit the gradient (if derivable).
Sourcepub fn dia_frame_schedule(
&self,
) -> Vec<(u32, f64, u8, Option<f64>, Option<f64>, Option<f64>)>
pub fn dia_frame_schedule( &self, ) -> Vec<(u32, f64, u8, Option<f64>, Option<f64>, Option<f64>)>
Expand a FixedCycleTime DIA scheme into a per-frame schedule over the whole
gradient — the synthesized analogue of thermo_frame_schedule for schemes that
carry no per-scan timing (e.g. a SCIEX .wiff SWATH method). Each cycle emits its
events (MS1 then one MS2 frame per window) at evenly-spaced times within the
cycle. Rows are (scan, retention_time_s, ms_level, isolation_center_mz, isolation_width_mz, collision_energy); the MS1 row’s isolation/CE are None, and
a window’s CE is resolved from its CollisionEnergyPolicy at the window center
(None if the policy is Unknown). Empty unless repeat is FixedCycleTime.
Sourcepub fn from_window_table(
instrument: InstrumentKind,
ms1: Ms1Event,
windows: Vec<DiaWindow>,
repeat: RepeatPolicy,
mz_range: (f64, f64),
) -> Self
pub fn from_window_table( instrument: InstrumentKind, ms1: Ms1Event, windows: Vec<DiaWindow>, repeat: RepeatPolicy, mz_range: (f64, f64), ) -> Self
Build a scheme from an explicit window list (injected / CSV). One MS1 followed by one single-window MS2 frame per window.
Source§impl AcquisitionScheme
impl AcquisitionScheme
Sourcepub fn to_bruker_windows(&self) -> Result<Vec<DiaMsMsWindow>, String>
pub fn to_bruker_windows(&self) -> Result<Vec<DiaMsMsWindow>, String>
Render the scheme’s MS2 windows as Bruker DiaFrameMsMsWindows rows — the
backward-compatibility adapter for the existing timsTOF write path.
Each MS2 frame is one window group; its windows must carry TimsMobility
geometry (the Bruker-grid scan ranges). The WindowGroup id is the frame’s
preserved DiaMs2Frame::vendor_group_id when present (so a Bruker
round-trip keeps the ids that DiaFrameMsMsInfo references), else a 1..N
fallback in cycle order. A Linear CE policy is resolved at the window
center (a lossy materialization, not an inverse); Unknown CE and
non-timsTOF schemes are rejected. The scheme is validated first.
Row order is not meaningful (the SQLite table has none); the companion
frame→group table DiaFrameMsMsInfo needs the run frame schedule and is a
separate step.
Sourcepub fn to_bruker_info(
&self,
num_frames: u32,
) -> Result<Vec<DiaMsMisInfo>, String>
pub fn to_bruker_info( &self, num_frames: u32, ) -> Result<Vec<DiaMsMisInfo>, String>
Generate the Bruker DiaFrameMsMsInfo (frame → window group) rows for a run
of num_frames total frames, tiling the scheme’s cycle. Cycle position
(frame_id - 1) % cycle_len selects the event (1-based frame ids), MS1
frames produce no row, and each MS2 frame maps to its window-group id (the
same ids to_bruker_windows emits, so the two tables reference the same
groups). The final cycle may be partial.
Precondition: this models a clean generated run — frame 1 is the cycle’s leading MS1 and frame ids are contiguous (as TimSim produces). It is not a reproducer for arbitrary real files with prefix/calibration frames, gaps, or acquisition starting mid-cycle.
Sourcepub fn to_bruker_tables(
&self,
num_frames: u32,
) -> Result<(Vec<DiaMsMsWindow>, Vec<DiaMsMisInfo>), String>
pub fn to_bruker_tables( &self, num_frames: u32, ) -> Result<(Vec<DiaMsMsWindow>, Vec<DiaMsMisInfo>), String>
Both Bruker DIA tables for a num_frames-frame run: the
DiaFrameMsMsWindows rows and the DiaFrameMsMsInfo (frame→group) rows,
with consistent window-group ids.
Sourcepub fn from_bruker_d<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn from_bruker_d<P: AsRef<Path>>(path: P) -> Result<Self>
Extract the acquisition scheme from a real Bruker timsTOF DIA .d.
Reads DiaFrameMsMsWindows and the frame table. Each window group
becomes one DiaMs2Frame holding its mobility-partitioned windows
(TimsMobility geometry — the scan ranges are Bruker-grid coordinates),
preceded by a single MS1 event. Cycle timing comes from the spacing of
the precursor (MS1) frames. The returned scheme is validated.
Window groups (frames) are ordered by their first occurrence in
DiaFrameMsMsInfo (ascending frame id), i.e. the real acquisition order
within a cycle — not merely ascending WindowGroup id — so the cycle
faithfully represents permuted/reused group numbering. (If the info table
is absent, falls back to ascending group id.)
Trait Implementations§
Source§impl Clone for AcquisitionScheme
impl Clone for AcquisitionScheme
Source§fn clone(&self) -> AcquisitionScheme
fn clone(&self) -> AcquisitionScheme
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AcquisitionScheme
impl RefUnwindSafe for AcquisitionScheme
impl Send for AcquisitionScheme
impl Sync for AcquisitionScheme
impl Unpin for AcquisitionScheme
impl UnsafeUnpin for AcquisitionScheme
impl UnwindSafe for AcquisitionScheme
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.