Skip to content

Commit f568ff5

Browse files
committed
Remove the mpileup BAM_CREF_SKIP filter.
Mpileup removes alignments using the cigar ref skip operator ("N"). This was originally added in 2011 in samtools/samtools#d1643d6 with the commit message of "fixed a bug in indel calling related to unmapped and refskip reads". Unfortunately I don't know what that bug was, but removing the code shows it still works (at least for some data!). We need better understanding of what's going on and why it was added, so perhaps we should add a command line option to control this instead? Fixes samtools#2277
1 parent 9d31418 commit f568ff5

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

Diff for: bam2bcf_edlib.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -1559,19 +1559,10 @@ int bcf_edlib_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos,
15591559
}
15601560
}
15611561

1562-
int qbeg, qpos, qend, tbeg, tend, kk;
1562+
int qbeg, qpos, qend, tbeg, tend;
15631563
uint8_t *seq = bam_get_seq(p->b);
1564-
uint32_t *cigar = bam_get_cigar(p->b);
15651564
if (p->b->core.flag & BAM_FUNMAP) continue;
15661565

1567-
// FIXME: the following loop should be better moved outside;
1568-
// nonetheless, realignment should be much slower anyway.
1569-
for (kk = 0; kk < p->b->core.n_cigar; ++kk)
1570-
if ((cigar[kk]&BAM_CIGAR_MASK) == BAM_CREF_SKIP)
1571-
break;
1572-
if (kk < p->b->core.n_cigar)
1573-
continue;
1574-
15751566
// determine the start and end of sequences for alignment
15761567
int left2 = left, right2 = right;
15771568
int min_win_size = MAX(-biggest_del, biggest_ins);

Diff for: bam2bcf_indel.c

+1-10
Original file line numberDiff line numberDiff line change
@@ -845,19 +845,10 @@ int bcf_call_gap_prep(int n, int *n_plp, bam_pileup1_t **plp, int pos,
845845
}
846846
}
847847

848-
int qbeg, qpos, qend, tbeg, tend, kk;
848+
int qbeg, qpos, qend, tbeg, tend;
849849
uint8_t *seq = bam_get_seq(p->b);
850-
uint32_t *cigar = bam_get_cigar(p->b);
851850
if (p->b->core.flag & BAM_FUNMAP) continue;
852851

853-
// FIXME: the following loop should be better moved outside;
854-
// nonetheless, realignment should be much slower anyway.
855-
for (kk = 0; kk < p->b->core.n_cigar; ++kk)
856-
if ((cigar[kk]&BAM_CIGAR_MASK) == BAM_CREF_SKIP)
857-
break;
858-
if (kk < p->b->core.n_cigar)
859-
continue;
860-
861852
// determine the start and end of sequences for alignment
862853
// FIXME: loops over CIGAR multiple times
863854
int left2 = left, right2 = right;

0 commit comments

Comments
 (0)