Skip to main content

fibertools_rs/cli/
pileup_opts.rs

1use crate::utils::input_bam::InputBam;
2use clap::Args;
3use std::fmt::Debug;
4
5#[derive(Args, Debug)]
6pub struct PileupOptions {
7    #[clap(flatten)]
8    pub input: InputBam,
9    /// Region string(s) to make a pileup of. e.g. chr1:1-1000 or chr1:1-1,000
10    /// Can be specified multiple times for multiple regions.
11    /// If not provided will make a pileup of the whole genome
12    #[clap(short, long)]
13    pub rgn: Vec<String>,
14    /// BED file with regions to query. If the BED file has a name column (4th column),
15    /// the name will be added to each output line for that region.
16    #[clap(short, long, conflicts_with = "rgn")]
17    pub bed: Option<String>,
18    /// Output file
19    #[clap(short, long, default_value = "-")]
20    pub out: String,
21    /// include m6A calls
22    #[clap(short, long)]
23    pub m6a: bool,
24    /// include 5mC calls
25    #[clap(short, long)]
26    pub cpg: bool,
27    /// For each column add two new columns with the hap1 and hap2 specific data.
28    #[clap(long)]
29    pub haps: bool,
30    /// Keep zero coverage regions
31    #[clap(short, long)]
32    pub keep_zeros: bool,
33    /// Write output one base at a time even if the values do not change
34    #[clap(short, long)]
35    pub per_base: bool,
36    /// Calculate coverage starting from the first MSP/NUC to the last MSP/NUC
37    /// position instead of the complete span of the read alignment.
38    #[clap(long)]
39    pub fiber_coverage: bool,
40    /// Shuffle the fiber-seq data according to a bed file of
41    /// the shuffled positions of the fiber-seq data
42    ///
43    /// The bed file should have the following format:
44    /// #chrom shuffled_start shuffled_end read_name original_start
45    #[clap(long)]
46    pub shuffle: Option<String>,
47    /// Output a rolling max of the score column over X bases
48    #[clap(long)]
49    pub rolling_max: Option<usize>,
50    /// No MSP columns
51    #[clap(long)]
52    pub no_msp: bool,
53    /// No NUC columns
54    #[clap(long)]
55    pub no_nuc: bool,
56}
57
58impl PileupOptions {
59    /// `--fire-filter` bundles `--fiber-coverage` in addition to the three
60    /// filters. Callers should use this in place of reading `fiber_coverage`
61    /// directly so the bundle stays coherent.
62    pub fn effective_fiber_coverage(&self) -> bool {
63        self.fiber_coverage || self.input.filters.fire_filter
64    }
65}