Skip to content

Commit

Permalink
Merge pull request #55 from tmaklin/master
Browse files Browse the repository at this point in the history
Add optional output filename option `-o` to `ska weed`.
  • Loading branch information
johnlees authored Sep 25, 2023
2 parents 25a01e3 + 1a061af commit 4eb1446
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ska"
version = "0.3.2"
version = "0.3.3"
authors = [
"John Lees <[email protected]>",
"Simon Harris <[email protected]>",
Expand Down
4 changes: 4 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ pub enum Commands {
/// A FASTA file containing sequences to remove
weed_file: Option<String>,

/// Output filename (omit to overwrite input file)
#[arg(short)]
output: Option<String>,

/// Remove k-mers not in the weed_file
#[arg(long, default_value_t = false)]
reverse: bool,
Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@
//!
//! Remove (weed) split k-mers from an `.skf` file. The split k-mers to be removed
//! are generated from a FASTA file, which may for example contain known transposons or
//! other repeat sequences. As with `delete`, the input `.skf` file is overwritten.
//! other repeat sequences. As with `delete`, the input `.skf` file is overwritten by default.
//! Use `-o` to write the results to a new file instead of overwriting the input `.skf`.
//!
//! ```bash
//! ska weed all_samples.skf MGEs.fa
Expand Down Expand Up @@ -635,6 +636,7 @@ pub fn main() {
Commands::Weed {
skf_file,
weed_file,
output,
reverse,
min_freq,
ambig_mask,
Expand All @@ -649,7 +651,7 @@ pub fn main() {
*min_freq,
filter,
*ambig_mask,
skf_file,
if output.is_none() { skf_file } else { output.as_ref().unwrap().as_str() },
);
} else if let Ok(mut ska_array) = MergeSkaArray::<u128>::load(skf_file) {
weed(
Expand All @@ -659,7 +661,7 @@ pub fn main() {
*min_freq,
filter,
*ambig_mask,
skf_file,
if output.is_none() { skf_file } else { output.as_ref().unwrap().as_str() },
);
} else {
panic!("Could not read input file: {skf_file}");
Expand Down

0 comments on commit 4eb1446

Please sign in to comment.