fibertools_rs/cli/
pg_pansn_opts.rs1use crate::utils::input_bam::InputBam;
2use clap::Args;
3use std::fmt::Debug;
4
5#[derive(Args, Debug, Clone)]
6pub struct PansnParameters {
7 #[clap(short, long, conflicts_with = "strip")]
10 pub prefix: Option<String>,
11 #[clap(long, conflicts_with = "prefix")]
14 pub strip: bool,
15 #[clap(short, long, default_value = "#", requires = "strip")]
17 pub delimiter: char,
18 #[clap(short = '1', long = "hap1-tag")]
21 pub hap1_tag: Option<String>,
22 #[clap(short = '2', long = "hap2-tag")]
25 pub hap2_tag: Option<String>,
26 #[clap(short = 'q', long = "min-mapq", default_value = "0")]
28 pub min_mapq: u8,
29 #[clap(short = 'c', long = "copy-header")]
31 pub copy_header: Option<String>,
32}
33
34impl Default for PansnParameters {
35 fn default() -> Self {
36 Self {
37 prefix: None,
38 strip: false,
39 delimiter: '#',
40 hap1_tag: None,
41 hap2_tag: None,
42 min_mapq: 0,
43 copy_header: None,
44 }
45 }
46}
47
48impl PansnParameters {
49 pub fn has_operations(&self) -> bool {
51 let has_panspec_operation = self.prefix.is_some() || self.strip;
52 let has_haplotag_operation = self.hap1_tag.is_some() && self.hap2_tag.is_some();
53 let has_copy_header_operation = self.copy_header.is_some();
54
55 has_panspec_operation || has_haplotag_operation || has_copy_header_operation
56 }
57}
58
59#[derive(Args, Debug)]
60pub struct PgPansnOptions {
61 #[clap(flatten)]
62 pub input: InputBam,
63 #[clap(default_value = "-")]
65 pub out: String,
66 #[clap(long)]
68 pub header_out: Option<String>,
69 #[clap(flatten)]
70 pub pansn: PansnParameters,
71}