allow gap penalties to be a function of position on reference #424
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.
For some applications, it is desirable that the gap open and gap extend penalties vary
as a function of the position on the target (second) sequence. We encountered this when
aligning a V(D)J transcript to a concatenated V(D)J reference, where we wanted to encourage
gaps at the junction points between the reference segments.
This PR provides a solution that works, but is awkward. In alignment/pairwise/mod.rs,
we add a function custom_with_gap_fns, that is a copy of custom, except that it has two
extra arguments specifying the gap penalties, and each instance of gap_open and gap_extend
in the function are modified accordingly. This is the only change.
The extra arguments are vectors. Ideally they could be closures, although for our application,
vectors are fine. And the code duplication is awful.
It was not clear to us how to implement an elegant solution without breaking the existing
public API (and I'm not sure how to do even that).
Perhaps there is a better solution.