1use anyhow::Result;
4use clap::Parser;
5use rustalign_io::FastaReader;
6
7#[derive(Debug, Parser)]
9pub struct BuildOptions {
10 #[clap(required = true, num_args = 1..)]
12 pub references: Vec<String>,
13
14 #[clap(required = true)]
16 pub index_base: String,
17
18 #[clap(short = 'l', long)]
20 pub large: bool,
21
22 #[clap(short = 'p', long, default_value = "1")]
24 pub threads: usize,
25}
26
27pub fn run_with_options(opts: BuildOptions) -> Result<()> {
29 run_with_opts(opts)
30}
31
32pub fn run() -> Result<()> {
34 let opts = BuildOptions::parse();
35 run_with_options(opts)
36}
37
38#[allow(dead_code)]
39fn main() -> Result<()> {
40 run()
41}
42
43fn run_with_opts(opts: BuildOptions) -> Result<()> {
44 eprintln!("Building index from {:?}", opts.references);
45 eprintln!("Output: {}", opts.index_base);
46
47 let mut total_length = 0u64;
49 for ref_file in &opts.references {
50 let reader = FastaReader::from_path(ref_file)?;
51 for record in reader {
52 let record = record?;
53 total_length += record.len() as u64;
54 eprintln!(" Loaded: {} ({} bp)", record.id, record.len());
55 }
56 }
57
58 eprintln!("Total reference length: {} bp", total_length);
59 eprintln!("Building FM-index...");
60
61 eprintln!("Index building not yet implemented");
63
64 Ok(())
65}