Skip to content

Commit 0773541

Browse files
committed
Fix a bug in --indels-v2.0
which caused an endless loop when CIGAR operator 'H' or 'P' was encountered. Likely addresses one of the issues raised by #1930
1 parent c1f9f1f commit 0773541

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ Changes affecting specific commands:
6161
- Revamped line matching code to fix problems in gVCF merging where split gVCF blocks
6262
would not update genotypes (#1891, #1164).
6363

64+
* bcftool mpileup
65+
66+
- Fix a bug in --indels-v2.0 which caused an endless loop when CIGAR operator 'H' or 'P'
67+
was encountered
68+
6469
* bcftools norm
6570

6671
- The `-m, --multiallelics +` mode now preserves phasing (#1893)

cigar_state.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ static inline int cstate_seek_fwd(cigar_state_t *cs, hts_pos_t *pos_ptr, int tri
107107
cs->icig++;
108108
continue;
109109
}
110+
if ( op==BAM_CHARD_CLIP || op==BAM_CPAD )
111+
{
112+
cs->icig++;
113+
continue;
114+
}
115+
error("FIXME: not ready for CIGAR operator %d\n",op);
110116
}
111117
// the read starts after pos
112118
if ( trim_left )
@@ -175,6 +181,12 @@ static inline int cstate_seek_op_fwd(cigar_state_t *cs, hts_pos_t pos, int seek_
175181
cs->icig++;
176182
continue;
177183
}
184+
if ( op==BAM_CHARD_CLIP || op==BAM_CPAD )
185+
{
186+
cs->icig++;
187+
continue;
188+
}
189+
error("FIXME: not ready for CIGAR operator %d\n",op);
178190
}
179191
return cs->icig < cs->ncig ? -1 : -2;
180192
}

0 commit comments

Comments
 (0)