mscore::timstof::frame

Struct TimsFrame

Source
pub struct TimsFrame {
    pub frame_id: i32,
    pub ms_type: MsType,
    pub scan: Vec<i32>,
    pub tof: Vec<i32>,
    pub ims_frame: ImsFrame,
}

Fields§

§frame_id: i32§ms_type: MsType§scan: Vec<i32>§tof: Vec<i32>§ims_frame: ImsFrame

Implementations§

Source§

impl TimsFrame

Source

pub fn new( frame_id: i32, ms_type: MsType, retention_time: f64, scan: Vec<i32>, mobility: Vec<f64>, tof: Vec<i32>, mz: Vec<f64>, intensity: Vec<f64>, ) -> Self

Creates a new TimsFrame instance.

§Arguments
  • frame_id - index of frame in TDF raw file.
  • ms_type - The type of frame.
  • retention_time - The retention time in seconds.
  • scan - A vector of scan IDs.
  • mobility - A vector of inverse ion mobilities.
  • tof - A vector of time-of-flight values.
  • mz - A vector of m/z values.
  • intensity - A vector of intensity values.
§Examples
use mscore::data::spectrum::MsType;
use mscore::timstof::frame::TimsFrame;
use mscore::timstof::frame::ImsFrame;

let frame = TimsFrame::new(1, MsType::Precursor, 100.0, vec![1, 2], vec![0.1, 0.2], vec![1000, 2000], vec![100.5, 200.5], vec![50.0, 60.0]);
Source

pub fn get_ims_frame(&self) -> ImsFrame

Convert a given TimsFrame to an ImsFrame.

§Examples
use mscore::data::spectrum::MsType;
use mscore::timstof::frame::TimsFrame;

let frame = TimsFrame::new(1, MsType::Precursor, 100.0, vec![1, 2], vec![0.1, 0.2], vec![1000, 2000], vec![100.5, 200.5], vec![50.0, 60.0]);
let ims_spectrum = frame.get_ims_frame();
Source

pub fn to_tims_spectra(&self) -> Vec<TimsSpectrum>

Convert a given TimsFrame to a vector of TimsSpectrum.

§Examples
use mscore::data::spectrum::MsType;
use mscore::timstof::frame::TimsFrame;

let frame = TimsFrame::new(1, MsType::Precursor, 100.0, vec![1, 2], vec![0.1, 0.2], vec![1000, 2000], vec![100.5, 200.5], vec![50.0, 60.0]);
let tims_spectra = frame.to_tims_spectra();
Source

pub fn filter_ranged( &self, mz_min: f64, mz_max: f64, scan_min: i32, scan_max: i32, inv_mob_min: f64, inv_mob_max: f64, intensity_min: f64, intensity_max: f64, ) -> TimsFrame

Filter a given TimsFrame by m/z, scan, and intensity.

§Arguments
  • mz_min - The minimum m/z value.
  • mz_max - The maximum m/z value.
  • scan_min - The minimum scan value.
  • scan_max - The maximum scan value.
  • intensity_min - The minimum intensity value.
  • intensity_max - The maximum intensity value.
§Examples
use mscore::data::spectrum::MsType;
use mscore::timstof::frame::TimsFrame;

let frame = TimsFrame::new(1, MsType::Precursor, 100.0, vec![1, 2], vec![0.1, 0.2], vec![1000, 2000], vec![100.5, 200.5], vec![50.0, 60.0]);
let filtered_frame = frame.filter_ranged(100.0, 200.0, 1, 2, 0.0, 1.6, 50.0, 60.0);
Source

pub fn top_n(&self, n: usize) -> TimsFrame

Source

pub fn to_windows_indexed( &self, window_length: f64, overlapping: bool, min_peaks: usize, min_intensity: f64, ) -> (Vec<i32>, Vec<i32>, Vec<TimsSpectrum>)

Source

pub fn to_windows( &self, window_length: f64, overlapping: bool, min_peaks: usize, min_intensity: f64, ) -> Vec<TimsSpectrum>

Source

pub fn from_windows(windows: Vec<TimsSpectrum>) -> TimsFrame

Source

pub fn from_tims_spectra(spectra: Vec<TimsSpectrum>) -> TimsFrame

Source

pub fn to_dense_windows( &self, window_length: f64, overlapping: bool, min_peaks: usize, min_intensity: f64, resolution: i32, ) -> (Vec<f64>, Vec<i32>, Vec<i32>, usize, usize)

Source

pub fn to_indexed_mz_spectrum(&self) -> IndexedMzSpectrum

Source

pub fn generate_random_sample(&self, take_probability: f64) -> TimsFrame

Source

pub fn to_noise_annotated_tims_frame(&self) -> TimsFrameAnnotated

Source

pub fn get_inverse_mobility_along_scan_marginal(&self) -> f64

Source

pub fn get_mobility_mean_and_variance(&self) -> (f64, f64)

Calculate the weighted mean and variance of inv_mob values based on their intensities.

Trait Implementations§

Source§

impl Add for TimsFrame

Source§

type Output = TimsFrame

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> TimsFrame

Performs the + operation. Read more
Source§

impl<'__de> BorrowDecode<'__de> for TimsFrame

Source§

fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D, ) -> Result<Self, DecodeError>

Attempt to decode this type with the given BorrowDecode.
Source§

impl Clone for TimsFrame

Source§

fn clone(&self) -> TimsFrame

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TimsFrame

Source§

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

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

impl Decode for TimsFrame

Source§

fn decode<__D: Decoder>(decoder: &mut __D) -> Result<Self, DecodeError>

Attempt to decode this type with the given Decode.
Source§

impl Default for TimsFrame

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for TimsFrame

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TimsFrame

Source§

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

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

impl Encode for TimsFrame

Source§

fn encode<__E: Encoder>(&self, encoder: &mut __E) -> Result<(), EncodeError>

Encode a given type.
Source§

impl Serialize for TimsFrame

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToResolution for TimsFrame

Convert a given TimsFrame to a vector of TimsSpectrum.

§Arguments

  • resolution - The resolution to which the m/z values should be rounded.

§Examples

use mscore::data::spectrum::MsType;
use mscore::timstof::frame::TimsFrame;
use mscore::timstof::spectrum::TimsSpectrum;
use mscore::data::spectrum::IndexedMzSpectrum;
use mscore::data::spectrum::ToResolution;

let frame = TimsFrame::new(1, MsType::Precursor, 100.0, vec![1, 2], vec![0.1, 0.2], vec![1000, 2000], vec![100.5, 200.5], vec![50.0, 60.0]);
let low_res_frame = frame.to_resolution(1);
Source§

fn to_resolution(&self, resolution: i32) -> TimsFrame

Source§

impl Vectorized<TimsFrameVectorized> for TimsFrame

Source§

fn vectorized(&self, resolution: i32) -> TimsFrameVectorized

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. 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

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,