FlatGFA: Set up for in-place mutation #155
Merged
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.
There is no actual externally useful change here, but this changes the file format to allow for "gaps," i.e., to have more space for elements in the GFA representation than we have actual values. This way, we can feasibly mutate graphs in place (adding and removing elements), up to the limit of the pre-allocated regions.
To make this work, I used the tinyvec crate's
SliceVec
type, which works likeVec
but is backed by a fixed-size slice (which may, in our case, come from an mmap'd file). Some type and lifetime trickery was required to make our backing stores polymorphic over whether they useSliceVec
orVec
, but now they are. (The newPool
abstraction covers both cases.)So far, this is hooked up for reading only. Next, I will add pre-allocated file emission, which will require guessing the necessary sizes.