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
|
/* The MIT License
Copyright (c) 2013 Adrian Tan <atks@umich.edu>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef PROGRAM_H
#define PROGRAM_H
#include <fstream>
#include <iostream>
#include <typeinfo>
#include "tclap/CmdLine.h"
#include "tclap/Arg.h"
#include "bcf_ordered_reader.h"
#include "bcf_ordered_writer.h"
#include "bcf_synced_reader.h"
#include "ordered_bcf_overlap_matcher.h"
#include "ordered_region_overlap_matcher.h"
#include "hts_utils.h"
#include "utils.h"
#include "variant_manip.h"
#include "filter.h"
#include "genome_interval.h"
#include "reference_sequence.h"
class VTOutput : public TCLAP::StdOutput
{
public:
void failure(TCLAP::CmdLineInterface& c, TCLAP::ArgException& e);
void usage(TCLAP::CmdLineInterface& c);
};
/**
* Provides an interface for programs in vt.
*
*
*/
class Program
{
public:
std::string version;
std::ofstream out;
/**
* Process arguments.
*/
Program(){};
/**
* Parse multiple files from command line unlabeled arguments or -L denoted file list. If both are defined, the files are merged.
*
* @files - file names are stored in this vector
* @argument_files - vector of input files
* @file_list - file names stored in a file
*
*/
void parse_files(std::vector<std::string>& files, const std::vector<std::string>& arg_files, std::string file_list);
/**
* Parse intervals. Processes the interval list first followed by the interval string. Duplicates are dropped.
*
* @intervals - intervals stored in this vector
* @interval_list - file containing intervals
* @interval_string - comma delimited intervals in a string
*/
void parse_intervals(std::vector<GenomeInterval>& intervals, std::string interval_list, std::string interval_string);
/**
* Parse filters. Processes the filter list.
*
* @filters - filters stored in this vector
* @filter_string - comma delimited filters in a string
* @n - ensure that filters vector had n filters.
* if there are less, just pad with empty strings
* if there are more, thrown an error.
* if n is 0, ignore the previous contraints.
* @pad - if there are less than expected variant expressions
* when true, the remaining filter expressions are padded with the empty string.
* when false and only one expression is observed, the remaining filter expressions
* duplicated with that filter expression.
*/
void parse_filters(std::vector<std::string>& filters, std::string filter_string, int32_t n=0, bool pad=false);
/**
* Parse a list of strings delimited by commas.
*
* @strings - list of strings
* @string_list - comma delimited strings
*/
void parse_string_list(std::vector<std::string>& strings, std::string string_list);
/**
* Parse samples. Processes the sample list. Duplicates are dropped.
*
* @nsamples - number of unique samples found in list
* @sample_list - file containing sample names
*/
char** read_sample_list(int32_t& nsamples, std::string sample_list);
/**
* Initialize I/O and shared objects.
*/
void initialize(){};
/**
* Print options.
*/
void print_options(){};
/**
* Print run stats.
*/
void print_stats(){};
/**
* Print reference FASTA file option.
*/
void print_ref_op(const char* option_line, std::string ref_fasta_file);
/**
* Print string option, hide if not present.
*/
void print_str_op(const char* option_line, std::string str_value);
/**
* Print number option, hide if 0.
*/
void print_num_op(const char* option_line, uint32_t num_value);
/**
* Print switch option, hide if not switched on.
*/
void print_boo_op(const char* option_line, bool value);
/**
* Print intervals option.
*/
void print_int_op(const char* option_line, std::vector<GenomeInterval>& intervals);
/**
* Print string vector.
*/
void print_strvec(const char* option_line, std::vector<std::string>& vec);
/**
* Print input files.
*/
void print_ifiles(const char* option_line, std::vector<std::string>& files);
private:
};
#endif
|