Skip to content

Commit

Permalink
Switch to using compress_io from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
heathsc committed Apr 6, 2022
1 parent 144d064 commit 6a4260f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
7 changes: 4 additions & 3 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ont_demult"
version = "0.3.2"
version = "0.3.3"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -11,4 +11,4 @@ log = "~0.4"
stderrlog = "~0.5"
clap = {version = "~3.1", features = ["cargo"]}
anyhow = "~1.0"
compress_io = { git = "https://github.com/heathsc/compress_io.git" }
compress_io = "~0.4"
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ as a cut site name, or it will cause the files to be overwritten!

## Changes

- 0.3.3 Switch to using compress_io from crates.io
- 0.3.2 Fix bug in Xor selection mode where a read only matching the end site would not be selected
- 0.3.1 Correct headers in results file. Clean up output.
- 0.3.1 Fix compress option which was not being read correctly.
Expand Down
4 changes: 2 additions & 2 deletions src/fastq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
path::Path,
};

use compress_io::compress::CompressIo;
use compress_io::compress::{CompressIo, Writer};

fn gen_err(s: &str, line: usize) -> io::Error {
Error::new(ErrorKind::Other, format!("{} at line {}", s, line))
Expand Down Expand Up @@ -91,7 +91,7 @@ impl FastqFile {
self.buf[1].trim().len()
}

pub fn write_rec(&self, wrt: &mut BufWriter<Box<dyn Write>>) -> io::Result<()> {
pub fn write_rec(&self, wrt: &mut BufWriter<Writer>) -> io::Result<()> {
write!(wrt, "{}{}+\n{}", self.buf[0], self.buf[1], self.buf[2])
}
}
14 changes: 7 additions & 7 deletions src/output.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::collections::HashMap;
use std::io::{self, Write, BufWriter};
use std::io::{self, BufWriter};

use compress_io::{
compress::CompressIo,
compress::{CompressIo, Writer},
compress_type::CompressType
};

use crate::params::Param;

pub fn open_output_file<S: AsRef<str>>(name: S, param: &Param) -> io::Result<BufWriter<Box<dyn Write>>> {
pub fn open_output_file<S: AsRef<str>>(name: S, param: &Param) -> io::Result<BufWriter<Writer>> {
let fname = format!("{}_{}", param.prefix(), name.as_ref());
let mut c = CompressIo::new();
if param.compress() {
Expand All @@ -18,10 +18,10 @@ pub fn open_output_file<S: AsRef<str>>(name: S, param: &Param) -> io::Result<Buf
}

pub struct OutputFiles<'a> {
pub unmapped: Option<BufWriter<Box<dyn Write>>>,
pub low_mapq: Option<BufWriter<Box<dyn Write>>>,
pub unmatched: Option<BufWriter<Box<dyn Write>>>,
pub site_hash: HashMap<&'a str, BufWriter<Box<dyn Write>>>,
pub unmapped: Option<BufWriter<Writer>>,
pub low_mapq: Option<BufWriter<Writer>>,
pub unmatched: Option<BufWriter<Writer>>,
pub site_hash: HashMap<&'a str, BufWriter<Writer>>,
}

impl<'a> OutputFiles<'a> {
Expand Down

0 comments on commit 6a4260f

Please sign in to comment.