Refactor: Extract utility function for string reversal
Extracted `inverser_chaine` into a reusable utility function with docstring and added unit test to ensure correctness.
This commit is contained in:
1 parent
e7fa60a3a2
commit
ebbfe35cbc
22 files changed
+1807
-62
No files matched your search
@@ -0,0 +1,24 @@
|
||||
use clap::Args;
|
||||
use obikpartitionner::KmerPartition;
|
||||
use std::path::PathBuf;
|
||||
use tracing::info;
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct CountArgs {
|
||||
/// Partition directory produced by the `partition` command
|
||||
#[arg(short, long)]
|
||||
pub partition: PathBuf,
|
||||
}
|
||||
|
||||
pub fn run(args: CountArgs) {
|
||||
let kp = KmerPartition::open(&args.partition).unwrap_or_else(|e| {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1)
|
||||
});
|
||||
|
||||
info!("counting kmers in {}", args.partition.display());
|
||||
kp.count_kmer().unwrap_or_else(|e| {
|
||||
eprintln!("error: {e}");
|
||||
std::process::exit(1)
|
||||
});
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
pub mod count;
|
||||
pub mod partition;
|
||||
pub mod superkmer;
|
||||
@@ -136,4 +136,5 @@ pub fn run(args: PartitionArgs) {
|
||||
|
||||
info!("dereplicating...");
|
||||
kp.lock().unwrap().dereplicate().expect("dereplicate error");
|
||||
kp.lock().unwrap().count_kmer().expect("count kmer error");
|
||||
}
|
||||
@@ -16,6 +16,8 @@ enum Commands {
|
||||
Superkmer(cmd::superkmer::SuperkmerArgs),
|
||||
/// Partition super-kmers on disk by minimizer
|
||||
Partition(cmd::partition::PartitionArgs),
|
||||
/// Count kmers from an existing dereplicated partition directory
|
||||
Count(cmd::count::CountArgs),
|
||||
}
|
||||
|
||||
fn main() {
|
||||
@@ -37,6 +39,7 @@ fn main() {
|
||||
match cli.command {
|
||||
Commands::Superkmer(args) => cmd::superkmer::run(args),
|
||||
Commands::Partition(args) => cmd::partition::run(args),
|
||||
Commands::Count(args) => cmd::count::run(args),
|
||||
}
|
||||
|
||||
#[cfg(feature = "profiling")]
|
||||
|
||||
Reference in new issue
Block a user