Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lazear/sage into feature/…
Browse files Browse the repository at this point in the history
…mzMLb
  • Loading branch information
mobiusklein committed Jan 13, 2024
2 parents 9d4e340 + d1a06c3 commit 5e616d2
Show file tree
Hide file tree
Showing 10 changed files with 607 additions and 43 deletions.
20 changes: 5 additions & 15 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Sage is well-integrated into the open-source proteomics ecosystem. The following
- [SearchGUI](http://compomics.github.io/projects/searchgui): a graphical user interface for running searches
- [PeptideShaker](http://compomics.github.io/projects/peptide-shaker): visualize peptide-spectrum matches
- [MS2Rescore](http://compomics.github.io/projects/ms2rescore): AI-assisted rescoring of results
- [Picked group FDR](github.com/kusterlab/picked_group_fdr): scalable protein group FDR for large-scale experiments
- [Picked group FDR](https://github.com/kusterlab/picked_group_fdr): scalable protein group FDR for large-scale experiments
- [sagepy](https://github.com/theGreatHerrLebert/sagepy): Python bindings to the sage-core library
- [quantms](https://github.com/bigbio/quantms): nextflow pipeline for running searches with Sage
- [OpenMS](https://github.com/OpenMS/OpenMS): Sage is included as a "TOPP" tool in OpenMS
Expand Down
36 changes: 14 additions & 22 deletions crates/sage-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use sage_core::mass::Tolerance;
use sage_core::scoring::{Feature, Scorer};
use sage_core::spectrum::{ProcessedSpectrum, SpectrumProcessor};
use sage_core::tmt::TmtQuant;
use std::path::PathBuf;
use std::time::Instant;

mod input;
Expand Down Expand Up @@ -192,32 +191,25 @@ impl Runner {
self.parameters.deisotope,
);

let bruker_extensions = ["d", "tdf", "tdf_bin"];
let bruker_extensions = [".d", ".tdf", ".tdf_bin"];
let spectra = chunk
.par_iter()
.enumerate()
.flat_map(|(idx, path)| {
let res = match path {
path if bruker_extensions.contains(
&PathBuf::from(path)
.extension()
.unwrap_or_default()
.to_str()
.unwrap_or_default(),
) =>
{
sage_cloudpath::util::read_tdf(path, chunk_idx * batch_size + idx)
}
#[cfg(feature = "mzmlb")]
path if &PathBuf::from(path)
.extension()
.unwrap_or_default()
.to_str()
.unwrap_or_default().to_ascii_lowercase() == ".mzmlb" => {
sage_cloudpath::util::read_mzmlb(path, chunk_idx * batch_size + idx)
}
_ => sage_cloudpath::util::read_mzml(path, chunk_idx * batch_size + idx, sn),
let file_id = chunk_idx * batch_size + idx;

let path_lower = path.to_lowercase();
let res = if path_lower.ends_with(".mgf.gz") || path_lower.ends_with(".mgf") {
sage_cloudpath::util::read_mgf(path_lower, file_id)
} else if bruker_extensions
.iter()
.any(|ext| path_lower.ends_with(ext))
{
sage_cloudpath::util::read_tdf(path, file_id)
} else {
sage_cloudpath::util::read_mzml(path, file_id, sn)
};

match res {
Ok(s) => {
log::trace!("- {}: read {} spectra", path, s.len());
Expand Down
1 change: 1 addition & 0 deletions crates/sage-cloudpath/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ quick-xml = { version = "0.30.0", features = ["async-tokio"] }
timsrust = "0.2.0"
rayon = "1.5"
reqwest = { version = "0.11", features = ["json", "rustls-tls"], default-features = false }
regex = "1.6"

serde = { version="1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
3 changes: 3 additions & 0 deletions crates/sage-cloudpath/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::path::PathBuf;
use std::str::FromStr;
use tokio::io::{AsyncBufRead, AsyncRead, AsyncWriteExt, BufReader};

pub mod mgf;
pub mod mzml;
pub mod tdf;
pub mod util;
Expand Down Expand Up @@ -284,6 +285,8 @@ pub enum Error {
MzML(#[from] mzml::MzMLError),
#[error("TDF error: {0}")]
TDF(#[from] timsrust::Error),
#[error("MGF error: {0}")]
MGF(#[from] mgf::MgfError),
}

#[cfg(test)]
Expand Down
Loading

0 comments on commit 5e616d2

Please sign in to comment.