// -*- 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/position_snp_call_pprob_digt.hh" #include "blt_util/log.hh" #include "blt_util/seq_util.hh" #include #include #include #include #include /// find more accurate complement of posterior_probability: static double prob_comp(const double* const digt_prob, const unsigned cgt){ double val(0.); for(unsigned gt(0);gt& dependent_eprob, diploid_genotype& dgt, const bool is_always_test){ if(pi.ref_base=='N') return; const unsigned n_calls(pi.calls.size()); dgt.ref_gt=base_to_id(pi.ref_base); // check that a non-reference call meeting quality criteria even exists: if(not is_always_test) { bool is_test(false); for(unsigned i(0);i max){ max2 = max; max = dgt.pprob[gt]; dgt.max2_gt = dgt.max_gt; dgt.max_gt = gt; } else if(dgt.pprob[gt] > max2) { max2 = dgt.pprob[gt]; dgt.max2_gt = gt; } } // note we could op at higher precision by keeping the // normalization in log space after sum is found, also, scaling // could (possibly?) be improved with the factor (the +1 on SIZE // is a safety fudge-factor for uniform distributions): // // static const double lnmax(std::log(std::numeric_limits::max())-static_cast(DIGT::SIZE+1)); double sum(0.); for(unsigned gt(0);gt max){ max = dgt.pprob_poly[gt]; dgt.max_gt_poly = gt; } } sum=0.; for(unsigned gt(0);gt