Adds the `pack` subcommand to `obikmer2` for persisting presence and count matrices in sparse or dense formats. Introduces the `compact_layer` module in `obikrebuild` to merge multiple partition layers into a single layer in-place via atomic operations. Updates dependencies across `obikdump`, `obikmer2`, and `obikrebuild` to resolve new local crate references. Shifts the architecture from multi-layer accumulation to in-place compaction, removing legacy rebuild modules.
60 lines
2.2 KiB
Rust
60 lines
2.2 KiB
Rust
mod cli;
|
|
mod cmd;
|
|
|
|
use clap::{Parser, Subcommand};
|
|
use tracing_subscriber::{EnvFilter, fmt};
|
|
|
|
#[derive(Parser)]
|
|
#[command(name = "obikmer2", about = "DNA k-mer tools", version)]
|
|
struct Cli {
|
|
#[command(subcommand)]
|
|
command: Commands,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
enum Commands {
|
|
/// Build the complete genome index (scatter → dereplicate → count → layered MPHF)
|
|
Index(cmd::index::IndexArgs),
|
|
/// Extract super-k-mers from input sequences and scatter them by partition
|
|
Superkmer(cmd::superkmer::SuperkmerArgs),
|
|
/// Merge multiple genome indexes into one
|
|
Merge(cmd::merge::MergeArgs),
|
|
/// Filter kmers out of an index by genome metadata / abundance / complexity
|
|
Filter(cmd::filter::FilterArgs),
|
|
/// Project/aggregate genome columns into a new index
|
|
Select(cmd::select::SelectArgs),
|
|
/// Dump an index's kmers as a CSV table
|
|
Dump(cmd::dump::DumpArgs),
|
|
/// Assemble an index's kmers into unitigs and write them as FASTA
|
|
Unitig(cmd::unitig::UnitigArgs),
|
|
/// Pack an index's matrices into single-file, sparse format by default (--dense to opt out), in place
|
|
Pack(cmd::pack::PackArgs),
|
|
/// Estimate approximate-evidence false-positive rates for given parameters
|
|
Estimate(cmd::estimate::EstimateArgs),
|
|
/// Read/write genome metadata (CSV) on an already-built index
|
|
Annotate(cmd::annotate::AnnotateArgs),
|
|
}
|
|
|
|
fn main() {
|
|
fmt()
|
|
.with_env_filter(
|
|
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
|
|
)
|
|
.with_writer(std::io::stderr)
|
|
.init();
|
|
|
|
let cli = Cli::parse();
|
|
match cli.command {
|
|
Commands::Index(args) => cmd::index::run(args),
|
|
Commands::Superkmer(args) => cmd::superkmer::run(args),
|
|
Commands::Merge(args) => cmd::merge::run(args),
|
|
Commands::Filter(args) => cmd::filter::run(args),
|
|
Commands::Select(args) => cmd::select::run(args),
|
|
Commands::Dump(args) => cmd::dump::run(args),
|
|
Commands::Unitig(args) => cmd::unitig::run(args),
|
|
Commands::Pack(args) => cmd::pack::run(args),
|
|
Commands::Estimate(args) => cmd::estimate::run(args),
|
|
Commands::Annotate(args) => cmd::annotate::run(args),
|
|
}
|
|
}
|