Opened 10 years ago

Closed 10 years ago

#764 closed request (fixed)

BamReadIterator with invalid region

Reported by: Peter Owned by: Peter
Priority: major Milestone: yat 0.11
Component: omic Version: 0.10.2
Keywords: Cc:

Description

Currently, BamReadIterator::IndexActor constructor contains

bam_iter_t it = bam_iter_query(bf.index(), tid, begin, end);
assert(it);

I learnt that bam_iter_query may very well return NULL; typically if tid is out-of-range, end<0, or end<begin. The current behaviour is that results in an assertion or if assertions are turned off, it seems like the code will go on a behave as BamReadIterator with region defined, i.e., increment will read next BamRead from BamFile. The latter is even stranger than a crash IMO. I think we should change this to either 1) throw an exception with as much information (region filename etc) as possible or 2) invalid region will work as end-of-range iterator, i.e., as one constructed with BamReadIterator(void).

Change History (1)

comment:1 Changed 10 years ago by Peter

Resolution: fixed
Status: newclosed

(In [3056]) fixes #764: throw if region in BamReadIterator? is invalid

Note: See TracTickets for help on using tickets.