Skip to main content

AcquisitionScheme

Struct AcquisitionScheme 

Source
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: Provenance

Implementations§

Source§

impl AcquisitionScheme

Source

pub fn windows(&self) -> impl Iterator<Item = &DiaWindow>

Iterate every DIA window across all MS2 frames in the cycle.

Source

pub fn ms1_count(&self) -> usize

Number of MS1 events in one cycle.

Source

pub fn num_cycles(&self) -> Option<u64>

Number of full cycles that fit the gradient (if derivable).

Source

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.

Source

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

pub fn validate(&self) -> Result<(), String>

Validate internal consistency. Returns a human-readable error on the first problem found.

Source§

impl AcquisitionScheme

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> AcquisitionScheme

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AcquisitionScheme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,