-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from MannLabs/develop
Develop
- Loading branch information
Showing
48 changed files
with
2,040 additions
and
1,253 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,93 +1,113 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use timsrust::FileReader; | ||
use rayon::iter::ParallelIterator; | ||
#[cfg(feature = "tdf")] | ||
use timsrust::readers::FrameReader; | ||
use timsrust::readers::{SpectrumReader, SpectrumReaderConfig}; | ||
|
||
const DDA_TEST: &str = | ||
"/mnt/c/Users/Sander.Willems/Documents/data/tims05_300SPD/20230505_TIMS05_PaSk_MA_HeLa_6min_ddaP_S1-C10_1_2323.d/"; | ||
"/mnt/d/data/mpib/tims05_300SPD/20230505_TIMS05_PaSk_MA_HeLa_6min_ddaP_S1-C10_1_2323.d/"; | ||
const DIA_TEST: &str = | ||
"/mnt/c/Users/Sander.Willems/Documents/data/20230505_TIMS05_PaSk_SA_HeLa_6min_diaP_8scans_S1-D3_1_2329.d/"; | ||
const SYP_TEST: &str = | ||
"/mnt/c/Users/Sander.Willems/Documents/data/20230505_TIMS05_PaSk_SA_HeLa_6min_syP_5scans_30Da_S1-D4_1_2330.d/"; | ||
|
||
fn read_all_frames(file_reader: &FileReader) { | ||
file_reader.read_all_frames(); | ||
#[cfg(feature = "tdf")] | ||
fn read_all_frames(frame_reader: &FrameReader) { | ||
frame_reader.get_all(); | ||
} | ||
|
||
fn read_all_ms1_frames(file_reader: &FileReader) { | ||
file_reader.read_all_ms1_frames(); | ||
#[cfg(feature = "tdf")] | ||
fn read_all_ms1_frames(frame_reader: &FrameReader) { | ||
frame_reader.get_all_ms1(); | ||
} | ||
|
||
fn read_all_ms2_frames(file_reader: &FileReader) { | ||
file_reader.read_all_ms2_frames(); | ||
#[cfg(feature = "tdf")] | ||
fn read_all_ms2_frames(frame_reader: &FrameReader) { | ||
frame_reader.get_all_ms2(); | ||
} | ||
|
||
fn read_all_spectra(file_reader: &FileReader) { | ||
file_reader.read_all_spectra(); | ||
fn read_all_spectra(spectrum_reader: &SpectrumReader) { | ||
spectrum_reader.get_all(); | ||
} | ||
|
||
fn criterion_benchmark_dda(c: &mut Criterion) { | ||
#[cfg(feature = "tdf")] | ||
fn criterion_benchmark_dda_frames(c: &mut Criterion) { | ||
// c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); | ||
let mut group = c.benchmark_group("sample-size-example"); | ||
group.significance_level(0.001).sample_size(10); | ||
let d_folder_name: &str = DDA_TEST; | ||
let file_reader: FileReader = | ||
FileReader::new(d_folder_name.to_string()).unwrap(); | ||
let frame_reader = FrameReader::new(d_folder_name).unwrap(); | ||
group.bench_function("DDA read_all_frames 6m", |b| { | ||
b.iter(|| read_all_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("DDA read_all_ms1_frames 6m", |b| { | ||
b.iter(|| read_all_ms1_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms1_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("DDA read_all_ms2_frames 6m", |b| { | ||
b.iter(|| read_all_ms2_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms2_frames(black_box(&frame_reader))) | ||
}); | ||
group.finish(); | ||
} | ||
|
||
#[cfg(feature = "tdf")] | ||
fn criterion_benchmark_dda_spectra(c: &mut Criterion) { | ||
// c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); | ||
let mut group = c.benchmark_group("sample-size-example"); | ||
group.significance_level(0.001).sample_size(10); | ||
let d_folder_name: &str = DDA_TEST; | ||
let spectrum_reader = SpectrumReader::new(d_folder_name).unwrap(); | ||
group.bench_function("DDA read_all_spectra 6m", |b| { | ||
b.iter(|| read_all_spectra(black_box(&file_reader))) | ||
b.iter(|| read_all_spectra(black_box(&spectrum_reader))) | ||
}); | ||
group.finish(); | ||
} | ||
|
||
#[cfg(feature = "tdf")] | ||
fn criterion_benchmark_dia(c: &mut Criterion) { | ||
// c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); | ||
let mut group = c.benchmark_group("sample-size-example"); | ||
group.significance_level(0.001).sample_size(10); | ||
let d_folder_name: &str = DIA_TEST; | ||
let file_reader: FileReader = | ||
FileReader::new(d_folder_name.to_string()).unwrap(); | ||
let frame_reader = FrameReader::new(d_folder_name).unwrap(); | ||
let spectrum_reader = SpectrumReader::new(d_folder_name).unwrap(); | ||
group.bench_function("DIA read_all_frames 6m", |b| { | ||
b.iter(|| read_all_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("DIA read_all_ms1_frames 6m", |b| { | ||
b.iter(|| read_all_ms1_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms1_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("DIA read_all_ms2_frames 6m", |b| { | ||
b.iter(|| read_all_ms2_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms2_frames(black_box(&frame_reader))) | ||
}); | ||
group.finish(); | ||
} | ||
|
||
#[cfg(feature = "tdf")] | ||
fn criterion_benchmark_syp(c: &mut Criterion) { | ||
// c.bench_function("fib 20", |b| b.iter(|| fibonacci(black_box(20)))); | ||
let mut group = c.benchmark_group("sample-size-example"); | ||
group.significance_level(0.001).sample_size(10); | ||
let d_folder_name: &str = SYP_TEST; | ||
let file_reader: FileReader = | ||
FileReader::new(d_folder_name.to_string()).unwrap(); | ||
let frame_reader = FrameReader::new(d_folder_name).unwrap(); | ||
let spectrum_reader = SpectrumReader::new(d_folder_name).unwrap(); | ||
group.bench_function("SYP read_all_frames 6m", |b| { | ||
b.iter(|| read_all_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("SYP read_all_ms1_frames 6m", |b| { | ||
b.iter(|| read_all_ms1_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms1_frames(black_box(&frame_reader))) | ||
}); | ||
group.bench_function("SYP read_all_ms2_frames 6m", |b| { | ||
b.iter(|| read_all_ms2_frames(black_box(&file_reader))) | ||
b.iter(|| read_all_ms2_frames(black_box(&frame_reader))) | ||
}); | ||
group.finish(); | ||
} | ||
|
||
#[cfg(feature = "tdf")] | ||
criterion_group!( | ||
benches, | ||
criterion_benchmark_dda, | ||
criterion_benchmark_dda_spectra, | ||
// criterion_benchmark_dia, | ||
// criterion_benchmark_syp | ||
); | ||
#[cfg(feature = "tdf")] | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
use crate::{ | ||
file_readers, | ||
// io::readers::common::{sql_reader::SqlError, tdf_blobs::TdfBlobError}, | ||
#[cfg(feature = "tdf")] | ||
use crate::io::readers::{ | ||
FrameReaderError, MetadataReaderError, QuadrupoleSettingsReaderError, | ||
}; | ||
use crate::io::readers::{PrecursorReaderError, SpectrumReaderError}; | ||
|
||
/// An error that is produced by timsrust (uses [thiserror]). | ||
#[derive(thiserror::Error, Debug)] | ||
pub enum Error { | ||
/// An error to indicate a path is not a Bruker File Format. | ||
#[error("FileFormatError: {0}")] | ||
FileFormatError(#[from] file_readers::FileFormatError), | ||
// #[error("SqlError: {0}")] | ||
// SqlError(#[from] SqlError), | ||
// #[error("BinError: {0}")] | ||
// BinError(#[from] TdfBlobError), | ||
pub enum TimsRustError { | ||
#[cfg(feature = "tdf")] | ||
#[error("{0}")] | ||
FrameReaderError(#[from] FrameReaderError), | ||
#[error("{0}")] | ||
SpectrumReaderError(#[from] SpectrumReaderError), | ||
#[cfg(feature = "tdf")] | ||
#[error("{0}")] | ||
MetadataReaderError(#[from] MetadataReaderError), | ||
#[error("{0}")] | ||
PrecursorReaderError(#[from] PrecursorReaderError), | ||
#[cfg(feature = "tdf")] | ||
#[error("{0}")] | ||
QuadrupoleSettingsReaderError(#[from] QuadrupoleSettingsReaderError), | ||
} |
Oops, something went wrong.