X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam_maqcns.c;h=95cd2b5f68f748f1412a8dc089784f3069d972c5;hb=4c4b72301b736e08e37b5e0dd1d435477d969898;hp=c6c9af7dee454ed91cd75363470473405d7c97ea;hpb=fa23b4bbb0521525ce6e47fdb35cf5f589e691ad;p=samtools.git diff --git a/bam_maqcns.c b/bam_maqcns.c index c6c9af7..95cd2b5 100644 --- a/bam_maqcns.c +++ b/bam_maqcns.c @@ -108,6 +108,7 @@ bam_maqcns_t *bam_maqcns_init() bm->theta = 0.85; bm->n_hap = 2; bm->eta = 0.03; + bm->cap_mapQ = 60; return bm; } @@ -160,6 +161,7 @@ glf1_t *bam_maqcns_glfgen(int _n, const bam_pileup1_t *pl, uint8_t ref_base, bam rms = 0; for (j = n - 1; j >= 0; --j) { // calculate esum and fsum uint32_t info = bm->aux->info[j]; + int tmp; if (info>>24 < 4 && (info>>8&0x3f) != 0) info = 4<<24 | (info&0xffffff); k = info>>16&7; if (info>>24 > 0) { @@ -168,7 +170,8 @@ glf1_t *bam_maqcns_glfgen(int _n, const bam_pileup1_t *pl, uint8_t ref_base, bam if (w[k] < 0xff) ++w[k]; ++b->c[k&3]; } - rms += (int)(info&0x7f) * (info&0x7f); + tmp = (int)(info&0x7f) < bm->cap_mapQ? (int)(info&0x7f) : bm->cap_mapQ; + rms += tmp * tmp; } b->rms_mapQ = (uint8_t)(sqrt((double)rms / n) + .499); // rescale ->c[]