// -*- 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 /// #ifndef __POSITION_LOGHOOD_MINFUNC_HH #define __POSITION_LOGHOOD_MINFUNC_HH #include "blt_common/snp_pos_info.hh" #include "blt_util/seq_util.hh" #include /// assumes pi has already had bad cases filtered out: double calc_pos_nonref_freq_loghood(const snp_pos_info& pi, const double nonref_freq); struct position_nonref_freq_loghood_minfunc : public codemin::minfunc_1d_interface { /// assumes pi has already had bad cases filtered out: explicit position_nonref_freq_loghood_minfunc(const snp_pos_info& pi) : _pi(pi) {} virtual double val(const double nonref_freq) const; // a sawtooth function to keep the argument in range, yet continous: static double arg_to_prob(const double arg); private: const snp_pos_info& _pi; }; struct position_allele_distro_loghood_minfunc : public codemin::minfunc_interface { // assumes pi has had bad cases filtered out already: // is_allele_used is true for each base submitted to val in the // frequency array, all other frequencies are locked at zero explicit position_allele_distro_loghood_minfunc(const snp_pos_info& pi, const bool* is_allele_used = 0) : _pi(pi), _n_allele(0) { for(unsigned i(0);i