// -*- mode: c++; indent-tabs-mode: nil; -*- // // Copyright 2009 Illumina, Inc. // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). // // /// \file /// /// \author Chris Saunders /// #include "blt_common/blt_arg_validate.hh" #include "blt_util/log.hh" #include #include #include const double MAX_MONOPLOID_THETA(1.); const double MAX_DIPLOID_THETA(0.38068); // solution of: 0 = 1/3*(theta**2) + (5/2)*theta - 1 void validate_blt_opt(const prog_info& pinfo, const blt_options& client_opt, const bool is_bacon_call_thresh, const bool is_bacon_second_call_thresh, const bool is_bacon_het_snp_ratio_thresh){ const bool is_bacon_set(is_bacon_call_thresh or is_bacon_second_call_thresh or is_bacon_het_snp_ratio_thresh); const bool is_bacon_used(client_opt.is_bacon_snp or client_opt.is_bacon_allele); if(is_bacon_set and not is_bacon_used){ pinfo.usage("BaCON parameters set without specifying either -bacon-snp or -bacon-allele"); } if(client_opt.is_bacon_allele_print_empty and not client_opt.is_bacon_allele) { pinfo.usage("-bacon-allele-print-empty specified without providing a -bacon-allele file"); } if(client_opt.is_min_win_qscore and client_opt.min_win_qscore_flank_size > MAX_FLANK_SIZE){ std::ostringstream oss; oss << "min-window-qscore flank size exceeds max value of: " << MAX_FLANK_SIZE; pinfo.usage(oss.str().c_str()); } if(client_opt.is_max_win_mismatch and client_opt.max_win_mismatch_flank_size > MAX_FLANK_SIZE){ std::ostringstream oss; oss << "max-window-mismatch flank size exceeds max value of: " << MAX_FLANK_SIZE; pinfo.usage(oss.str().c_str()); } if(client_opt.is_adis_win_lrt and client_opt.adis_win_lrt_flank_size > MAX_FLANK_SIZE){ std::ostringstream oss; oss << "anom-distro-window-lrt flank size exceeds max value of: " << MAX_FLANK_SIZE; pinfo.usage(oss.str().c_str()); } if(client_opt.bsnp_monoploid_theta>MAX_MONOPLOID_THETA){ std::ostringstream oss; oss << "monoploid heterozygosity exceeds maximum value of: " << MAX_MONOPLOID_THETA; pinfo.usage(oss.str().c_str()); } if(client_opt.bsnp_diploid_theta>MAX_DIPLOID_THETA){ std::ostringstream oss; oss << "diploid heterozygosity exceeds maximum value of: " << MAX_DIPLOID_THETA; pinfo.usage(oss.str().c_str()); } if(client_opt.is_bsnp_nploid and client_opt.bsnp_nploid_ploidy <= 0){ pinfo.usage("ERROR:: ploidy argument to -bsnp-nploid must be greater than 0\n"); } if(client_opt.is_bsnp_diploid_file and (not client_opt.is_bsnp_diploid)){ pinfo.usage("-bsnp-diploid-file specified without providing -bsnp-diploid parameter\n"); } if(client_opt.is_bsnp_diploid_allele_file and (not client_opt.is_bsnp_diploid)){ pinfo.usage("-bsnp-diploid-file specified without providing -bsnp-diploid parameter\n"); } const pos_range& rr(client_opt.report_range); if(client_opt.is_report_range_ref){ if (not client_opt.is_ref_set){ pinfo.usage("-reference must be specified when using -report-range-reference flag"); } else if(rr.is_begin_pos){ pinfo.usage("-report-range-begin cannot be combined with -report-range-reference flag"); } else if(rr.is_end_pos){ pinfo.usage("-report-range-end cannot be combined with -report-range-reference flag"); } } if(rr.is_begin_pos){ if(rr.begin_pos<=0) pinfo.usage("-report-range-begin argument must be > 0"); } if(rr.is_end_pos){ if(rr.end_pos<=0) pinfo.usage("-report-range-end argument must be > 0"); if(rr.is_begin_pos and rr.end_pos= to -report-range-begin argument"); } } } void make_ref_seq_option_adjustments(blt_options& client_opt, const pos_t ref_size){ if(not client_opt.is_ref_set) return; pos_range& rr(client_opt.report_range); if(client_opt.is_report_range_ref){ rr.set_begin_pos(0); rr.set_end_pos(ref_size); } if(rr.is_begin_pos){ if(rr.begin_pos>=ref_size) { log_os << "ERROR::-report-range-begin argument must be <= reference sequence size\n"; exit(EXIT_FAILURE); } rr.begin_pos=std::max(rr.begin_pos,static_cast(0)); } if(rr.is_end_pos){ rr.end_pos=std::min(rr.end_pos,ref_size); } }