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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
/*
* parameters.cpp
*
* Created on: Nov 11, 2009
* Author: Adam Auton
* ($Revision: 249 $)
*/
// Class for reading in, checking and storing user parameters
#ifndef PARAMETERS_H_
#define PARAMETERS_H_
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <string>
#include <vector>
#include <set>
#include <stdint.h>
#include <unistd.h>
#include "output_log.h"
extern output_log LOG;
using namespace std;
const string VCFTOOLS_VERSION="v0.1.12";
static const uint8_t bgzf_magic[19] = "\037\213\010\4\0\0\0\0\0\377\6\0\102\103\2\0\0\0"; //just compare the first 16 chars? though
static const uint8_t gzip_magic[2] = {0x1f,0x8b};
class parameters
{
public:
bool stream_in;
bool bcf_format;
bool BED_exclude;
string BED_file;
set<string> chrs_to_exclude;
set<string> chrs_to_keep;
bool derived;
bool diff_discordance_matrix;
string diff_file;
bool diff_file_bcf;
bool diff_file_compressed;
bool diff_indv_discordance;
string diff_indv_map_file;
bool diff_site_discordance;
bool diff_switch_error;
int end_pos;
string exclude_positions_file;
string FORMAT_id_to_extract;
set<string> geno_filter_flags_to_exclude;
string geno_rsq_position_list;
string hap_rsq_position_list;
vector<string> weir_fst_populations;
int fst_window_size;
int fst_window_step;
string indv_exclude_file;
string indv_keep_file;
set<string> indv_to_exclude;
set<string> indv_to_keep;
vector<string> INFO_to_extract;
bool invert_mask;
bool keep_only_indels;
int ld_bp_window_size;
int ld_snp_window_size;
int ld_bp_window_min;
int ld_snp_window_min;
int min_mac;
double min_maf;
string mask_file;
int max_alleles;
int max_genotype_depth;
int max_mac;
double max_maf;
double max_mean_depth;
int max_missing_call_count;
int max_non_ref_ac;
double max_non_ref_af;
int max_N_indv;
int min_alleles;
int min_genotype_depth;
double min_genotype_quality;
double min_HWE_pvalue;
int min_interSNP_distance;
int min_kept_mask_value;
double min_mean_depth;
int min_non_ref_ac;
double min_non_ref_af;
double min_quality;
double min_r2;
double min_site_call_rate;
int num_outputs;
bool output_012_matrix;
bool output_as_IMPUTE;
bool output_as_ldhat_phased;
bool output_as_ldhat_unphased;
bool output_BEAGLE_genotype_likelihoods_GL;
bool output_BEAGLE_genotype_likelihoods_PL;
bool output_counts;
bool output_filter_summary;
bool output_freq;
bool output_geno_depth;
bool output_geno_chisq;
bool output_geno_rsq;
bool output_hap_rsq;
bool output_het;
bool output_HWE;
bool output_indel_hist;
bool output_indv_depth;
bool output_indv_missingness;
bool output_interchromosomal_hap_rsq;
bool output_interchromosomal_geno_rsq;
bool output_kept_sites;
bool output_LROH;
int output_N_PCA_SNP_loadings;
bool output_PCA;
string output_prefix;
bool output_relatedness_Yang;
bool output_relatedness_Manichaikul;
bool output_removed_sites;
bool output_singletons;
bool output_site_depth;
bool output_site_mean_depth;
bool output_site_missingness;
bool output_site_pi;
bool output_site_quality;
int output_SNP_density_bin_size;
int output_Tajima_D_bin_size;
int output_TsTv_bin_size;
bool output_TsTv_by_count;
bool output_TsTv_by_qual;
bool output_TsTv_summary;
bool phased_only;
bool PCA_no_normalisation;
int pi_window_size;
int pi_window_step;
bool plink_output;
bool plink_tped_output;
string positions_file;
bool recode;
bool recode_bcf;
set<string> recode_INFO_to_keep;
bool recode_all_INFO;
bool remove_all_filtered_genotypes;
bool remove_all_filtered_sites;
bool remove_indels;
set<string> site_filter_flags_to_exclude;
set<string> site_filter_flags_to_keep;
set<string> site_INFO_flags_to_keep;
set<string> site_INFO_flags_to_remove;
string snps_to_exclude_file;
string snps_to_keep_file;
set<string> snps_to_keep;
int start_pos;
bool stream_err;
bool stream_out;
bool suppress_allele_output;
string vcf_filename;
bool vcf_format;
bool vcf_compressed;
parameters(int argc, char *argv[]);
~parameters(){};
void read_parameters();
void print_help();
void print_params();
private:
void check_parameters();
static void error(string err_msg, int code);
vector<string> argv;
string get_arg(unsigned int i);
};
#endif /* PARAMETERS_H_ */
|