Skip to content

Commit

Permalink
Updating gzp version to fix sstadick/gzp#31
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvollger committed Jan 19, 2022
1 parent 37cac22 commit a628d68
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .test/large.test.fa.gz.fai
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CEN1::Chr1:14841109-17559778 2718669 30 2718669 2718670
CEN2::Chr2:3823791-6045243 2221452 2718728 2221452 2221453
CEN3::Chr3:13597187-15733925 2136738 4940211 2136738 2136739
CEN4::Chr4:4203901-6977949 2774048 7076978 2774048 2774049
CEN5::Chr5:11784130-14551809 2767679 9851057 2767679 2767680
Binary file added .test/large.test.fa.gz.gzi
Binary file not shown.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ path = "src/main.rs"
name = "rustybam"
path = "src/main.rs"

[[bin]]
name = "test"
path = "src/test.rs"

[features]
default = ["deflate_zlib_ng", "libdeflate"]
deflate_rust = ["gzp/deflate_rust", "flate2/rust_backend"]
Expand All @@ -40,7 +44,7 @@ clap = {version = "3.0.0", features = ["yaml", "derive"]}
colored = "2.0.0"
env_logger = "0.9.0"
flate2 = {version = "~1", default-features = false}
gzp = {version = "0.9.2", default-features = false}
gzp = {version = "0.9.3", default-features = false}
itertools = "0.10.0"
lazy_static = "1.4.0"
log = "0.4.14"
Expand Down
2 changes: 1 addition & 1 deletion src/fastx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ pub fn run_split_fastx(files: &[String], infile: &str) {
out_idx = 0;
}
}

// Close all the files.
// this breaks things?
for mut out in outs {
out.flush()
.unwrap_or_else(|_| panic!("Error flushing output!"));
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ pub mod paf;
pub mod suns;
/// Functions for trimming query overlaps from a PAF file.
pub mod trim_overlap;

//pub mod test;
6 changes: 3 additions & 3 deletions src/myio.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use anyhow::Result;
use flate2::read;
use flate2::Compression;
use gzp::deflate::Bgzf; //, Gzip, Mgzip, RawDeflate};
use gzp::BgzfSyncReader;
use gzp::Compression;
use gzp::ZBuilder;
use std::error::Error;
use std::ffi::OsStr;
Expand All @@ -11,7 +11,7 @@ use std::io::{self, BufRead, BufReader, BufWriter, Write};
use std::path::{Path, PathBuf};

type DynResult<T> = Result<T, Box<dyn Error + 'static>>;
const BUFFER_SIZE: usize = 128 * 1024;
const BUFFER_SIZE: usize = 32 * 1024;

/// Write normal or compressed files seamlessly
/// Uses the presence of a `.gz` extension to decide
Expand All @@ -23,7 +23,7 @@ pub fn writer(filename: &str) -> Box<dyn Write> {

if ext == Some(OsStr::new("gz")) {
let writer = ZBuilder::<Bgzf, _>::new()
.num_threads(0) // must limit to 1 thread because if I don't I get an error when I write to multiple gzip files with large input strings
.num_threads(8)
.compression_level(Compression::new(6))
.from_writer(buffer);
Box::new(writer)
Expand Down

0 comments on commit a628d68

Please sign in to comment.