1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
use super::{ModArchS4, ModChembl, ModEnrichr, ModEnsembl, ModNcbi, ModPdb, ModUcsc, ModUniprot};
use clap::{
Parser, Subcommand,
builder::{
Styles,
styling::{AnsiColor, Effects},
},
};
use clap_complete::Shell;
use ggetrs_blast::types::{BlastDatabase, BlastProgram};
use ggetrs_ensembl::ENSEMBL_RELEASE_STR;
use ggetrs_string::ModString;
// Configures Clap v3-style help menu colors
const STYLES: Styles = Styles::styled()
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
.usage(AnsiColor::Green.on_default().effects(Effects::BOLD))
.literal(AnsiColor::Cyan.on_default().effects(Effects::BOLD))
.placeholder(AnsiColor::Cyan.on_default());
#[derive(Parser)]
#[command(styles = STYLES)]
#[clap(author, version, about)]
#[clap(propagate_version = true)]
pub struct Cli {
#[clap(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Perform an enrichment analysis on a list of genes using Enrichr.
#[clap(subcommand)]
Enrichr(ModEnrichr),
/// Queries gene-specific information using ARCHS4
#[clap(subcommand)]
ARCHS4(ModArchS4),
/// Performs a BLAST query for a given sequence
Blast {
/// query sequence to BLAST
#[clap(value_parser, required = true)]
query: String,
/// blast program to use
#[clap(short, long)]
program: Option<BlastProgram>,
/// blast database to use
#[clap(short, long)]
database: Option<BlastDatabase>,
/// Number of hits to return
#[clap(short, long, default_value = "50")]
limit: usize,
/// Minimum expected value to consider
#[clap(short, long, default_value = "10.0")]
expect: f64,
/// Whether to use a complexity filter (default = false)
#[clap(short = 'f', long)]
low_comp_filter: bool,
/// Whether to use MEGABLAST (default = true)
#[clap(short, long)]
megablast: bool,
/// optional filepath to write output to [default=stdout]
#[clap(short, long)]
output: Option<String>,
},
/// Queries information from Chembl Chemical Database
#[clap(subcommand)]
Chembl(ModChembl),
/// Searches through descriptions on ENSEMBL
Search {
/// Search terms to query
#[clap(value_parser, required = true)]
search_terms: Vec<String>,
/// Ensembl database to perform search in
#[clap(short, long)]
database: Option<String>,
/// species used in database
#[clap(short, long, default_value = "homo_sapiens")]
species: String,
/// database type specied by Ensembl
#[clap(short = 't', long, default_value = "core")]
db_type: String,
/// release number to use for database
#[clap(short, long, default_value=ENSEMBL_RELEASE_STR)]
release: usize,
/// assembly to use for species
#[clap(short, long, default_value = "38")]
assembly: String,
/// optional filepath to write output to [default=stdout]
#[clap(short, long)]
output: Option<String>,
},
/// Queries symbols or Ensembl IDs across multiple databases and aggregates results
Info {
/// Search terms to query (Gene symbols of Ensembl IDs)
#[clap(required = true)]
search_terms: Vec<String>,
/// Species name to use: currently this MUST match the `taxon_id`
#[clap(short, long, default_value = "homo_sapiens")]
species: String,
/// Taxon ID to use: currently this MUST match the species
#[clap(short, long, default_value = "9606")]
taxon_id: usize,
/// optional filepath to write output to [default=stdout]
#[clap(short, long)]
output: Option<String>,
},
/// Queries sequences from ensembl and `UniProt`
Seq {
/// Search terms to query (can be Ensembl IDs or Gene Symbols)
#[clap(value_parser, required = true)]
search_terms: Vec<String>,
/// Return the amino acid sequence instead of nucleotide sequence.
#[clap(short, long, action)]
translate: bool,
/// Species/alias to specify
#[clap(short, long, default_value = "homo_sapiens")]
species: Option<String>,
/// optional filepath to write output to [default=stdout]
#[clap(short, long)]
output: Option<String>,
},
/// Queries information from Ensembl
#[clap(subcommand)]
Ensembl(ModEnsembl),
/// Queries information from Uniprot
#[clap(subcommand)]
Uniprot(ModUniprot),
/// Queries information from NCBI
#[clap(subcommand)]
Ncbi(ModNcbi),
/// Retrieves structures and information from RCSB PDB
#[clap(subcommand)]
Pdb(ModPdb),
/// Retrieve network information from STRING
#[clap(subcommand)]
String(ModString),
/// Retrieves information from UCSC Genome Browser
#[clap(subcommand)]
Ucsc(ModUcsc),
/// Set up autocomplete for various shells
Autocomplete {
/// Shell to generate autocompletions for
#[clap(short, long)]
shell: Shell,
},
}