Skip to main content

BinaryArrayMap3D

Struct BinaryArrayMap3D 

Source
pub struct BinaryArrayMap3D {
    pub ion_mobility_dimension: Vec<f64>,
    pub ion_mobility_type: ArrayType,
    pub ion_mobility_unit: Unit,
    pub arrays: Vec<BinaryArrayMap>,
    pub additional_arrays: BinaryArrayMap,
    /* private fields */
}
Expand description

Represent a set of BinaryArrayMap that has been split across an ion mobility dimension.

This effectively removes an ion mobility DataArray and for each unique value in that array, creates a new BinaryArrayMap with subsets of each other DataArray that co-occur at the same ion mobility coordinate.

Because BinaryArrayMap3D spreads DataArray over multiple ion mobility bins, it cannot share a single [ParamList] for each of the dimensions. Instead, all split ArrayType have their [ParamList] moved to separate storage accessed using [params_of] and its siblins. These [ParamList] will be propagated by Self::stack and BinaryArrayMap3D::unstack as appropriate.

Fields§

§ion_mobility_dimension: Vec<f64>§ion_mobility_type: ArrayType§ion_mobility_unit: Unit§arrays: Vec<BinaryArrayMap>§additional_arrays: BinaryArrayMap

Implementations§

Source§

impl BinaryArrayMap3D

Source

pub fn from_ion_mobility_dimension( ion_mobility_dimension: Vec<f64>, ion_mobility_type: ArrayType, ion_mobility_unit: Unit, ) -> BinaryArrayMap3D

Create an empty BinaryArrayMap3D with a defined ion mobility dimension but no content at each ion mobility point.

§Panics

If the ion mobility dimension contains a NaN value

Source

pub fn from_ion_mobility_dimension_and_arrays( ion_mobility_dimension: Vec<f64>, ion_mobility_type: ArrayType, ion_mobility_unit: Unit, arrays: Vec<BinaryArrayMap>, ) -> BinaryArrayMap3D

Construct a BinaryArrayMap3D from a defined ion mobility dimension and a Vec of BinaryArrayMap at each point.

§Panics

If the ion mobility dimension contains a NaN value or ion_mobility_dimension.len() != arrays.len()

Source

pub fn params_of(&self, array_type: &ArrayType) -> Option<&Vec<Param>>

Get a reference to the [ParamList] for the specified ArrayType, if one exists.

§See also
Source

pub fn params_of_mut( &mut self, array_type: &ArrayType, ) -> Option<&mut Vec<Param>>

Get a mutable reference to the [ParamList] for the specified ArrayType, if one exists.

§See also
Source

pub fn params_of_entry( &mut self, array_type: ArrayType, ) -> Entry<'_, ArrayType, Vec<Param>>

A lower level create or update version of Self::insert_params_of that uses the underlying HashMap’s Entry API

Source

pub fn insert_params_of( &mut self, array_type: ArrayType, params: Vec<Param>, ) -> Option<Vec<Param>>

Set the [ParamList] for the specified ArrayType.

Returns any previous [ParamList] associated with that ArrayType.

§See also
Source

pub fn get_ion_mobility(&self, ion_mobility: f64) -> Option<&BinaryArrayMap>

Get the associated arrays at the requested ion mobility, if they exist

Source

pub fn search_ion_mobility( &self, ion_mobility: f64, error_tolerance: f64, ) -> Option<(&BinaryArrayMap, f64)>

Perform a binary search on the ion mobility dimension and find the nearest point to ion_mobility within error_tolerance absolute distance.

Returns the BinaryArrayMap at that point and the distance from ion_mobility matched.

Source

pub fn search_ion_mobility_index( &self, ion_mobility: f64, error_tolerance: f64, ) -> Option<(usize, f64)>

Perform a binary search on the ion mobility dimension and find the nearest point to ion_mobility within error_tolerance absolute distance.

Unlike Self::search_ion_mobility, this returns the index in the ion mobility dimension that matched and the ion mobility value at that index.

Source

pub fn get_ion_mobility_mut( &mut self, ion_mobility: f64, ) -> Option<&mut BinaryArrayMap>

Get the a mutable reference to the associated arrays at the requested ion mobility, if they exist.

The ion mobility value must be an exact match

Source

pub fn iter(&self) -> impl Iterator<Item = (f64, &BinaryArrayMap)>

Iterate over the ion mobility dimension and associated arrays at each point.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = (f64, &mut BinaryArrayMap)>

Iterate over the ion mobility dimension and a mutable reference to the associated arrays at each point.

Source

pub fn unstack(&self) -> Result<BinaryArrayMap, ArrayRetrievalError>

Flatten this array into a single BinaryArrayMap.

The flattened map is sorted by m/z and ion mobility. If no m/z array is found, no sorting is done, and the flattened order is left in roughly ion mobility sorted order.

§Errors

ArrayRetrievalError errors related to array decoding occur if any DataArray cannot be decoded, or if an expected array is absent.

Source

pub fn stack(source: &BinaryArrayMap) -> Result<Self, ArrayRetrievalError>

Convert a BinaryArrayMap into a BinaryArrayMap3D if it has an ion mobility dimension.

Any arrays that aren’t the same length as the ion mobility dimension will be in BinaryArrayMap3D::additional_arrays.

This uses exact ion mobility values as keys, bit-level equality. If ion mobility values are computed, they may vary at trivial bits and be equivalent, but not equal.

§Errors

ArrayRetrievalError errors related to array decoding occur if any DataArray cannot be decoded, or if an expected array is absent.

Trait Implementations§

Source§

impl Clone for BinaryArrayMap3D

Source§

fn clone(&self) -> Self

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 BinaryArrayMap3D

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for BinaryArrayMap3D

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl TryFrom<&BinaryArrayMap3D> for BinaryArrayMap

Source§

type Error = ArrayRetrievalError

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

fn try_from(value: &BinaryArrayMap3D) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<&BinaryArrayMap> for BinaryArrayMap3D

Source§

type Error = ArrayRetrievalError

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

fn try_from(value: &BinaryArrayMap) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<BinaryArrayMap3D> for BinaryArrayMap

Source§

type Error = ArrayRetrievalError

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

fn try_from(value: BinaryArrayMap3D) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl TryFrom<BinaryArrayMap> for BinaryArrayMap3D

Source§

fn try_from(value: BinaryArrayMap) -> Result<Self, Self::Error>

A wrapper around BinaryArrayMap3D::stack

Source§

type Error = ArrayRetrievalError

The type returned in the event of a conversion error.

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> 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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.