Make identity()
calculation ignore soft clips
#4502
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.
Changelog Entry
To be copied to the draft changelog by merger:
identity()
from penalizing soft clips (insertions at start/end of path) as part of the total lengthDescription
Soft clips are internally represented as insertions at the start or end of paths. They're not really part of the mapping and thus shouldn't count against the identity score. Currently, the identity calculation is
# match bases / (# match bases + # mismatch bases + # insertion bases)
. This PR changes that to# match bases / (# match bases + # mismatch bases + # insertion bases - # softclip bases)
. Note that deletions have never been counted against identity, and I do not propose to start using them.Here are some descriptions of what "identity" means, according to the code:
identity
field of a GAM. This would imply that only aligned bases should be counted as part of the total length for the denominator. Soft clips are not aligned. Arguably even regular insertions aren't aligned either, since they don't have bases in the reference which they correspond to.identity()
. The use of "total length" seems likely to mean "total length of the path", which would include regular insertions, but I don't think should include soft clips.For what it's worth, if we want to stop counting all insertions, that's pretty easy. Here's code which would change the identity formula to
# match bases / (# match bases + # mismatch bases)
.