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    /// Use a ONT heuristic adjustment for 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    #[clap(long, env)]
15    pub ont: bool,
16    /// Use a human model for FIRE calling
17    #[clap(hide = true, long, env)]
18    pub human: bool,
19    /// Use a yeast model for FIRE calling
20    #[clap(hide = true, long, env)]
21    pub yeast: bool,
22    /// Output just FIRE elements in bed9 format
23    #[clap(short, long)]
24    pub extract: bool,
25    /// When extracting bed9 format include all MSPs and nucleosomes
26    #[clap(long)]
27    pub all: bool,
28    /// Output FIREs features for training in a table format
29    #[clap(short, long)]
30    pub feats_to_text: bool,
31    /// Don't write reads with no m6A calls to the output bam
32    #[clap(short, long)]
33    pub skip_no_m6a: bool,
34    /// Skip reads without at least `N` MSP calls
35    #[clap(long, default_value = "0", env = "MIN_MSP")]
36    pub min_msp: usize,
37    /// Skip reads without an average MSP size greater than `N`
38    #[clap(long, default_value = "0", env)]
39    pub min_ave_msp_size: i64,
40    /// Width of bin for feature collection
41    #[clap(short, long, default_value = "40", env, 
42        default_value_ifs([
43            ("human", "true", "40"),
44            ("yeast", "true", "100")
45        ])
46    )]
47    pub width_bin: i64,
48    /// Number of bins to collect
49    #[clap(short, long, default_value = "9", env)]
50    pub bin_num: i64,
51    /// Calculate stats for the highest X bp window within each MSP
52    /// Should be a fair amount higher than the expected linker length.
53    #[clap(long, default_value = "100", env)]
54    pub best_window_size: i64,
55    /// Use 5mC data in FIREs
56    #[clap(short, long, hide = true)]
57    pub use_5mc: bool,
58    /// Minium length of msp to call a FIRE
59    #[clap(long, default_value = "85", env)]
60    pub min_msp_length_for_positive_fire_call: i64,
61    /// Optional path to a model json file.
62    /// If not provided ft will use the default model (recommended).
63    #[clap(long, env = "FIRE_MODEL")]
64    pub model: Option<String>,
65    /// Optional path to a FDR table
66    #[clap(long, env)]
67    pub fdr_table: Option<String>,
68}
69
70impl Default for FireOptions {
71    fn default() -> Self {
72        Self {
73            input: Default::default(),
74            out: "-".to_string(),
75            ont: false,
76            human: false,
77            yeast: false,
78            extract: false,
79            all: false,
80            feats_to_text: false,
81            skip_no_m6a: false,
82            min_msp: 0,
83            min_ave_msp_size: 0,
84            width_bin: 40,
85            bin_num: 9,
86            best_window_size: 100,
87            use_5mc: false,
88            min_msp_length_for_positive_fire_call: 85,
89            model: None,
90            fdr_table: None,
91        }
92    }
93}