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

Added method to retrieve the raw spectrum from any USI #15

Merged
merged 12 commits into from
Nov 1, 2024
Merged
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features nalgebra,parallelism,async,mzsignal,thermo -- --nocapture --show-output
args: --no-default-features --features nalgebra,parallelism,async,mzsignal,thermo,proxi,proxi-async,tokio -- --nocapture --show-output
142 changes: 142 additions & 0 deletions Cargo.lock

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

11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ doc-only = ["thermorawfilereader/doc-only"]

async = ["tokio", "quick-xml/async-tokio"]

proxi = ["reqwest"]
proxi-async = ["proxi", "futures"]

[dependencies]
regex = "1"
lazy_static = "1.4.0"
Expand All @@ -91,7 +94,9 @@ indexmap = { version = "2.0.0", features = ["serde"] }
log = "0.4.20"
mzpeaks = { version = ">=0.22.0,<1.0.0" }
rayon = { version = ">=1.8.0,<2.0", optional = true }
mzsignal = { version = ">=0.25.0,<1.0.0", default-features = false, optional = true, features = ['avx']}
mzsignal = { version = ">=0.25.0,<1.0.0", default-features = false, optional = true, features = [
'avx',
] }
md5 = "0.7.0"
tokio = { version = "1.32.0", optional = true, features = [
"macros",
Expand All @@ -107,6 +112,8 @@ libz-sys = { version = "1.1", default-features = false, features = [
], optional = true }
ndarray = { version = "0.15.6", optional = true }
filename = { version = "0.1.1", optional = true }
reqwest = { version = "0.12", features = ["json", "blocking"], optional = true }
futures = { version = "0.3", optional = true }

numpress = { version = "1.1.0", optional = true }
bytemuck = { version = "1.18.0", features = ["extern_crate_alloc"] }
Expand Down Expand Up @@ -139,6 +146,8 @@ features = [
"mzmlb",
"async",
"thermorawfilereader",
"proxi",
"proxi-async",
"doc-only",
]
no-default-features = true
3 changes: 2 additions & 1 deletion examples/averaging_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ fn main() -> io::Result<()> {
);
});

let collator_task = thread::spawn(move || Collator::collate_sync(input_receiver, output_sender));
let collator_task =
thread::spawn(move || Collator::collate_sync(input_receiver, output_sender));

let writer_task = thread::spawn(move || -> io::Result<()> {
for (_, group) in output_receiver {
Expand Down
4 changes: 2 additions & 2 deletions examples/describe_instrument.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::env;
use std::io;

use mzdata::prelude::*;
use mzdata::mz_read;
use mzdata::prelude::*;

fn main() -> io::Result<()> {
env_logger::init();
Expand All @@ -29,4 +29,4 @@ fn main() -> io::Result<()> {
}

Ok(())
}
}
32 changes: 15 additions & 17 deletions examples/get_scan_by.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,30 @@ use log::info;
use mzdata::io::MZReader;
use mzdata::prelude::*;


fn main() -> io::Result<()> {
env_logger::init();
let mut args = env::args().skip(1);

let path = path::PathBuf::from(
args.next()
.expect("Please pass an MS data file path"),
);
let path = path::PathBuf::from(args.next().expect("Please pass an MS data file path"));

let key = args.next().expect("Please provide a key type, \"id\", \"index\" or \"time\"");
let key_value = args.next().expect("Please provide a key value matching the key type");
let key = args
.next()
.expect("Please provide a key type, \"id\", \"index\" or \"time\"");
let key_value = args
.next()
.expect("Please provide a key value matching the key type");

info!("Opening {}", path.display());
let mut reader = MZReader::open_path(path)?;

let spectrum = match key.as_str() {
"id" => {
reader.get_spectrum_by_id(&key_value).unwrap()
},
"index" => {
reader.get_spectrum_by_index(key_value.parse().unwrap()).unwrap()
},
"time" => {
reader.get_spectrum_by_time(key_value.parse().unwrap()).unwrap()
},
"id" => reader.get_spectrum_by_id(&key_value).unwrap(),
"index" => reader
.get_spectrum_by_index(key_value.parse().unwrap())
.unwrap(),
"time" => reader
.get_spectrum_by_time(key_value.parse().unwrap())
.unwrap(),
_ => {
panic!("Unknown key type {}", key);
}
Expand All @@ -38,4 +36,4 @@ fn main() -> io::Result<()> {
dbg!(spectrum);

Ok(())
}
}
Loading
Loading