Skip to content

Commit

Permalink
commands/normalize: Add conversion from io::Error to NormalizeError
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Feb 4, 2025
1 parent 15b477f commit d7b75c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/commands/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
#[derive(Debug, Error)]
pub enum NormalizeError {
#[error("I/O error")]
Io(#[source] io::Error),
Io(#[from] io::Error),
#[error("could not open file: {1}")]
OpenFile(#[source] io::Error, PathBuf),
#[error("invalid counts")]
Expand Down Expand Up @@ -58,7 +58,7 @@ where

info!(normalization_method = ?method, "normalizing counts");

let lengths = calculate_feature_lengths(&features, &names).map_err(NormalizeError::Io)?;
let lengths = calculate_feature_lengths(&features, &names)?;

let normalized_counts = match method {
normalization::Method::Fpkm => fpkm::normalize(&lengths, &counts),
Expand All @@ -68,7 +68,7 @@ where
let stdout = io::stdout().lock();
let mut writer = BufWriter::new(stdout);

write_normalized_counts(&mut writer, &names, &normalized_counts).map_err(NormalizeError::Io)?;
write_normalized_counts(&mut writer, &names, &normalized_counts)?;

Ok(())
}
Expand Down

0 comments on commit d7b75c6

Please sign in to comment.