X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bam2wig.cpp;fp=bam2wig.cpp;h=e46fa67bc3812c8ca6978aeb8c6764680c3549b9;hb=1c7a81621434a852a7f7e11d61621e50ba1b7f2a;hp=fcb86b3c562373a0a0492a4de875e6565c551b94;hpb=86e650e9577999a7ba00ab454d1f6bf674b0ea70;p=rsem.git diff --git a/bam2wig.cpp b/bam2wig.cpp index fcb86b3..e46fa67 100644 --- a/bam2wig.cpp +++ b/bam2wig.cpp @@ -4,6 +4,8 @@ #include #include +#include + #include "sam/bam.h" #include "sam/sam.h" @@ -61,6 +63,8 @@ int main(int argc, char* argv[]) { cur_tid = -1; wig_arr = NULL; while (samread(bam_in, b) >= 0) { + if (b->core.flag & 0x0004) continue; + if (b->core.tid != cur_tid) { if (cur_tid >= 0) generateWiggle(cur_tid); cur_tid = b->core.tid; @@ -69,7 +73,8 @@ int main(int argc, char* argv[]) { memset(wig_arr, 0, len); } - float w = bam_aux2f(bam_aux_get(b, "ZW")); + uint8_t *p_tag = bam_aux_get(b, "ZW"); + float w = (p_tag != NULL ? bam_aux2f(p_tag) : 1.0); int pos = b->core.pos; uint32_t *p = bam1_cigar(b);