Skip to main content

fibertools_rs/cli/
fire_opts.rs

1use crate::utils::input_bam::InputBam;
2use clap::Args;
3use std::fmt::Debug;
4
5#[derive(Args, Debug)]
6pub struct FireOptions {
7    #[clap(flatten)]
8    pub input: InputBam,
9    /// Output file (BAM by default, table of MSP features if `--feats-to-text` is used, and bed9 + if `--extract`` is used)
10    #[clap(default_value = "-")]
11    pub out: String,
12    /// Force the ONT heuristic adjustment for every read in FIRE calling.
13    /// This adjusts the observed number of m6A counts by adding pseudo counts to account for the single stranded nature of ONT data.
14    /// ONT reads are auto-detected per read (via aux tags / read name), so this
15    /// flag is only needed to override detection; reads matching no known
16    /// platform convention default to PacBio.
17    #[clap(long, env)]
18    pub ont: bool,
19    /// Use a human model for FIRE calling
20    #[clap(hide = true, long, env)]
21    pub human: bool,
22    /// Use a yeast model for FIRE calling
23    #[clap(hide = true, long, env)]
24    pub yeast: bool,
25    /// Output just FIRE elements in bed9 format
26    #[clap(short, long)]
27    pub extract: bool,
28    /// When extracting bed9 format include all MSPs and nucleosomes
29    #[clap(long)]
30    pub all: bool,
31    /// Output FIREs features for training in a table format
32    #[clap(short, long)]
33    pub feats_to_text: bool,
34    /// Width of bin for feature collection
35    #[clap(short, long, default_value = "40", env, 
36        default_value_ifs([
37            ("human", "true", "40"),
38            ("yeast", "true", "100")
39        ])
40    )]
41    pub width_bin: i64,
42    /// Number of bins to collect
43    #[clap(short, long, default_value = "9", env)]
44    pub bin_num: i64,
45    /// Calculate stats for the highest X bp window within each MSP
46    /// Should be a fair amount higher than the expected linker length.
47    #[clap(long, default_value = "100", env)]
48    pub best_window_size: i64,
49    /// Use 5mC data in FIREs
50    #[clap(long, hide = true)]
51    pub use_5mc: bool,
52    /// Minium length of msp to call a FIRE
53    #[clap(long, default_value = "85", env)]
54    pub min_msp_length_for_positive_fire_call: i64,
55    /// Optional path to a model json file.
56    /// If not provided ft will use the default model (recommended).
57    #[clap(long, env = "FIRE_MODEL")]
58    pub model: Option<String>,
59    /// Optional path to a FDR table
60    #[clap(long, env)]
61    pub fdr_table: Option<String>,
62}
63
64impl Default for FireOptions {
65    fn default() -> Self {
66        Self {
67            input: Default::default(),
68            out: "-".to_string(),
69            ont: false,
70            human: false,
71            yeast: false,
72            extract: false,
73            all: false,
74            feats_to_text: false,
75            width_bin: 40,
76            bin_num: 9,
77            best_window_size: 100,
78            use_5mc: false,
79            min_msp_length_for_positive_fire_call: 85,
80            model: None,
81            fdr_table: None,
82        }
83    }
84}