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
impl TimsFrame
Sourcepub 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
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]);
Sourcepub fn get_ims_frame(&self) -> ImsFrame
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();
Sourcepub fn to_tims_spectra(&self) -> Vec<TimsSpectrum>
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();
Sourcepub 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
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);
pub fn top_n(&self, n: usize) -> TimsFrame
pub fn to_windows_indexed( &self, window_length: f64, overlapping: bool, min_peaks: usize, min_intensity: f64, ) -> (Vec<i32>, Vec<i32>, Vec<TimsSpectrum>)
pub fn to_windows( &self, window_length: f64, overlapping: bool, min_peaks: usize, min_intensity: f64, ) -> Vec<TimsSpectrum>
pub fn from_windows(windows: Vec<TimsSpectrum>) -> TimsFrame
pub fn from_tims_spectra(spectra: Vec<TimsSpectrum>) -> TimsFrame
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)
pub fn to_indexed_mz_spectrum(&self) -> IndexedMzSpectrum
pub fn generate_random_sample(&self, take_probability: f64) -> TimsFrame
pub fn to_noise_annotated_tims_frame(&self) -> TimsFrameAnnotated
pub fn get_inverse_mobility_along_scan_marginal(&self) -> f64
Sourcepub fn get_mobility_mean_and_variance(&self) -> (f64, f64)
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<'__de> BorrowDecode<'__de> for TimsFrame
impl<'__de> BorrowDecode<'__de> for TimsFrame
Source§fn borrow_decode<__D: BorrowDecoder<'__de>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl<'de> Deserialize<'de> for TimsFrame
impl<'de> Deserialize<'de> for TimsFrame
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 ToResolution for TimsFrame
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);
fn to_resolution(&self, resolution: i32) -> TimsFrame
Source§impl Vectorized<TimsFrameVectorized> for TimsFrame
impl Vectorized<TimsFrameVectorized> for TimsFrame
fn vectorized(&self, resolution: i32) -> TimsFrameVectorized
Auto Trait Implementations§
impl Freeze for TimsFrame
impl RefUnwindSafe for TimsFrame
impl Send for TimsFrame
impl Sync for TimsFrame
impl Unpin for TimsFrame
impl UnwindSafe for TimsFrame
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
Mutably borrows from an owned value. Read more
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>
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 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>
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
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>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.