Skip to content

Commit

Permalink
add xz support
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkLoc committed Jan 16, 2024
1 parent 6867673 commit b9293bb
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 90 deletions.
23 changes: 22 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fqkit"
version = "0.3.8"
version = "0.3.9"
edition = "2021"
authors = ["sharkLoc <[email protected]>"]
rust-version = "1.65.0"
Expand Down Expand Up @@ -31,3 +31,4 @@ regex = "1.9.5"
rgb = "0.8.36"
term_size = "0.3.2"
textplots = "0.8.4"
xz2 = "0.1.7"
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,20 @@ cargo install --git https://github.com/sharkLoc/fqkit.git
```bash
FqKit -- A simple and cross-platform program for fastq file manipulation

Version: 0.3.8
Version: 0.3.9

Authors: sharkLoc <[email protected]>
Source code: https://github.com/sharkLoc/fqkit.git

Fqkit supports reading and writing gzip (.gz) format.
Bzip2 format is supported since v0.3.8
Bzip2 (.bz2) format is supported since v0.3.8.
Xz (.xz) format is supported since v0.3.9.

Compression level:
format range default crate
gzip 1-9 6 https://crates.io/crates/flate2
bzip 1-9 6 https://crates.io/crates/bzip2

xz 1-9 6 https://crates.io/crates/xz2

Usage: fqkit [OPTIONS] <COMMAND>

Expand Down
Binary file added example/mini2k.fq.bz2
Binary file not shown.
Binary file added example/mini2k.fq.xz
Binary file not shown.
12 changes: 11 additions & 1 deletion src/barcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ pub fn split_fq(
outdir: &str,
gzip: bool,
bzip2: bool,
xz: bool,
compression_level: u32,
) -> Result<()> {
let start = Instant::now();
Expand All @@ -111,8 +112,11 @@ pub fn split_fq(
if bzip2 {
n += 1;
}
if xz {
n += 1;
}
if n > 1 {
error!("only one of the flags --gzip and --bzip2 is allowed");
error!("only one of the flags --gzip, --xz and --bzip2 is allowed");
std::process::exit(1);
}

Expand All @@ -128,20 +132,26 @@ pub fn split_fq(
format!("{}/{}_1.fq.gz", outdir, name)
} else if bzip2 {
format!("{}/{}_1.fq.bz2", outdir, name)
} else if xz {
format!("{}/{}_1.fq.xz", outdir, name)
} else {
format!("{}/{}_1.fq", outdir, name)
};
let fq2 = if gzip {
format!("{}/{}_2.fq.gz", outdir, name)
} else if bzip2 {
format!("{}/{}_2.fq.bz2", outdir, name)
} else if xz {
format!("{}/{}_2.fq.xz", outdir, name)
} else {
format!("{}/{}_2.fq", outdir, name)
};
let bar = if gzip {
format!("{}/{}_barcode.fq.gz", outdir, name)
} else if bzip2 {
format!("{}/{}_barcode.fq.bz2", outdir, name)
} else if xz {
format!("{}/{}_barcode.fq.xz", outdir, name)
} else {
format!("{}/{}_barcode.fq", outdir, name)
};
Expand Down
Loading

0 comments on commit b9293bb

Please sign in to comment.