diff --git a/.gitignore b/.gitignore index 9026c77..cd7df8e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target .vscode +*.fq +*.fq.gz diff --git a/Cargo.lock b/Cargo.lock index 147b86e..bca9520 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -488,8 +488,7 @@ dependencies = [ [[package]] name = "fgoxide" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de2a7105842bc5c341acb1013dca3b50bd0a9f8d8850987ee30d6b7e05185f19" +source = "git+https://github.com/brentp/fgoxide?branch=pub-is-gz#03c417b0b32901e3c35bd1ef8831422eb9280d6f" dependencies = [ "csv", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 82b2ef4..a7d92ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,8 @@ authors = [ "Nathan Roach ", "Tim Fennell ", - "Nils Homer " + "Nils Homer ", + "Brent Pedersen " ] name = "fqtk" version = "0.3.1-rc.1" @@ -36,7 +37,7 @@ bstr = "1.0.1" clap = { version = "4.3.22", features = ["derive"] } enum_dispatch = "0.3.8" env_logger = "0.9.3" -fgoxide = "0.3.0" +fgoxide = { git = "https://github.com/brentp/fgoxide", branch = "pub-is-gz" } flate2 = { version = "1.0.25", features = ["zlib-ng"] } # Force the faster backend that requires a C compiler itertools = "0.10.5" log = "0.4.17" diff --git a/src/bin/commands/trimmer.rs b/src/bin/commands/trimmer.rs index 2bdd2c4..598b4c2 100644 --- a/src/bin/commands/trimmer.rs +++ b/src/bin/commands/trimmer.rs @@ -109,11 +109,6 @@ fn create_writer>(name: P) -> Result, Error> { Ok(BufWriter::new(File::create(name)?)) } -fn check_extension(p: &Path) -> bool { - let ext = p.extension().map_or("", |v| v.to_str().unwrap_or("")); - ["bgz", "gz"].contains(&ext) -} - impl TrimmerOpts { fn prepare(&self) -> Result<(Pool, Vec, VecOfFqReaders), Error> { let fgio = Io::new(5, BUFFER_SIZE); @@ -130,7 +125,7 @@ impl TrimmerOpts { .output .iter() .map(|p| { - if !check_extension(p) { + if !Io::is_gzip_path(p) { log::warn!( "Output file {} does not end with .gz or .bgz. Writing bgzipped output to {} instead.", p.display(), @@ -265,29 +260,3 @@ impl Command for TrimmerOpts { Ok(()) } } - -#[cfg(test)] -mod tests { - use super::*; - use std::path::PathBuf; - - #[test] - fn test_check_extension_gz() { - let path = PathBuf::from("test_file.gz"); - assert_eq!( - check_extension(&path), - true, - "The function should return true for .gz extension" - ); - } - - #[test] - fn test_check_extension_txt() { - let path = PathBuf::from("test_file.txt"); - assert_eq!( - check_extension(&path), - false, - "The function should return false for .txt extension" - ); - } -}