Skip to content

Commit

Permalink
Release v0.14.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lazear committed Oct 26, 2023
1 parent 21b0928 commit e35357d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 33 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.14.4]
### Added
- **Unstable feature**: Preliminary support for reading Bruker .d folders (ddaPASEF; no MS1/LFQ support yet)
### Changed
- Retention times are converted to minutes
### Fixed
- Fixed bug where charge state 1 would never be searched

## [v0.14.3]
### Fixed
- Hotfix for bug in parquet LFQ writer
Expand Down
6 changes: 3 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 crates/sage-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sage-cli"
version = "0.14.3"
version = "0.14.4"
authors = ["Michael Lazear <[email protected]"]
edition = "2021"
rust-version = "1.62"
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-cloudpath/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sage-cloudpath"
version = "0.14.3"
version = "0.14.4"
authors = ["Michael Lazear <[email protected]"]
edition = "2021"
rust-version = "1.62"
Expand Down
2 changes: 1 addition & 1 deletion crates/sage-cloudpath/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub enum Error {
#[error("MzML error: {0}")]
MzML(#[from] mzml::MzMLError),
#[error("TDF error: {0}")]
TDF(#[from] tdf::TdfError),
TDF(#[from] timsrust::Error),
}

#[cfg(test)]
Expand Down
33 changes: 8 additions & 25 deletions crates/sage-cloudpath/src/tdf.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
use rayon::prelude::*;
use sage_core::spectrum::{Precursor, RawSpectrum, Representation};
use std::fmt::{Display, Formatter};
use timsrust;

#[derive(Default)]
pub struct TdfReader {}
pub struct TdfReader;

impl TdfReader {
pub fn parse(
&self,
path_name: impl AsRef<str>,
file_id: usize,
) -> Result<Vec<RawSpectrum>, TdfError> {
) -> Result<Vec<RawSpectrum>, timsrust::Error> {
let dda_spectra: Vec<timsrust::Spectrum> =
timsrust::FileReader::new(path_name.as_ref().to_string())
.unwrap()
.read_all_spectra();
let spectra: Vec<RawSpectrum> = dda_spectra
timsrust::FileReader::new(path_name.as_ref())?.read_all_spectra();
let spectra: Vec<RawSpectrum> = (0..dda_spectra.len())
.into_par_iter()
.map(|dda_spectrum| {
.map(|index| {
let dda_spectrum = &dda_spectra[index];
let mut precursor: Precursor = Precursor::default();
let dda_precursor: timsrust::Precursor =
dda_spectrum.precursor.unwrap_as_precursor();
Expand All @@ -28,10 +24,10 @@ impl TdfReader {
precursor.intensity = Option::from(dda_precursor.intensity as f32);
precursor.spectrum_ref = Option::from(dda_precursor.frame_index.to_string());
let spectrum: RawSpectrum = RawSpectrum {
file_id: file_id,
file_id,
precursors: vec![precursor],
representation: Representation::Centroid,
scan_start_time: dda_precursor.rt as f32,
scan_start_time: dda_precursor.rt as f32 / 60.0,
ion_injection_time: dda_precursor.rt as f32,
total_ion_current: 0.0,
mz: dda_spectrum.mz_values.iter().map(|&x| x as f32).collect(),
Expand All @@ -47,16 +43,3 @@ impl TdfReader {
Ok(spectra)
}
}

#[derive(thiserror::Error, Debug)]
pub enum TdfError {
Unreadable,
}

impl Display for TdfError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
TdfError::Unreadable => f.write_str("Tdf Error : Malformed data."),
}
}
}
2 changes: 1 addition & 1 deletion crates/sage-cloudpath/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn read_mzml<S: AsRef<str>>(
}

pub fn read_tdf<S: AsRef<str>>(s: S, file_id: usize) -> Result<Vec<RawSpectrum>, Error> {
let res = crate::tdf::TdfReader::default().parse(s, file_id);
let res = crate::tdf::TdfReader.parse(s, file_id);
match res {
Ok(t) => Ok(t),
Err(e) => Err(Error::TDF(e)),
Expand Down
2 changes: 1 addition & 1 deletion crates/sage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sage-core"
version = "0.14.3"
version = "0.14.4"
authors = ["Michael Lazear <[email protected]"]
edition = "2021"
rust-version = "1.62"
Expand Down

0 comments on commit e35357d

Please sign in to comment.