Minimac4
Loading...
Searching...
No Matches
prog_args Class Reference

Stores and manages program arguments for Minimac4. More...

#include <prog_args.hpp>

Inheritance diagram for prog_args:
[legend]
Collaboration diagram for prog_args:
[legend]

Public Member Functions

bool help_is_set () const
 
bool version_is_set () const
 
const std::string & ref_path () const
 
const std::string & tar_path () const
 
const std::string & map_path () const
 
const std::string & out_path () const
 
const std::string & emp_out_path () const
 
const std::string & sites_out_path () const
 
const std::string & temp_prefix () const
 
savvy::file::format out_format () const
 
std::uint8_t out_compression () const
 
const std::vector< std::string > & fmt_fields () const
 
const std::unordered_set< std::string > & sample_ids () const
 
const savvy::genomic_region & region () const
 
std::int64_t chunk_size () const
 
std::int64_t overlap () const
 
std::int16_t threads () const
 
std::size_t temp_buffer () const
 
std::size_t min_block_size () const
 
std::size_t max_block_size () const
 
std::size_t slope_unit () const
 
float decay () const
 
float min_r2 () const
 
float min_ratio () const
 
float prob_threshold () const
 
float prob_threshold_s1 () const
 
float diff_threshold () const
 
float min_recom () const
 
float error_param () const
 
bool all_typed_sites () const
 
bool update_m3vcf () const
 
bool compress_reference () const
 
bool pass_only () const
 
bool fail_min_ratio () const
 
 prog_args ()
 Construct program arguments parser for minimac4.
 
bool parse (int argc, char **argv)
 Parse command-line arguments for minimac4.
 
- Public Member Functions inherited from getopt_wrapper
 getopt_wrapper (std::string usage_str, std::vector< option_with_desc > long_opts)
 Constructs a getopt_wrapper object for parsing command-line options.
 
void print_usage (std::ostream &os)
 Prints the program usage and all available options to a stream.
 

Additional Inherited Members

- Protected Attributes inherited from getopt_wrapper
std::vector< option > long_options_
 Storage of long options for getopt parsing.
 
std::vector< option_with_descopts_
 Original option definitions with descriptions.
 
std::string usage_str_
 Program usage/help string.
 
std::string short_opt_string_
 Concatenated short option string.
 
std::size_t max_long_opt_length_ = 0
 Maximum long option length.
 

Detailed Description

Stores and manages program arguments for Minimac4.

This class wraps parsed command-line options and provides typed accessors for downstream modules.

Constructor & Destructor Documentation

◆ prog_args()

prog_args::prog_args ( )
inline

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
Here is the call graph for this function:

Member Function Documentation

◆ all_typed_sites()

bool prog_args::all_typed_sites ( ) const
inline
Returns
true if all typed sites should be processed.
Here is the caller graph for this function:

◆ chunk_size()

std::int64_t prog_args::chunk_size ( ) const
inline
Returns
Chunk size in base pairs.
Here is the caller graph for this function:

◆ compress_reference()

bool prog_args::compress_reference ( ) const
inline
Returns
true if reference panel should be compressed.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ error_param()

float prog_args::error_param ( ) const
inline
Returns
Genotyping error parameter.
Here is the caller graph for this function:

◆ fail_min_ratio()

bool prog_args::fail_min_ratio ( ) const
inline
Returns
true if failing on min ratio violation is enabled.
Here is the caller graph for this function:

◆ fmt_fields()

const std::vector< std::string > & prog_args::fmt_fields ( ) const
inline
Returns
FORMAT fields to output.
Here is the caller graph for this function:

◆ help_is_set()

bool prog_args::help_is_set ( ) const
inline
Returns
true if --help flag is set.
Here is the caller graph for this function:

◆ map_path()

const std::string & prog_args::map_path ( ) const
inline
Returns
Genetic map path.
Here is the caller graph for this function:

◆ max_block_size()

std::size_t prog_args::max_block_size ( ) const
inline
Returns
Maximum block size.
Here is the caller graph for this function:

◆ min_block_size()

std::size_t prog_args::min_block_size ( ) const
inline
Returns
Minimum block size.
Here is the caller graph for this function:

◆ min_r2()

float prog_args::min_r2 ( ) const
inline
Returns
Minimum imputation R2 threshold.
Here is the caller graph for this function:

◆ min_ratio()

float prog_args::min_ratio ( ) const
inline
Returns
Minimum haplotype pruning ratio.
Here is the caller graph for this function:

◆ min_recom()

float prog_args::min_recom ( ) const
inline
Returns
Minimum recombination rate.
Here is the caller graph for this function:

◆ out_compression()

std::uint8_t prog_args::out_compression ( ) const
inline
Returns
Compression level for output.
Here is the caller graph for this function:

◆ out_format()

savvy::file::format prog_args::out_format ( ) const
inline
Returns
Output file format.
Here is the caller graph for this function:

◆ out_path()

const std::string & prog_args::out_path ( ) const
inline
Returns
Output file path.
Here is the caller graph for this function:

◆ overlap()

std::int64_t prog_args::overlap ( ) const
inline
Returns
Overlap size in base pairs.
Here is the caller graph for this function:

◆ 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
argcNumber of command-line arguments.
argvArray 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
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ region()

const savvy::genomic_region & prog_args::region ( ) const
inline
Returns
Genomic region to restrict analysis.
Here is the caller graph for this function:

◆ sample_ids()

const std::unordered_set< std::string > & prog_args::sample_ids ( ) const
inline
Returns
Subset of sample IDs.
Here is the caller graph for this function:

◆ sites_out_path()

const std::string & prog_args::sites_out_path ( ) const
inline
Returns
Sites-only output path.
Here is the caller graph for this function:

◆ slope_unit()

std::size_t prog_args::slope_unit ( ) const
inline
Returns
Slope unit size.
Here is the caller graph for this function:

◆ tar_path()

const std::string & prog_args::tar_path ( ) const
inline
Returns
Target panel path.
Here is the caller graph for this function:

◆ temp_buffer()

std::size_t prog_args::temp_buffer ( ) const
inline
Returns
Temporary buffer size.
Here is the caller graph for this function:

◆ temp_prefix()

const std::string & prog_args::temp_prefix ( ) const
inline
Returns
Prefix for temporary files.
Here is the caller graph for this function:

◆ threads()

std::int16_t prog_args::threads ( ) const
inline
Returns
Number of threads to use.
Here is the caller graph for this function:

◆ update_m3vcf()

bool prog_args::update_m3vcf ( ) const
inline
Returns
true if updating M3VCF reference is enabled.
Here is the caller graph for this function:

◆ version_is_set()

bool prog_args::version_is_set ( ) const
inline
Returns
true if --version flag is set.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: