1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! chromsize
//! Alejandro Gonzales-Irribarren, 2024
//!
//! `chromsize` is a utility designed to extract chromosome names
//! and their corresponding lengths from input files. It supports
//! both plain and gzipped input formats and offers an option to
//! include only the accession ID from the input headers.
//!
//! ## Usage
//!
//! To use `chromsize`, you typically provide the input input file
//! and specify the desired output file.
//!
//! ```bash
//! chromsize [OPTIONS] --input <input> --output <OUTPUT>
//! ```
//!
//! ## Options
//!
//! Here's a breakdown of the available command-line options:
//!
//! * **`-i`, `--input <input>`**
//! * **Purpose**: Specifies the path to the input input file. This is a **required** option.
//! * **Example**: `--input genome.input` or `--input sequences.input.gz`
//!
//! * **`-o`, `--output <OUTPUT>`**
//! * **Purpose**: Specifies the path where the output chromosome sizes will be written.
//! This is a **required** option. The output will typically be a tab-separated
//! file with chromosome names and their lengths.
//! * **Example**: `--output chrom_lengths.txt`
//!
//! * **`-t`, `--threads <THREADS>`**
//! * **Purpose**: Sets the number of threads to use for processing. This can speed up processing
//! for large input files.
//! * **Default**: `8`
//! * **Example**: `--threads 4` (to use 4 threads)
//!
//! * **`-a`, `--accession-only`**
//! * **Purpose**: A flag that, when present, instructs `chromsize` to only keep the accession ID
//! part of the input header. This means it will stop reading the header at the first
//! blank space. If omitted, the entire header line up to the first newline character
//! will be used as the chromosome name.
//! * **Example**: `--accession-only`
//!
//! * **`-h`, `--help`**
//! * **Purpose**: Displays a help message with usage information and available options.
//! * **Example**: `chromsize --help`
//!
//! * **`-V`, `--version`**
//! * **Purpose**: Prints the version information of the `chromsize` tool.
//! * **Example**: `chromsize --version`
//!
//! ## Example Usage Scenarios
//!
//! 1. **Get chromosome sizes from a plain input file, using full headers, with default threads:**
//!
//! ```bash
//! chromsize --input input.fa --output chrom_sizes.txt
//! ```
//!
//! 2. **Get chromosome sizes from a gzipped input file, extracting only accession IDs, using 4 threads:**
//!
//! ```bash
//! chromsize --input input.input.gz --output accession_sizes.txt --accession-only --threads 4
//! ```
//!
use ;
use Args;
use *;
use process;
/// Main entry point for the chromsize application.
///
/// This function parses command line arguments, initializes the thread pool,
/// processes the sequence file to get chromosome sizes, and writes the results.
///
/// # Examples
///
/// ```ignore
/// // Run with custom threads and input/output files
/// ./chromsize -s input.fa -o chrom.sizes -t 8
/// ```