From 8c39a9e1ec91d8732a2d1f4e0adcfa05d2bbac95 Mon Sep 17 00:00:00 2001 From: Sander Willems Date: Mon, 8 Apr 2024 14:37:15 +0200 Subject: [PATCH] CHORE: grouped ms data together --- src/calibration.rs | 2 +- src/data.rs | 9 +++++++++ src/{ => data}/acquisition.rs | 1 + src/{ => data}/frames.rs | 2 +- src/{ => data}/precursors.rs | 0 src/{ => data}/spectra.rs | 3 +-- src/file_readers/frame_readers/tdf_reader.rs | 3 +-- src/file_readers/spectrum_readers/dda_reader.rs | 7 +++---- src/file_readers/spectrum_readers/mini_tdf_reader.rs | 3 +-- src/lib.rs | 12 ++++-------- 10 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 src/data.rs rename src/{ => data}/acquisition.rs (91%) rename src/{ => data}/frames.rs (92%) rename src/{ => data}/precursors.rs (100%) rename src/{ => data}/spectra.rs (98%) diff --git a/src/calibration.rs b/src/calibration.rs index de0cb22..12f9c91 100644 --- a/src/calibration.rs +++ b/src/calibration.rs @@ -1,6 +1,6 @@ use crate::{ converters::{ConvertableDomain, Tof2MzConverter}, - spectra::RawSpectrum, + data::spectra::RawSpectrum, Precursor, }; diff --git a/src/data.rs b/src/data.rs new file mode 100644 index 0000000..d0560d0 --- /dev/null +++ b/src/data.rs @@ -0,0 +1,9 @@ +pub mod acquisition; +pub mod frames; +pub mod precursors; +pub mod spectra; + +pub use acquisition::AcquisitionType; +pub use frames::{Frame, FrameType}; +pub use precursors::{Precursor, QuadrupoleEvent}; +pub use spectra::Spectrum; diff --git a/src/acquisition.rs b/src/data/acquisition.rs similarity index 91% rename from src/acquisition.rs rename to src/data/acquisition.rs index 18f0500..2826e09 100644 --- a/src/acquisition.rs +++ b/src/data/acquisition.rs @@ -3,5 +3,6 @@ pub enum AcquisitionType { DDAPASEF, DIAPASEF, + PRMPASEF, Unknown, } diff --git a/src/frames.rs b/src/data/frames.rs similarity index 92% rename from src/frames.rs rename to src/data/frames.rs index ad7df8d..5f4455d 100644 --- a/src/frames.rs +++ b/src/data/frames.rs @@ -1,4 +1,4 @@ -use crate::acquisition::AcquisitionType; +use crate::AcquisitionType; /// A frame with all unprocessed data as it was acquired. #[derive(Debug, PartialEq, Default)] diff --git a/src/precursors.rs b/src/data/precursors.rs similarity index 100% rename from src/precursors.rs rename to src/data/precursors.rs diff --git a/src/spectra.rs b/src/data/spectra.rs similarity index 98% rename from src/spectra.rs rename to src/data/spectra.rs index cacdefc..a32f84b 100644 --- a/src/spectra.rs +++ b/src/data/spectra.rs @@ -1,8 +1,7 @@ use crate::{ converters::{ConvertableDomain, Tof2MzConverter}, - precursors::QuadrupoleEvent, vec_utils::{filter_with_mask, find_sparse_local_maxima_mask}, - Precursor, + Precursor, QuadrupoleEvent, }; pub struct RawSpectrumProcessor { diff --git a/src/file_readers/frame_readers/tdf_reader.rs b/src/file_readers/frame_readers/tdf_reader.rs index 3fae8ae..f8744f6 100644 --- a/src/file_readers/frame_readers/tdf_reader.rs +++ b/src/file_readers/frame_readers/tdf_reader.rs @@ -1,6 +1,5 @@ use { crate::{ - acquisition::AcquisitionType, converters::{ ConvertableDomain, Frame2RtConverter, Scan2ImConverter, Tof2MzConverter, @@ -12,7 +11,7 @@ use { }, ReadableFrames, }, - Frame, FrameType, + AcquisitionType, Frame, FrameType, }, rayon::prelude::*, std::path::Path, diff --git a/src/file_readers/spectrum_readers/dda_reader.rs b/src/file_readers/spectrum_readers/dda_reader.rs index cca3527..51a874d 100644 --- a/src/file_readers/spectrum_readers/dda_reader.rs +++ b/src/file_readers/spectrum_readers/dda_reader.rs @@ -3,15 +3,14 @@ mod precursors; use crate::{ calibration::Tof2MzCalibrator, converters::Tof2MzConverter, + data::spectra::RawSpectrum, + data::spectra::{self, RawSpectrumProcessor}, file_readers::{ frame_readers::{tdf_reader::TDFReader, ReadableFrames}, ReadableSpectra, }, - frames::Frame, - spectra::RawSpectrum, - spectra::{self, RawSpectrumProcessor}, vec_utils::group_and_sum, - Spectrum, + Frame, Spectrum, }; use rayon::prelude::*; diff --git a/src/file_readers/spectrum_readers/mini_tdf_reader.rs b/src/file_readers/spectrum_readers/mini_tdf_reader.rs index 8ba343d..4eb7686 100644 --- a/src/file_readers/spectrum_readers/mini_tdf_reader.rs +++ b/src/file_readers/spectrum_readers/mini_tdf_reader.rs @@ -1,4 +1,4 @@ -use crate::file_readers::FileFormatError; +use crate::{file_readers::FileFormatError, QuadrupoleEvent}; use std::fs; use { crate::{ @@ -9,7 +9,6 @@ use { }, ReadableSpectra, }, - precursors::QuadrupoleEvent, Precursor, Spectrum, }, rayon::prelude::*, diff --git a/src/lib.rs b/src/lib.rs index e268b52..463a69b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,24 +21,20 @@ //! * *.ms2spectrum.bin //! * *.ms2spectrum.parquet -mod acquisition; mod calibration; mod converters; +mod data; mod errors; mod file_readers; -mod frames; -mod precursors; -mod spectra; mod vec_utils; pub use crate::{ - acquisition::AcquisitionType, converters::{ ConvertableDomain, Frame2RtConverter, Scan2ImConverter, Tof2MzConverter, }, + data::{ + AcquisitionType, Frame, FrameType, Precursor, QuadrupoleEvent, Spectrum, + }, errors::*, file_readers::FileReader, - frames::{Frame, FrameType}, - precursors::{Precursor, QuadrupoleEvent}, - spectra::Spectrum, };