Stores and manages program arguments for Minimac4.
More...
#include <prog_args.hpp>
Stores and manages program arguments for Minimac4.
This class wraps parsed command-line options and provides typed accessors for downstream modules.
◆ prog_args()
Construct program arguments parser for minimac4.
This constructor initializes the getopt-based argument parser with usage instructions and all supported command-line options for minimac4.
Usage:
minimac4 [opts ...] <reference.msav> <target.{sav,bcf,vcf.gz}>
minimac4 [opts ...] --update-m3vcf <reference.m3vcf.gz>
minimac4 [opts ...] --compress-reference <reference.{sav,bcf,vcf.gz}>
Supported options include:
- General:
--help, -h
: Print usage.
--version, -v
: Print version.
- Input/Output:
--output, -o <path>
: Output path (default: /dev/stdout).
--output-format, -O <fmt>
: Output format (bcf, sav, vcf.gz, …; default: sav).
--sites, -s <path>
: Output path for sites-only file.
--empirical-output, -e <path>
: Path for empirical dosages.
- Reference/Target control:
--all-typed-sites, -a
: Include sites that exist only in target VCF.
--map, -m <file>
: Genetic map file.
--region, -r <region>
: Genomic region to impute.
--sample-ids <list>
/ --sample-ids-file <file>
: Subset samples from reference panel.
- Performance:
--threads, -t <int>
: Number of threads (default: 1).
--temp-buffer, -b <int>
: Number of samples to buffer before writing (default: 200).
--chunk, -c <bp>
: Maximum chunk length in base pairs (default: 20,000,000).
--overlap, -w <bp>
: Size of flanking overlap (default: 3,000,000).
- HMM/Imputation parameters:
--match-error <float>
: Match error probability (default: 0.01).
--min-r2 <float>
: Minimum estimated r² for output variants.
--min-ratio <float>
: Minimum target/reference site ratio (default: 1e-4).
--min-ratio-behavior <skip|fail>
: Behavior if ratio not met (default: fail).
--min-recom <float>
: Minimum recombination probability (default: 1e-5).
--prob-threshold <float>
: Probability threshold for template selection.
--prob-threshold-s1 <float>
: Probability threshold in original state space.
--diff-threshold <float>
: Probability diff threshold for template selection.
--decay <float>
: Dosage decay in flanking regions (default: 0, disabled).
- Reference compression / conversion:
--update-m3vcf
: Convert M3VCF to MVCF.
--compress-reference
: Compress VCF/BCF/SAV into MVCF.
--min-block-size <int>
: Minimum haplotype block size (default: 10).
--max-block-size <int>
: Maximum haplotype block size (default: 65535).
--slope-unit <int>
: Slope parameter for compression heuristic (default: 10).
- Note
- Some options are deprecated but retained for backward compatibility (e.g.,
--allTypedSites
, --rsid
, --meta
, --refHaps
, …).
- See also
- getopt_wrapper
◆ all_typed_sites()
bool prog_args::all_typed_sites |
( |
| ) |
const |
|
inline |
- Returns
- true if all typed sites should be processed.
◆ chunk_size()
std::int64_t prog_args::chunk_size |
( |
| ) |
const |
|
inline |
- Returns
- Chunk size in base pairs.
◆ compress_reference()
bool prog_args::compress_reference |
( |
| ) |
const |
|
inline |
- Returns
- true if reference panel should be compressed.
◆ decay()
float prog_args::decay |
( |
| ) |
const |
|
inline |
- Returns
- HMM decay parameter.
◆ diff_threshold()
float prog_args::diff_threshold |
( |
| ) |
const |
|
inline |
- Returns
- Likelihood difference threshold.
◆ emp_out_path()
const std::string & prog_args::emp_out_path |
( |
| ) |
const |
|
inline |
- Returns
- Empirical R2 output path.
◆ error_param()
float prog_args::error_param |
( |
| ) |
const |
|
inline |
- Returns
- Genotyping error parameter.
◆ fail_min_ratio()
bool prog_args::fail_min_ratio |
( |
| ) |
const |
|
inline |
- Returns
- true if failing on min ratio violation is enabled.
◆ fmt_fields()
const std::vector< std::string > & prog_args::fmt_fields |
( |
| ) |
const |
|
inline |
- Returns
- FORMAT fields to output.
◆ help_is_set()
bool prog_args::help_is_set |
( |
| ) |
const |
|
inline |
- Returns
- true if
--help
flag is set.
◆ map_path()
const std::string & prog_args::map_path |
( |
| ) |
const |
|
inline |
◆ max_block_size()
std::size_t prog_args::max_block_size |
( |
| ) |
const |
|
inline |
- Returns
- Maximum block size.
◆ min_block_size()
std::size_t prog_args::min_block_size |
( |
| ) |
const |
|
inline |
- Returns
- Minimum block size.
◆ min_r2()
float prog_args::min_r2 |
( |
| ) |
const |
|
inline |
- Returns
- Minimum imputation R2 threshold.
◆ min_ratio()
float prog_args::min_ratio |
( |
| ) |
const |
|
inline |
- Returns
- Minimum haplotype pruning ratio.
◆ min_recom()
float prog_args::min_recom |
( |
| ) |
const |
|
inline |
- Returns
- Minimum recombination rate.
◆ out_compression()
std::uint8_t prog_args::out_compression |
( |
| ) |
const |
|
inline |
- Returns
- Compression level for output.
◆ out_format()
savvy::file::format prog_args::out_format |
( |
| ) |
const |
|
inline |
- Returns
- Output file format.
◆ out_path()
const std::string & prog_args::out_path |
( |
| ) |
const |
|
inline |
◆ overlap()
std::int64_t prog_args::overlap |
( |
| ) |
const |
|
inline |
- Returns
- Overlap size in base pairs.
◆ parse()
bool prog_args::parse |
( |
int | argc, |
|
|
char ** | argv ) |
|
inline |
Parse command-line arguments for minimac4.
This function processes both short and long options (via getopt_long) and positional arguments to configure program execution. It updates internal state variables based on recognized options and validates argument counts.
Behavior:
- Parses
argc
and argv
using getopt_long()
.
- Recognizes both short (-o) and long (–output) forms.
- Updates internal members (e.g., file paths, numeric thresholds, flags).
- Handles deprecated options with warnings and backward-compatible behavior.
- Validates required positional arguments (reference and target files).
- Automatically assigns temporary prefixes and output paths if not provided.
Command-line structure:
minimac4 [options] <reference.msav> <target.{sav,bcf,vcf.gz}>
minimac4 [options] --update-m3vcf <reference.m3vcf.gz>
minimac4 [options] --compress-reference <reference.{sav,bcf,vcf.gz}>
Return conditions:
- Returns
true
if parsing succeeds (including early exits for –help or –version).
- Returns
false
if:
- An invalid option value is provided,
- An unknown option is encountered,
- The number of positional arguments is invalid.
Side effects:
- Writes warnings to
std::cerr
for deprecated options.
- Writes error messages to
std::cerr
on invalid usage.
- Sets defaults for temporary prefix (
TMPDIR
or /tmp) and output suffixes.
- Ensures "HDS" is included in format fields if
--empirical-output
is requested.
- Parameters
-
argc | Number of command-line arguments. |
argv | Array of argument strings. |
- Returns
true
if parsing and validation succeed, false
otherwise.
- Note
- Recognized options include general flags (help, version), I/O control, imputation parameters, and reference compression options.
- Deprecated options are retained for backward compatibility, but emit warnings.
- See also
- getopt_long, prog_args
◆ pass_only()
bool prog_args::pass_only |
( |
| ) |
const |
|
inline |
- Returns
- true if only PASS variants are kept.
◆ prob_threshold()
float prog_args::prob_threshold |
( |
| ) |
const |
|
inline |
- Returns
- Probability threshold for genotype calls.
◆ prob_threshold_s1()
float prog_args::prob_threshold_s1 |
( |
| ) |
const |
|
inline |
- Returns
- Probability threshold for S1 records.
◆ ref_path()
const std::string & prog_args::ref_path |
( |
| ) |
const |
|
inline |
- Returns
- Reference panel path.
◆ region()
const savvy::genomic_region & prog_args::region |
( |
| ) |
const |
|
inline |
- Returns
- Genomic region to restrict analysis.
◆ sample_ids()
const std::unordered_set< std::string > & prog_args::sample_ids |
( |
| ) |
const |
|
inline |
- Returns
- Subset of sample IDs.
◆ sites_out_path()
const std::string & prog_args::sites_out_path |
( |
| ) |
const |
|
inline |
- Returns
- Sites-only output path.
◆ slope_unit()
std::size_t prog_args::slope_unit |
( |
| ) |
const |
|
inline |
◆ tar_path()
const std::string & prog_args::tar_path |
( |
| ) |
const |
|
inline |
- Returns
- Target panel path.
◆ temp_buffer()
std::size_t prog_args::temp_buffer |
( |
| ) |
const |
|
inline |
- Returns
- Temporary buffer size.
◆ temp_prefix()
const std::string & prog_args::temp_prefix |
( |
| ) |
const |
|
inline |
- Returns
- Prefix for temporary files.
◆ threads()
std::int16_t prog_args::threads |
( |
| ) |
const |
|
inline |
- Returns
- Number of threads to use.
◆ update_m3vcf()
bool prog_args::update_m3vcf |
( |
| ) |
const |
|
inline |
- Returns
- true if updating M3VCF reference is enabled.
◆ version_is_set()
bool prog_args::version_is_set |
( |
| ) |
const |
|
inline |
- Returns
- true if
--version
flag is set.
The documentation for this class was generated from the following file: