fibertools_rs/cli/call_peaks_opts.rs
1use crate::utils::input_bam::InputBam;
2use clap::Args;
3use std::fmt::Debug;
4
5#[derive(Args, Debug)]
6pub struct CallPeaksOptions {
7 #[clap(flatten)]
8 pub input: InputBam,
9
10 /// BED file with shuffled fiber positions (from bedtools shuffle)
11 /// If not provided, will use all positions as real data (no FDR calculation)
12 #[clap(short, long)]
13 pub shuffled: Option<String>,
14
15 /// Output BED file with called peaks
16 #[clap(short, long, default_value = "-")]
17 pub out: String,
18
19 /// Maximum coverage threshold for filtering (optional)
20 #[clap(long)]
21 pub max_cov: Option<i32>,
22
23 /// Minimum coverage threshold for filtering (optional)
24 #[clap(long)]
25 pub min_cov: Option<i32>,
26
27 /// Number of standard deviations from median coverage to use for filtering (default: 5)
28 /// If set, will calculate median +/- (sd_cov * std_dev) and use those as min/max coverage
29 /// This overrides --max-cov and --min-cov if those are not explicitly set
30 #[clap(long, default_value = "5.0")]
31 pub sd_cov: f64,
32
33 /// Maximum FDR threshold for peak calling (ignored if --min-fire-frac is set)
34 #[clap(long, default_value = "0.05")]
35 pub max_fdr: f64,
36
37 /// Minimum fraction of fibers with FIREs required to call a peak
38 /// If set, skips FDR calculation and uses this threshold instead
39 /// For example, 0.5 means at least 50% of fibers must have a FIRE at the peak position
40 #[clap(long)]
41 pub min_fire_frac: Option<f64>,
42
43 /// Minimum fraction of fibers with FIREs required as an additional filter (applied WITH FDR)
44 /// Unlike --min-fire-frac, this is applied in addition to FDR filtering, not instead of it
45 /// For example, 0.3 means at least 30% of fibers must have a FIRE AND FDR must be <= max_fdr
46 #[clap(long, default_value = "0.1")]
47 pub min_fire_frac_filter: f64,
48
49 /// Minimum fraction of accessible bases in peak
50 #[clap(long, default_value = "0.0", hide = true)]
51 pub min_frac_accessible: f64,
52
53 /// Rolling window size for finding local maxima (in base pairs)
54 #[clap(long, default_value = "200")]
55 pub window_size: usize,
56
57 /// Minimum fraction of overlapping FIRE elements for merging peaks (Phase 2)
58 #[clap(long, default_value = "0.5")]
59 pub min_frac_overlap: f64,
60
61 /// Minimum reciprocal overlap for merging peaks (Phase 3)
62 #[clap(long, default_value = "0.75")]
63 pub min_reciprocal_overlap: f64,
64
65 /// High reciprocal overlap threshold for initial merging (Phase 1)
66 #[clap(long, default_value = "0.90")]
67 pub high_reciprocal_overlap: f64,
68
69 /// Maximum number of grouping iterations for merging
70 #[clap(long, default_value = "10")]
71 pub max_grouping_iterations: usize,
72
73 /// Skip the FDR table generation and use existing table
74 #[clap(long)]
75 pub fdr_table: Option<String>,
76
77 /// Output the FDR table to this file
78 #[clap(long)]
79 pub fdr_table_out: Option<String>,
80
81 /// Include nucleosome and MSP coverage in pileup (default: only FIRE coverage)
82 #[clap(long)]
83 pub include_nuc_msp: bool,
84
85 /// Include haplotype-specific calls
86 #[clap(long)]
87 pub haps: bool,
88
89 /// Minimum FIRE coverage required to calculate a score (default: 4)
90 #[clap(long, default_value = "4", hide = true)]
91 pub min_fire_coverage: i32,
92}