Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/fastecentroid #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 101 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"
timsrust = "=0.4.1"
rayon = "1.5"
nohash-hasher = "=0.2.0"
indicatif = { version = "0.17.8", features = ["rayon"] }
indicatif = { version = "0.17.9", features = ["rayon"] }

clap = { version = "4.5.17", features = ["derive"], optional = true }
serde = { version = "1.0.204", features = ["derive"] }
Expand All @@ -27,6 +27,7 @@ tracing-chrome = "0.7.2"
# These are only used for benchmarks
rand = { version = "0.8.5", optional = true }
rand_chacha = { version = "0.3.1", optional = true }
tabled = "0.17.0"


[features]
Expand All @@ -43,6 +44,10 @@ name = "benchmark_indices"
path = "benches/benchmark_indices.rs"
required-features = ["bench"]

[[bin]]
name = "benchmark_centroiding"
path = "benches/benchmark_centroiding.rs"

[profile.release]
opt-level = 3
lto = 'fat'
Expand Down
64 changes: 64 additions & 0 deletions benches/benchmark_centroiding.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
use std::env;
use std::time::Instant;
use timsquery::models::frames::expanded_frame::{
par_expand_and_arrange_frames,
par_expand_and_centroid_frames,
warn_and_skip_badframes,
FrameProcessingConfig,
};
use timsrust::readers::{
FrameReader,
MetadataReader,
};
use timsrust::MSLevel;
use tracing::subscriber::set_global_default;
use tracing_bunyan_formatter::{
BunyanFormattingLayer,
JsonStorageLayer,
};
use tracing_subscriber::prelude::*;
use tracing_subscriber::registry::Registry;
use tracing_subscriber::EnvFilter;

fn main() {
// "TIMS_DATA_FILE"
// Read from env
let env_filter = EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info"));
let formatting_layer = BunyanFormattingLayer::new("timsquery".into(), std::io::stdout);
let subscriber = Registry::default()
.with(env_filter)
.with(JsonStorageLayer)
.with(formatting_layer);

set_global_default(subscriber).expect("Setting default subscriber failed");

let tims_data_file = env::var("TIMS_DATA_FILE").expect("TIMS_DATA_FILE not set");
let sql_path = std::path::Path::new(&tims_data_file).join("analysis.tdf");
let meta_converters = MetadataReader::new(&sql_path).unwrap();
let centroiding_config = FrameProcessingConfig::default_centroided();
let centroiding_config = centroiding_config
.with_converters(meta_converters.im_converter, meta_converters.mz_converter);

let frame_reader = FrameReader::new(&tims_data_file).unwrap();
let ms1_iter = frame_reader.parallel_filter(|x| x.ms_level == MSLevel::MS1);
let ms1_iter = warn_and_skip_badframes(ms1_iter);
let start = Instant::now();
println!("Starting expansion");
let _expanded_ms1_frames = match centroiding_config {
FrameProcessingConfig::Centroided {
settings,
ims_converter,
mz_converter,
} => par_expand_and_centroid_frames(
ms1_iter,
settings.ims_tol_pct,
settings.mz_tol_ppm,
settings.window_width,
&ims_converter.unwrap(),
&mz_converter.unwrap(),
),
FrameProcessingConfig::NotCentroided => par_expand_and_arrange_frames(ms1_iter),
};
let elapsed = start.elapsed();
println!("Elapsed: {:.2?}", elapsed);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/sageresults/ubb_peptide_plotexpanded-raw-frame-index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/sageresults/ubb_peptide_plottransposed-quad-index.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading