Skip to content

Commit

Permalink
feat: add option -r for subcli length
Browse files Browse the repository at this point in the history
chore: remove changle log in README
- change log style (logger.rs)
- add categories in Cargo.toml
  • Loading branch information
sharkLoc committed Apr 26, 2024
1 parent eb8bca8 commit 1ed83c6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 67 deletions.
2 changes: 1 addition & 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,11 +1,12 @@
[package]
name = "fqkit"
version = "0.4.3"
version = "0.4.4"
edition = "2021"
authors = ["sharkLoc <[email protected]>"]
rust-version = "1.77.2"
homepage = "https://github.com/sharkLoc/fqkit"
repository = "https://github.com/sharkLoc/fqkit"
categories = ["Bioinformatics"]
description = "fqkit: a simple and cross-platform program for fastq file manipulation"
keywords = ["fastq", "reads","bio", "hts", "barcode"]
readme = "README.md"
Expand Down
61 changes: 1 addition & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cargo install --git https://github.com/sharkLoc/fqkit.git
```bash
FqKit -- A simple and cross-platform program for fastq file manipulation

Version: 0.4.3
Version: 0.4.4

Authors: sharkLoc <[email protected]>
Source code: https://github.com/sharkLoc/fqkit.git
Expand Down Expand Up @@ -110,63 +110,4 @@ Global FLAGS:
Use "fqkit help [command]" for more information about a command
```
## change log
<details>
<summary>timeline</summary>
2023.11.03:
- update to version 0.2.12
- add subcommand trim
- update cmd help information
2023.11.08:
- update to version 0.2.13
- add subcommand reverse
2023.11.10:
- update to version 0.2.14
- add subcommand view
- rebuilt some command interface
2023.11.29:
- update to version 0.2.15
- recode func in stats subcommand
2023.12.04
- update to version 0.2.16
- add subcommand size
2023.12.05
- update to version 0.2.17
- update code for subcommand size and search
- add subcommand fq2sam
- add log information options verbosity
2023.12.09
- update to version 0.2.18
- add subcommand sort, range, check and mask
- update to version 0.2.19
- add subcommand shuffle
2023.12.10
- update to version 0.3.0
- add glob option --compress-level for gzip output file
2023.12.11
- update to version 0.3.1
- add subcommand grep and fqscore
2023.12.11
- update to version 0.3.2
- add subcommand slide
2023.12.19
- update to version 0.3.5
- add subcommand filter
2024.03.27
- remove subcommand join
</details>
#### ** any bugs please report issues **💖
7 changes: 6 additions & 1 deletion src/cli/length.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::time::Instant;

pub fn fq_length(
file: Option<&String>,
rev: bool,
out: Option<&String>,
compression_level: u32,
) -> Result<(), Error> {
Expand All @@ -29,7 +30,11 @@ pub fn fq_length(
}

let mut sort_len: Vec<(&usize, &usize)> = reads_len.iter().collect();
sort_len.sort_by_key(|x| x.0);
if rev {
sort_len.sort_by(|x,y|y.0.cmp(x.0));
} else {
sort_len.sort_by_key(|x| x.0);
}

fo.write_all("lenth\tcount\n".as_bytes())?;
for (k, v) in sort_len.iter() {
Expand Down
5 changes: 4 additions & 1 deletion src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::{value_parser, Parser};
#[command(
name = "FqKit",
author = "sharkLoc",
version = "0.4.3",
version = "0.4.4",
about = "A simple and cross-platform program for fastq file manipulation",
long_about = None,
next_line_help = false,
Expand Down Expand Up @@ -674,6 +674,9 @@ pub enum Subcli {
length {
/// input fastq file, or read from stdin
input: Option<String>,
/// output reversed result
#[arg(short = 'r', long = "reverse", help_heading = Some("FLAGS"))]
reverse: bool,
/// output file name or write to stdout, file ending in .gz/.bz2/.xz will be compressed automatically
#[arg(short = 'o', long = "out", value_name = "FILE")]
out: Option<String>,
Expand Down
2 changes: 1 addition & 1 deletion src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn logger<P: AsRef<Path>>(
}
writeln!(
buf,
"[{} {} - {}] {}",
"{} {} - {} {}",
Local::now().format("%Y-%m-%dT%H:%M:%S"),
style.value(record.level()),
buf.style()
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ fn main() -> Result<(), Error> {
arg.compression_level,
)?;
}
Subcli::length { input, out } => {
fq_length(input.as_ref(), out.as_ref(), arg.compression_level)?;
Subcli::length { input, reverse, out } => {
fq_length(input.as_ref(), reverse, out.as_ref(), arg.compression_level)?;
}
Subcli::view { input, out } => {
view_fq(input.as_ref(), out.as_ref(), arg.compression_level)?;
Expand Down

0 comments on commit 1ed83c6

Please sign in to comment.