Skip to content

Commit

Permalink
Update to stable clap 3
Browse files Browse the repository at this point in the history
  • Loading branch information
natir committed Mar 1, 2022
1 parent 8f93453 commit fd179c2
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 113 deletions.
44 changes: 22 additions & 22 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ license = "MIT"
keywords = ["bioinformatics", "chimera", "long-read", "scrubbing"]

[dependencies]
noodles = { version = "0.18", features = ["fasta", "fastq"] }
noodles = { version = "0.18", features = ["fasta", "fastq"] }
csv = "1"
log = "0.4"
sled = "0.34"
Expand Down
133 changes: 43 additions & 90 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,58 +39,36 @@ Yacrd can make some other actions:
"
)]
pub struct Command {
#[clap(
short = 'i',
long = "input",
help = "path to input file overlap (.paf|.m4|.mhap) or yacrd report (.yacrd), format is autodetected and compression input is allowed (gz|bzip2|lzma)"
)]
/// path to input file overlap (.paf|.m4|.mhap) or yacrd report (.yacrd), format is autodetected and compression input is allowed (gz|bzip2|lzma)
#[clap(short = 'i', long = "input")]
pub input: String,

#[clap(short = 'o', long = "output", help = "path output file")]
/// path output file
#[clap(short = 'o', long = "output")]
pub output: String,

#[clap(
short = 't',
long = "thread",
help = "number of thread use by yacrd, 0 mean all threads available, default 1"
)]
/// number of thread use by yacrd, 0 mean all threads available, default 1
#[clap(short = 't', long = "thread")]
pub threads: Option<usize>,

#[clap(
short = 'c',
long = "coverage",
default_value = "0",
help = "if coverage reach this value region is marked as bad"
)]
/// if coverage reach this value region is marked as bad
#[clap(short = 'c', long = "coverage", default_value = "0")]
pub coverage: u64,

#[clap(
short = 'n',
long = "not-coverage",
default_value = "0.8",
help = "if the ratio of bad region length on total length is lower than this value, read is marked as NotCovered"
)]
/// if the ratio of bad region length on total length is lower than this value, read is marked as NotCovered
#[clap(short = 'n', long = "not-coverage", default_value = "0.8")]
pub not_coverage: f64,

#[clap(
long = "read-buffer-size",
default_value = "8192",
help = "Control the size of the buffer used to read paf file"
)]
/// Control the size of the buffer used to read paf file
#[clap(long = "read-buffer-size", default_value = "8192")]
pub buffer_size: usize,

#[clap(
short = 'd',
long = "ondisk",
help = "yacrd switches to 'ondisk' mode which will reduce memory usage but increase computation time. The value passed as a parameter is used as a prefix for the temporary files created by yacrd. Be careful if the prefix contains path separators (`/` for unix or `\\` for windows) this folder will be deleted"
)]
/// yacrd switches to 'ondisk' mode which will reduce memory usage but increase computation time. The value passed as a parameter is used as a prefix for the temporary files created by yacrd. Be careful if the prefix contains path separators (`/` for unix or `\\` for windows) this folder will be deleted
#[clap(short = 'd', long = "ondisk")]
pub ondisk: Option<String>,

#[clap(
long = "ondisk-buffer-size",
default_value = "64000000",
help = "with the default value yacrd in 'ondisk' mode use around 1 GBytes, you can increase to reduce runtime but increase memory usage"
)]
/// with the default value yacrd in 'ondisk' mode use around 1 GBytes, you can increase to reduce runtime but increase memory usage
#[clap(long = "ondisk-buffer-size", default_value = "64000000")]
pub ondisk_buffer_size: String,

#[clap(subcommand)]
Expand All @@ -99,88 +77,63 @@ pub struct Command {

#[derive(clap::Parser, Debug)]
pub enum SubCommand {
#[clap(override_help = "All bad region of read is removed")]
/// All bad region of read is removed
#[clap()]
Scrubb(Scrubb),
#[clap(override_help = "Record mark as chimeric or NotCovered is filter")]

/// Record mark as chimeric or NotCovered is filter
#[clap()]
Filter(Filter),
#[clap(override_help = "Record mark as chimeric or NotCovered is extract")]

/// Record mark as chimeric or NotCovered is extract
#[clap()]
Extract(Extract),
#[clap(override_help = "Record mark as chimeric or NotCovered is split")]

/// Record mark as chimeric or NotCovered is split
#[clap()]
Split(Split),
}

#[derive(clap::Parser, Debug)]
pub struct Scrubb {
#[clap(
short = 'i',
long = "input",
required = true,
help = "path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)"
)]
/// path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)
#[clap(short = 'i', long = "input", required = true)]
pub input: String,

#[clap(
short = 'o',
long = "output",
required = true,
help = "path to output file, format and compression of input is preserved"
)]
/// path to output file, format and compression of input is preserved
#[clap(short = 'o', long = "output", required = true)]
pub output: String,
}

#[derive(clap::Parser, Debug)]
pub struct Filter {
#[clap(
short = 'i',
long = "input",
required = true,
help = "path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)"
)]
/// path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)
#[clap(short = 'i', long = "input", required = true)]
pub input: String,

#[clap(
short = 'o',
long = "output",
required = true,
help = "path to output file, format and compression of input is preserved"
)]
/// path to output file, format and compression of input is preserved
#[clap(short = 'o', long = "output", required = true)]
pub output: String,
}

#[derive(clap::Parser, Debug)]
pub struct Extract {
#[clap(
short = 'i',
long = "input",
required = true,
help = "path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)"
)]
/// path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)
#[clap(short = 'i', long = "input", required = true)]
pub input: String,

#[clap(
short = 'o',
long = "output",
required = true,
help = "path to output file, format and compression of input is preserved"
)]
/// path to output file, format and compression of input is preserved
#[clap(short = 'o', long = "output", required = true)]
pub output: String,
}

#[derive(clap::Parser, Debug)]
pub struct Split {
#[clap(
short = 'i',
long = "input",
required = true,
help = "path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)"
)]
/// path to sequence input (fasta|fastq), compression is autodetected (none|gzip|bzip2|lzma)
#[clap(short = 'i', long = "input", required = true)]
pub input: String,

#[clap(
short = 'o',
long = "output",
required = true,
help = "path to output file, format and compression of input is preserved"
)]
/// path to output file, format and compression of input is preserved
#[clap(short = 'o', long = "output", required = true)]
pub output: String,
}

0 comments on commit fd179c2

Please sign in to comment.