chromsize 0.0.34

just get your chrom sizes
Documentation
//! chromsize
//! Alejandro Gonzales-Irribarren, 2024
//!
//! `chromsize` is a utility designed to extract chromosome names
//! and their corresponding lengths from FASTA files. It supports
//! both plain and gzipped FASTA formats [and .2bit] and offers an option to
//! include only the accession ID from the FASTA or 2bit headers.

use clap::{self, Parser};
use num_cpus;
use std::path::PathBuf;

/// Command line arguments for the chromsize application.
///
/// This struct defines the configuration options that can be passed
/// to the chromsize program, including input file, output file, and
/// threading options.
#[derive(Parser, Debug)]
#[clap(
    name = "chromsize",
    version = env!("CARGO_PKG_VERSION"),
    author = "Alejandro Gonzales-Irribarren <alejandrxgzi@gmail.com>",
    about = "just get your chrom sizes"
)]
pub struct Args {
    /// Path to sequence file (use '-' or omit to read stdin)
    #[clap(
        short = 's',
        long = "sequence",
        help = "Path to sequence file (FASTA/2bit, use '-' or omit to read stdin)",
        value_name = "SEQUENCE",
        default_value = "-"
    )]
    pub sequence: PathBuf,

    /// Path to output chrom sizes directory
    #[clap(
        short = 'o',
        long = "outdir",
        help = "Path to output chrom sizes directory",
        value_name = "OUTPUT",
        default_value = "."
    )]
    pub outdir: PathBuf,

    /// Path to output chrom sizes
    #[clap(
        short = 'p',
        long = "prefix",
        help = "File prefix for output chrom sizes",
        value_name = "PREFIX",
        default_value = "chrom.sizes"
    )]
    pub prefix: String,

    /// Number of threads
    #[clap(
        short = 't',
        long,
        help = "Number of threads",
        value_name = "THREADS",
        default_value_t = num_cpus::get()
    )]
    pub threads: usize,

    #[clap(
        short = 'a',
        long = "accession-only",
        help = "only keep the accession id part of the header (stop after blank)",
        default_value_t = false
    )]
    pub accession_only: bool,
}