adding improved low-complexity filter #45
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.
New filtering algorithm which takes into account segmented transcripts.
Essentially, filters reads where the non-softmasked segments have an average repetitiveness of 0.8. If a read has one segment, then 0.8 of that read's non-softmasked bases are the same base (e.g. "AAAAAAAATG"). This allows multiple split segments of different repetitive regions to be evaluated, e.g. "AAAAAA|TTTTTT" will have a repetitiveness of 1.0 instead of 0.5 (| indicates a segment divider, denoted by 'N' in the CIGAR string).
This fixes #41, which can be closed with this PR.
Here are some examples of filtered reads on a short read bam:
The repetitiveness of 1.00 even though there are some complex bases might seem strange, but these are marked as softmasked as evidenced by the CIGAR string. The final base in the non-softmasked alignment (...TTTG), corresponding to the CIGAR substring 1M, is evaluated as the same as itself ("G" == "G"), so still contributes a repetitiveness of 1.0 to the average.
The calculation of the average is weighted by the length of the segment - more details can be found in the linked issue with a formal mathematical definition of the algorithm.