cyto_cli/ibu/barcode.rs
1use std::path::Path;
2
3use super::IbuInput;
4
5use clap::Parser;
6
7#[derive(Parser, Debug)]
8pub struct ArgsBarcode {
9 #[clap(flatten)]
10 pub input: IbuInput,
11
12 #[clap(flatten)]
13 pub options: OptionsBarcode,
14}
15impl ArgsBarcode {
16 pub fn from_wf_path<P: AsRef<Path>>(
17 input_path: &str,
18 output_path: &str,
19 whitelist: &str,
20 bc_log: P,
21 exact: bool,
22 skip_second_pass: bool,
23 ) -> Self {
24 Self {
25 input: IbuInput::from_path(input_path),
26 options: OptionsBarcode {
27 whitelist: whitelist.to_string(),
28 exact,
29 skip_second_pass,
30 include: false,
31 output: Some(output_path.to_string()),
32 log: Some(bc_log.as_ref().display().to_string()),
33 },
34 }
35 }
36}
37
38#[derive(Parser, Debug)]
39#[clap(next_help_heading = "Barcode Correction Options")]
40pub struct OptionsBarcode {
41 /// Path of the whitelist file
42 ///
43 /// This is a file containing a single nucleotide sequence per line
44 ///
45 /// Compression supported for: [gzip, bzip, lzma, zstd]
46 #[clap(short = 'w', long)]
47 pub whitelist: String,
48
49 /// Exact match only
50 ///
51 /// If this flag is present, only exact matches will be accepted.
52 #[clap(long = "bc-exact")]
53 pub exact: bool,
54
55 /// Skip second pass correction
56 ///
57 /// Second pass correction is enabled by default and collapses cell barcodes into the maximum abundance ambiguous parent
58 #[clap(short = 's', long)]
59 pub skip_second_pass: bool,
60
61 /// Include ambiguous or non-whitelist sequences
62 ///
63 /// If this flag is present, sequences that are
64 /// not within the distance threshold of a whitelist sequence
65 /// or are ambiguously distant from multiple whitelist sequences
66 /// will be included in the output.
67 #[clap(short = 'I', long)]
68 pub include: bool,
69
70 /// Output file to write to [default=stdout]
71 #[clap(short, long)]
72 pub output: Option<String>,
73
74 /// Output file to write statistics to [default=stderr]
75 ///
76 /// Will output as json
77 #[clap(short, long)]
78 pub log: Option<String>,
79}