1use clap::Parser;
2
3use crate::map::{GEOMETRY_CRISPR_FLEX_V2, GEOMETRY_GEX_FLEX_V2};
4
5use super::{GEOMETRY_CRISPR_FLEX_V1, GEOMETRY_CRISPR_PROPERSEQ, GEOMETRY_GEX_FLEX_V1};
6
7#[derive(Parser, Debug)]
8#[clap(next_help_heading = "Mapping Options")]
9pub struct MapOptions {
10 #[clap(short = 'g', long)]
14 pub geometry: Option<String>,
15
16 #[clap(long)]
20 pub preset: Option<GeometryPreset>,
21
22 #[clap(long, default_value = "1", conflicts_with = "preset")]
28 remap_window: usize,
29
30 #[clap(short = 'x', long)]
32 pub exact: bool,
33
34 #[clap(long)]
36 pub no_umi_qual_check: bool,
37
38 #[clap(flatten)]
39 whitelist: WhitelistOptions,
40
41 #[clap(flatten)]
42 probe: ProbeOptions,
43}
44impl MapOptions {
45 pub fn remap_window(&self) -> usize {
46 match self.preset {
47 Some(GeometryPreset::GexV2 | GeometryPreset::CrisprV2) => 5,
48 _ => self.remap_window,
49 }
50 }
51
52 pub fn probe_regex(&self) -> Option<&str> {
53 self.probe.probe_regex.as_deref()
54 }
55
56 pub fn probe_path(&self) -> Option<&str> {
57 self.probe.probes.as_deref()
58 }
59
60 pub fn whitelist_path(&self) -> &str {
61 &self.whitelist.whitelist
62 }
63}
64
65#[derive(Parser, Debug)]
66#[clap(next_help_heading = "Probe Options")]
67pub struct ProbeOptions {
68 #[clap(short = 'p', long)]
70 pub probes: Option<String>,
71
72 #[clap(long)]
76 pub probe_regex: Option<String>,
77}
78
79#[derive(Parser, Debug)]
80#[clap(next_help_heading = "Whitelist Options")]
81pub struct WhitelistOptions {
82 #[clap(short = 'w', long)]
84 pub whitelist: String,
85}
86
87#[derive(clap::ValueEnum, Clone, Copy, Debug)]
88pub enum GeometryPreset {
89 GexV1,
91 GexV2,
93 CrisprV1,
95 CrisprV2,
97 CrisprProper,
99}
100impl GeometryPreset {
101 pub fn into_geometry_str(&self) -> &str {
102 match self {
103 Self::GexV1 => GEOMETRY_GEX_FLEX_V1,
104 Self::GexV2 => GEOMETRY_GEX_FLEX_V2,
105 Self::CrisprV1 => GEOMETRY_CRISPR_FLEX_V1,
106 Self::CrisprV2 => GEOMETRY_CRISPR_FLEX_V2,
107 Self::CrisprProper => GEOMETRY_CRISPR_PROPERSEQ,
108 }
109 }
110}