Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding improved low-complexity filter #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mbeavitt
Copy link
Contributor

@mbeavitt mbeavitt commented Jan 13, 2025

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:

[...]
!!!READ FILTERED!!!
51M94700N1M11S
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGTTTGGGTTGTT
Average repetitiveness: 1.00

!!!READ FILTERED!!!
52M94699N1M8S
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGTACTGGTA
Average repetitiveness: 1.00

!!!READ FILTERED!!!
51M94699N1M8S
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGGGGGTTTT
Average repetitiveness: 1.00

!!!READ FILTERED!!!
51M94699N1M9S
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGTTTATTGGG
Average repetitiveness: 1.00

!!!READ FILTERED!!!
50M94700N1M10S
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTGGTGTTTTTTA
Average repetitiveness: 1.00
[...]

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Low complexity read filtering step in FindJunctions.cpp is broken for long reads
1 participant