cyto_cli/map/
generic.rs

1use std::path::PathBuf;
2
3use anyhow::Result;
4use clap::Parser;
5use cyto_core::mappers::MapperOffset;
6
7use super::{Geometry, MapOptions, PairedInput, RuntimeOptions};
8use crate::ArgsOutput;
9
10use super::BinseqInput;
11
12#[derive(Parser, Debug)]
13pub struct ArgsGeneric {
14    #[clap(flatten)]
15    pub input: PairedInput,
16
17    #[clap(flatten)]
18    pub binseq: BinseqInput,
19
20    #[clap(flatten)]
21    pub geometry: Geometry,
22
23    #[clap(flatten)]
24    pub generic: GenericOptions,
25
26    #[clap(flatten)]
27    pub map: MapOptions,
28
29    #[clap(flatten)]
30    pub runtime: RuntimeOptions,
31
32    #[clap(flatten)]
33    pub output: ArgsOutput,
34}
35impl ArgsGeneric {
36    pub fn validate_outdir(&self) -> Result<()> {
37        self.output.validate_outdir()
38    }
39    pub fn log_path(&self) -> PathBuf {
40        self.output.log_path()
41    }
42}
43
44#[derive(Parser, Debug)]
45#[clap(next_help_heading = "Generic Options")]
46pub struct GenericOptions {
47    //// Path to library file
48    #[clap(short = 'c', long = "generic")]
49    pub generic_filepath: String,
50
51    /// Index to extract sequence (right of this point)
52    #[clap(short = 's', long, conflicts_with = "left_of")]
53    pub right_of: Option<usize>,
54
55    /// Index to extract sequence (left of this point)
56    #[clap(short = 'S', long, conflicts_with = "right_of")]
57    pub left_of: Option<usize>,
58}
59
60impl GenericOptions {
61    pub fn offset(&self) -> Option<MapperOffset> {
62        if let Some(right_of) = self.right_of {
63            Some(MapperOffset::RightOf(right_of))
64        } else {
65            self.left_of.map(MapperOffset::LeftOf)
66        }
67    }
68}