Add faidx_seq_len64(), fai_adjust_region() interfaces and faidx tests #1519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add
faidx_seq_len64()
as a replacement forfaidx_seq_len()
that can return the correct length of sequences longer thanINT_MAX
.Make
faidx_seq_len()
clamp its output atINT_MAX
, which is probably slightly less bad than overflowing.Adds a
fai_adjust_region()
function that can be used to ensure that a given range does not go beyond the end of the requested sequence. The interface is designed so that the output offai_parse_region()
can be passed to it. This essentially exposes the internalfaidx_adjust_position()
function which is currently used to enforce the same limits in thefaidx_fetch_seq64()
andfaidx_fetch_qual64()
interfaces. The new function allows callers to get a better idea of what will be retrieved by applying the limits in advance.While writing this, I discovered that faidx didn't really have any tests of its own, although some were run as side-effects of other tests. The second (rather bigger) commit adds some dedicated faidx tests.