// Calculate the expected ratio of reads observed to support each // allele. Note that for sites and single breakpoints this is expected // to match the sample allele ratio, however for indels this can // change as a funciton of indel and read length. // // Note this routine does not accoung for overlapping indels // static void get_het_observed_allele_ratio(const unsigned read_length, const unsigned min_overlap, const indel_key& ik, const double het_allele_ratio, double& log_ref_prob, double& log_indel_prob) { assert((ik.type==INDEL::INSERT) || (ik.type==INDEL::DELETE) || (ik.type == INDEL::SWAP)); // the expected relative read depth for two breakpoints separated by a distance of 0: const unsigned base_expect( (read_length+1)<(2*min_overlap) ? 0 : (read_length+1)-(2*min_overlap) ); // Get expected relative read depth for the shorter and longer // paths of a general sequence replacement. Note this includes // basic insertions and deletions, in these cases // spath_break_distance is 0 and spath_expect equals base_expect: // const double ref_path_expect(base_expect+std::min(ik.delete_length(),base_expect)); const double indel_path_expect(base_expect+std::min(ik.insert_length(),base_expect)); const double ref_path_term((1-het_allele_ratio)*ref_path_expect); const double indel_path_term(het_allele_ratio*indel_path_expect); const double total_path_term(ref_path_term+indel_path_term); if (total_path_term>0) { const double indel_prob(indel_path_term/total_path_term); log_ref_prob=std::log(1.-indel_prob); log_indel_prob=std::log(indel_prob); } }