diff --git a/Cargo.toml b/Cargo.toml index 0c84d8b..106cbc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,5 @@ edition = "2021" clap = { version = "4.5.4", features = ["derive"] } md5 = { version = "0.7.0" } reqwest = { version = "0.12.9", features = ["blocking"] } -num_cpus = "1.16.0" \ No newline at end of file +num_cpus = "1.16.0" +color-print = "0.3.7" \ No newline at end of file diff --git a/src/util/arg_parser.rs b/src/util/arg_parser.rs index 2a434b3..1ea97a9 100644 --- a/src/util/arg_parser.rs +++ b/src/util/arg_parser.rs @@ -1,6 +1,8 @@ use std::path::PathBuf; use clap::{Parser, Subcommand}; +use color_print::cstr; use crate::util::arg_parser::Commands::*; + #[derive(Parser)] #[clap(disable_version_flag = true, arg_required_else_help = true)] pub struct ClapArgs { @@ -29,18 +31,21 @@ fn _threshold_in_range_f64(s: &str) -> Result { } } +// Extra help messages +const PROFILE_HELP: &str = cstr!(r#"Example: + # Define core genes above 85% coverage threshold + unicore profile -t 85 example/db/proteome_db example/out/clu.tsv result +"#); +const GENETREE_HELP: &str = cstr!(r#"Example: + # Create a list of hashed gene names + awk -F'\t' 'NR==FNR {a[$1];next} ($3 in a) {print $1}' /path/to/original/gene/names db/proteome_db.map > /path/to/hashed/gene/names + # Run gene-tree with the list of hashed gene names; use --realign option to recompute the alignment with custom --threshold option for MSA gap threshold + unicore gene-tree --realign --threshold 30 --name /path/to/hashed/gene/names example/tree +"#); #[derive(Subcommand)] pub enum Commands { /// Create Foldseek database from amino acid sequences #[clap(arg_required_else_help = true, allow_hyphen_values = true, verbatim_doc_comment)] - #[command( - after_help= - " - Example: - // Download ProstT5 weights as below if you haven't already - // foldseek databases ProstT5 /path/to/prostt5/weights tmp - unicore createdb example/data example/db/proteome_db example/model - ")] Createdb { /// Input directory with fasta files or a single fasta file input: PathBuf, @@ -89,12 +94,6 @@ pub enum Commands { }, /// Cluster Foldseek database #[clap(arg_required_else_help = true, allow_hyphen_values = true)] - #[command( - after_help= - " - Example: - unicore cluster example/db/proteome_db example/out/clu tmp - ")] Cluster { /// Input database (createdb output) input: PathBuf, @@ -141,13 +140,7 @@ pub enum Commands { }, /// Create core structures from Foldseek database #[clap(arg_required_else_help = true)] - #[command( - after_help= - " - Example: - // 85% coverage - unicore profile -t 85 example/db/proteome_db example/out/clu.tsv result - ")] + #[command(after_help=PROFILE_HELP)] Profile { /// Input database (createdb output) input_db: PathBuf, @@ -170,12 +163,6 @@ pub enum Commands { }, /// Infer phylogenetic tree from core structures #[clap(arg_required_else_help = true, allow_hyphen_values = true)] - #[command( - after_help= - " - Example: - unicore tree example/db/proteome_db example/result example/tree - ")] Tree { /// Input database (createdb output) db: PathBuf, @@ -207,18 +194,7 @@ pub enum Commands { }, // Infer phylogenetic tree of each core structures #[clap(arg_required_else_help = true, allow_hyphen_values = true)] - #[command( - after_help= - " - Examples: - unicore gene-tree example/tree - - // Create a list of hashed gene names - awk -F'\t' 'NR==FNR {a[$1];next} ($3 in a) {print $1}' /path/to/original/gene/names db/proteome_db.map > /path/to/hashed/gene/names - // Run gene-tree with the list of hashed gene names - // Also optionally use --realign option to recompute the alignment and --threshold option to filter the MSA - unicore gene-tree --realign --threshold 30 --name /path/to/hashed/gene/names example/tree - ")] + #[command(after_help=GENETREE_HELP)] GeneTree { /// Input directory containing species phylogenetic tree (Output of the Tree module) input: PathBuf, @@ -252,12 +228,6 @@ pub enum Commands { }, /// Easy core gene phylogeny workflow, from fasta files to phylogenetic tree #[clap(arg_required_else_help = true, allow_hyphen_values = true)] - #[command( - after_help= - " - Example: - unicore easy-core --use-foldseek --gpu example/data example/results example/model example/tmp - ")] EasyCore { /// Input directory with fasta files or a single fasta file input: PathBuf,