Esempio n. 1
0
std::ostream&
operator<<(std::ostream& os, const hinfo& hi) {

    os << "hinfo:\n";
    os << "total_qual: " << hi.total_qual << "\n";
    os << "read: ";
    for (unsigned i(0); i<hap_cand::HAP_SIZE; ++i) { os << id_to_base(hi.hseq[i]); }
    os << "\n";
    return os;
}
Esempio n. 2
0
std::ostream&
operator<<(std::ostream& os, const hap_cand& hc) {

    os << "hap_cand:\n";
    os << "total_qual: " << hc.total_qual() << "\n";
    os << "read: ";
    for (unsigned i(0); i<hap_cand::HAP_SIZE; ++i) { os << id_to_base(hc.base_id(i)); }
    os << "\n";
    os << "qual: ";
    for (unsigned i(0); i<hap_cand::HAP_SIZE; ++i) { os << static_cast<char>(33+hc.qual(i)); }
    os << "\n";
    return os;
}
void
write_alt_alleles(const DDIGT_SGRID::index_t dgt,
                  const unsigned ref_gt,
                  std::ostream& os) {

    unsigned normal_gt;
    unsigned tumor_gt;
    DDIGT_SGRID::get_digt_grid_states(dgt,normal_gt,tumor_gt);

    unsigned normal_digt(DIGT_SGRID::get_digt_state(normal_gt,ref_gt));
    unsigned tumor_digt(DIGT_SGRID::get_digt_state(tumor_gt,ref_gt));

    bool is_print(false);
    for(unsigned b(0); b<N_BASE; ++b) {
        if(b==ref_gt) continue;
        if(DIGT::expect2(b,normal_digt) ||
           DIGT::expect2(b,tumor_digt)) {
            if(is_print) os << ",";
            os << id_to_base(b);
            is_print=true;
        }
    }
    if(! is_print) os << ".";
}
void
write_nonref_2allele_test(const blt_options& opt,
                          const snp_pos_info& pi,
                          const nonref_test_call& nrc,
                          std::ostream& os) {

    os << nrc.snp_qphred
       << '\t' << NR2TEST::label(static_cast<NR2TEST::index_t>(nrc.max_gt)) << "_" << id_to_base(nrc.nonref_id)
       << '\t' << nrc.max_gt_qphred;

    //if(opt.is_print_used_allele_counts) {
    pi.print_known_counts(os,opt.used_allele_count_min_qscore);
    pi.print_known_qscore(os,opt.used_allele_count_min_qscore);
    //}

#if 0
    if (opt.is_print_all_poly_gt) {
        for (unsigned gt(0); gt<DIGT::SIZE; ++gt) {
#if 1
            // print GT as prob:
            os << '\t' << po.pprob[gt];
#else
            // print GT as qval:
            os << '\t' << error_prob_to_qphred(prob_comp(po.pprob,po.pprob+DIGT::SIZE,gt));
#endif
        }
    }
    const result_set& ge(dgt.genome);
    const result_set& po(dgt.poly);
#endif

#if 0
    if (nrc.is_freq) {
        os << std::setprecision(8) << std::fixed;
        for (unsigned i(0); i<N_BASE; ++i) {
            os << '\t' << nrc.allele_freq[i];
        }
        os.unsetf(std::ios::fixed);
    }
#endif
}