+ } else if (d->format & BAM_PLF_ALLBASE) { // collapse all bases
+ uint64_t rmsQ = 0;
+ uint32_t b = 0;
+ for (i = 0; i < n; ++i) {
+ const bam_pileup1_t *p = pu + i;
+ int q = p->b->core.qual < d->c->cap_mapQ? p->b->core.qual : d->c->cap_mapQ;
+ b |= bam1_seqi(bam1_seq(p->b), p->qpos);
+ rmsQ += q * q;
+ }
+ rmsQ = (uint64_t)(sqrt((double)rmsQ / n) + .499);
+ cns = b<<28 | 0xf<<24 | rmsQ<<16 | 60<<8;