Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 2 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ crate-type = ["cdylib"]
default = []

[dependencies]
mzdata = { version = "0.59.2", features = ["thermo"] }
mzdata = { git = "https://github.com/mobiusklein/mzdata.git", features = ["thermo"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a more recent version (like 0.61.0) not work?

pyo3 = { version = "0.23.3", features = ["anyhow"] }
timsrust = "0.4.1"
5 changes: 3 additions & 2 deletions src/parse_mzdata.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::fs::File;

use mzdata::{params::ParamValue, prelude::*, MZReader};

Expand Down Expand Up @@ -48,7 +49,7 @@ impl From<mzdata::spectrum::MultiLayerSpectrum> for MS2Spectrum {
pub fn parse_precursor_info(
spectrum_path: &str,
) -> Result<HashMap<String, Precursor>, std::io::Error> {
let reader = MZReader::open_path(spectrum_path)?;
let reader = MZReader::<File>::open_read_seek_generic(Box::new(File::open(spectrum_path)?))?;
Ok(reader
.filter(|spectrum| spectrum.description.ms_level == 2)
.filter_map(|spectrum| {
Expand All @@ -60,7 +61,7 @@ pub fn parse_precursor_info(

/// Read MS2 spectra from spectrum files with mzdata
pub fn read_ms2_spectra(spectrum_path: &str) -> Result<Vec<MS2Spectrum>, std::io::Error> {
let mut reader = MZReader::open_path(spectrum_path)?;
let mut reader = MZReader::<File>::open_read_seek_generic(Box::new(File::open(spectrum_path)?))?;
if let MZReader::ThermoRaw(inner) = &mut reader {
inner.set_centroiding(true);
}
Expand Down
Loading