Skip to content

Commit

Permalink
优化代码结构
Browse files Browse the repository at this point in the history
  • Loading branch information
eric committed Apr 24, 2024
1 parent a1a8146 commit 771b480
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 18 deletions.
14 changes: 7 additions & 7 deletions kr2r/src/bin/build_k2_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ use std::time::Instant;
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about="build database", long_about = None)]
pub struct Args {
/// 包含原始配置
#[clap(flatten)]
pub build: Build,

/// database hash chunk directory and other files
#[clap(long)]
pub k2d_dir: Option<PathBuf>,

#[clap(flatten)]
pub taxo: Taxo,

#[clap(long, value_parser = parse_size, default_value = "1G", help = "Specifies the hash file capacity.\nAcceptable formats include numeric values followed by 'K', 'M', or 'G' (e.g., '1.5G', '250M', '1024K').\nNote: The specified capacity affects the index size, with a factor of 4 applied.\nFor example, specifying '1G' results in an index size of '4G'.\nDefault: 1G (capacity 1G = file size 4G)")]
pub hash_capacity: usize,

/// chunk temp directory
#[clap(long)]
pub chunk_dir: PathBuf,

/// 包含原始配置
#[clap(flatten)]
pub build: Build,

#[clap(flatten)]
pub taxo: Taxo,
}

pub fn run(args: Args, required_capacity: usize) -> Result<(), Box<dyn std::error::Error>> {
Expand Down
15 changes: 6 additions & 9 deletions kr2r/src/bin/squid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,23 @@ use std::time::Instant;
#[derive(Parser, Debug, Clone)]
#[clap(author, version, about="build database", long_about = None)]
struct BuildArgs {
#[clap(flatten)]
pub build: Build,

/// database hash chunk directory and other files
#[clap(long)]
pub k2d_dir: Option<PathBuf>,

#[clap(flatten)]
taxo: Taxo,

// /// Name of Kraken 2 database
// #[arg(short, long = "db")]
// database: PathBuf,
/// chunk directory
#[clap(long)]
chunk_dir: PathBuf,

#[clap(long, value_parser = parse_size, default_value = "1G", help = "Specifies the hash file capacity.\nAcceptable formats include numeric values followed by 'K', 'M', or 'G' (e.g., '1.5G', '250M', '1024K').\nNote: The specified capacity affects the index size, with a factor of 4 applied.\nFor example, specifying '1G' results in an index size of '4G'.\nDefault: 1G (capacity 1G = file size 4G)")]
pub hash_capacity: usize,

#[clap(flatten)]
pub build: Build,

#[clap(flatten)]
taxo: Taxo,

/// estimate capacity from cache if exists
#[arg(long, default_value_t = true)]
cache: bool,
Expand Down
2 changes: 0 additions & 2 deletions kr2r/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// pub mod iclassify;
pub mod kr2r_data;
mod kv_store;
pub mod mmscanner;
Expand All @@ -16,7 +15,6 @@ pub use feat::*;
pub mod db;
pub use kr2r_data::*;
pub use kv_store::*;
// pub use mmscanner::{Meros, CURRENT_REVCOM_VERSION, DEFAULT_TOGGLE_MASK};
pub use readcounts::TaxonCounts;

pub mod args;
Expand Down

0 comments on commit 771b480

Please sign in to comment.