X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=BamWriter.h;h=e29e36bef54f6b6e8d40d30746204fb3f78eea8e;hp=b39400f5cb9d21c50d2dcdf8ac0222218c5f2286;hb=1c7a81621434a852a7f7e11d61621e50ba1b7f2a;hpb=86e650e9577999a7ba00ab454d1f6bf674b0ea70 diff --git a/BamWriter.h b/BamWriter.h index b39400f..e29e36b 100644 --- a/BamWriter.h +++ b/BamWriter.h @@ -263,7 +263,7 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) { *p = 'Z'; ++p; *p = 'W'; ++p; *p = 'f'; ++p; float val = (float)hmapIter->second; memcpy(p, &val, 4); - samwrite(out, tmp_b); + if (tmp_b->core.qual > 0) samwrite(out, tmp_b); // output only when MAPQ > 0 bam_destroy1(tmp_b); // now hmapIter->b makes no sense } hmap.clear(); @@ -290,7 +290,7 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) { *p = 'Z'; ++p; *p = 'W'; ++p; *p = 'f'; ++p; float val = (float)hmapIter->second; memcpy(p, &val, 4); - samwrite(out, tmp_b); + if (tmp_b->core.qual > 0) samwrite(out, tmp_b); // If MAPQ is equal to 0, do not output this alignment bam_destroy1(tmp_b); // now hmapIter->b makes no sense } hmap.clear(); @@ -429,9 +429,12 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) float val = (float)hmapIter->second; memcpy(p, &val, 4); memcpy(p2, &val, 4); - - samwrite(out, tmp_b); - samwrite(out, tmp_b2); + + // If MAPQ is equal to 0, do not output this alignment pair + if (tmp_b->core.qual > 0) { + samwrite(out, tmp_b); + samwrite(out, tmp_b2); + } bam_destroy1(tmp_b); bam_destroy1(tmp_b2); @@ -467,8 +470,10 @@ void BamWriter::work(HitWrapper wrapper, Transcripts& transcripts) memcpy(p, &val, 4); memcpy(p2, &val, 4); - samwrite(out, tmp_b); - samwrite(out, tmp_b2); + if (tmp_b->core.qual > 0) { + samwrite(out, tmp_b); + samwrite(out, tmp_b2); + } bam_destroy1(tmp_b); bam_destroy1(tmp_b2);