Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bam IO to take account of BAM_FPAIRED when checking BAM_FREAD1/2 #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bwaseqio.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ static bwa_seq_t *bwa_read_bam(bwa_seqio_t *bs, int n_needed, int *n, int is_com
while ((res = bam_read1(bs->fp, b)) >= 0) {
uint8_t *s, *q;
int go = 0;
if ((bs->which & 1) && (b->core.flag & BAM_FREAD1)) go = 1;
if ((bs->which & 2) && (b->core.flag & BAM_FREAD2)) go = 1;
if ((bs->which & 4) && !(b->core.flag& BAM_FREAD1) && !(b->core.flag& BAM_FREAD2))go = 1;
if ((bs->which & 1) && ((b->core.flag&(BAM_FPAIRED|BAM_FREAD1)) == (BAM_FPAIRED|BAM_FREAD1))) go = 1;
if ((bs->which & 2) && ((b->core.flag&(BAM_FPAIRED|BAM_FREAD2)) == (BAM_FPAIRED|BAM_FREAD2))) go = 1;
if ((bs->which & 4) && ((b->core.flag&(BAM_FPAIRED|BAM_FREAD1)) != (BAM_FPAIRED|BAM_FREAD1)) && ((b->core.flag&(BAM_FPAIRED|BAM_FREAD2)) != (BAM_FPAIRED|BAM_FREAD2)))go = 1;
if (go == 0) continue;
l = b->core.l_qseq;
p = &seqs[n_seqs++];
Expand Down