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

fixed bug in tandem repeat annotation #6583

Merged
merged 1 commit into from
Jun 4, 2020
Merged

Conversation

davidbenjamin
Copy link
Contributor

@fleharty Here is a quick M2 and HC edge case bug for you.

In the edge case where an alt haplotype starts with an indel, and hence the variant context start is one base before the assembly region due to padding a leading matching base, there was a problem. The variant start was before the reference context window (since in this part of the code the reference context window is pegged to the assembly region, which caused problems in the lines

final int startIndex = vc.getStart() - ref.getWindow().getStart();
        final byte[] refBasesStartingAtVariantLocus = new String(refBases).substring(startIndex).getBytes();

The fix is for refBasesStartingAtVariantLocus to exclude the padding base, which as you can see was done previously in the line

final String refBasesStartingAtVCWithoutPad = new String(refBasesStartingAtVCWithPad).substring(1);

That is, instead of taking a subarray of the reference bytes twice, once from the variant context start with padding and once more to remove the padding, we take a single subarray without the padding.

While I was at it, I replaced some slow conversions from byte[] to String to String back to byte[] with subarray operations.

@droazen
Copy link
Contributor

droazen commented Jun 3, 2020

@fleharty Is this a fix you would want to see in the next release?

@fleharty
Copy link
Contributor

fleharty commented Jun 3, 2020

@droazen yes, if that is possible, sorry this slipped through the crack. I'll review this this evening.

Copy link
Contributor

@fleharty fleharty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidbenjamin Looks great!

@davidbenjamin davidbenjamin merged commit 9cc92e3 into master Jun 4, 2020
@davidbenjamin davidbenjamin deleted the db_tandem_repeat_bug branch June 4, 2020 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants