Skip to main content

fibertools_rs/cli/
nucleosome_opts.rs

1use crate::utils::input_bam::InputBam;
2use clap::Args;
3use std::fmt::Debug;
4
5pub static NUC_LEN: &str = "75";
6pub static COMBO_NUC_LEN: &str = "100";
7pub static MIN_DIST_ADDED: &str = "25";
8pub static DIST_FROM_END: &str = "45";
9pub static ALLOWED_SKIPS: &str = "-1";
10
11#[derive(Args, Debug, Clone)]
12pub struct NucleosomeParameters {
13    /// Minium nucleosome length
14    #[clap(short, long, default_value = NUC_LEN)]
15    pub nucleosome_length: i64,
16    /// Minium nucleosome length when combining over a single m6A
17    #[clap(short, long, default_value = COMBO_NUC_LEN)]
18    pub combined_nucleosome_length: i64,
19    /// Minium distance needed to add to an already existing nuc by crossing an m6a
20    #[clap(long, default_value = MIN_DIST_ADDED)]
21    pub min_distance_added: i64,
22    /// Minimum distance from the end of a fiber to call a nucleosome or MSP
23    #[clap(short, long, default_value = DIST_FROM_END)]
24    pub distance_from_end: i64,
25    /// Most m6A events we can skip over to get to the nucleosome length when using D-segment algorithm. 2 is often a good value, negative values disable D-segment for the simple caller.
26    #[clap(short, long, default_value = ALLOWED_SKIPS, hide = true)]
27    pub allowed_m6a_skips: i64,
28}
29
30impl std::default::Default for NucleosomeParameters {
31    fn default() -> Self {
32        Self {
33            nucleosome_length: NUC_LEN.parse().unwrap(),
34            combined_nucleosome_length: COMBO_NUC_LEN.parse().unwrap(),
35            min_distance_added: MIN_DIST_ADDED.parse().unwrap(),
36            distance_from_end: DIST_FROM_END.parse().unwrap(),
37            allowed_m6a_skips: ALLOWED_SKIPS.parse().unwrap(),
38        }
39    }
40}
41
42#[derive(Args, Debug)]
43pub struct AddNucleosomeOptions {
44    #[clap(flatten)]
45    pub input: InputBam,
46    /// Output bam file with nucleosome calls
47    #[clap(default_value = "-")]
48    pub out: String,
49    #[clap(flatten)]
50    pub nuc: NucleosomeParameters,
51}