Skip to content

Commit

Permalink
rname scrub command to scrub-reads
Browse files Browse the repository at this point in the history
  • Loading branch information
esteinig committed Feb 17, 2023
1 parent 89a43f0 commit 79f9ef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::collections::HashSet;
use std::ffi::{OsString, OsStr};
use std::path::PathBuf;
use structopt::StructOpt;
Expand All @@ -15,10 +16,10 @@ pub enum CliError {
CompressionLevel(String),
/// Indicates a bad combination of input and output files was passed.
#[error("Bad combination of input and output files: {0}")]
BadInputOutputCombination(String),
BadInputOutputCombination(String)
}

/// MGP-DEPLETE command-line interface
/// Scrubby command-line application
#[derive(Debug, StructOpt)]
pub struct Cli {
#[structopt(subcommand)]
Expand All @@ -29,7 +30,7 @@ pub struct Cli {
pub enum Commands {
#[structopt(global_settings = &[AppSettings::ColoredHelp, AppSettings::ArgRequiredElseHelp])]
/// Clean seqeunce data by removing background taxa (k-mer) or host reads (alignment)
Scrub {
ScrubReads {
/// Input filepath(s) (fa, fq, gz, bz).
///
/// For paired Illumina you may either pass this flag twice `-i r1.fq -i r2.fq` or give two
Expand Down Expand Up @@ -149,7 +150,7 @@ impl Cli {
/// - An unequal number of `--input` and `--output` are passed
pub fn validate_input_output_combination(&self) -> Result<(), CliError> {
match &self.commands {
Commands::Scrub { input, output, .. } => {
Commands::ScrubReads { input, output, .. } => {
let out_len = output.len();
let in_len = input.len();
if in_len > 2 {
Expand Down Expand Up @@ -211,4 +212,3 @@ fn parse_level(s: &str) -> Result<niffler::Level, CliError> {
};
Ok(lvl)
}

12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ pub enum ScrubbyError {
fn main() -> Result<()> {
let cli = cli::Cli::from_args();

// Command specific checks - scrubbing

// Command line application specific checks
cli.validate_input_output_combination()?;

Builder::new()
Expand Down Expand Up @@ -65,7 +64,7 @@ fn main() -> Result<()> {


match cli.commands {
cli::Commands::Scrub {
cli::Commands::ScrubReads {
input,
output,
workdir,
Expand All @@ -80,8 +79,10 @@ fn main() -> Result<()> {
} => {

let scrubber = scrub::Scrubber::new(workdir, output_format, compression_level)?;


log::info!("=============================================");
log::info!("Welcome to Scrubby! You name it, we clean it.");
log::info!("=============================================");

let mut read_files = input;
for (db_index, db_path) in kraken_db.into_iter().enumerate() {
Expand All @@ -102,8 +103,9 @@ fn main() -> Result<()> {

}
}

log::info!("==============================================================");
log::info!("Thank you for using Scrubby! Your sequence data, only cleaner.");
log::info!("==============================================================");

Ok(())
}
Expand Down

0 comments on commit 79f9ef2

Please sign in to comment.