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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in cljam.algo.pileup/pileup #148

Merged
merged 2 commits into from Sep 4, 2018
Merged

Fix a bug in cljam.algo.pileup/pileup #148

merged 2 commits into from Sep 4, 2018

Conversation

alumi
Copy link
Member

@alumi alumi commented Sep 4, 2018

Summary

This PR fixes a bug in cljam.algo.pileup/pileup.

Problem

IllegalArgumentException in cljam.algo.pileup/pileup

java.lang.IllegalArgumentException: Value out of range for byte: 186

Cause

The qual field in cljam.io.pileup.PileupBase is declared as a byte because a phred-33 encoded base quality score never exceeds 93:

^byte qual

The record is also constructed in cljam.algo.pileup:

(-> (PileupBase.
(zero? relative-pos)
(when (zero? relative-pos) (.mapq aln))
base
qual
(flag/reversed? (.flag aln))
(= ref-pos (.end aln))
(when-not (number? indel) indel)
(when (number? indel) indel)
(.qname aln))

But quality scores can be 128 ~ 200 while piling alignments up with the option :ignore-overlaps false:

[(assoc r1 :qual (min 200 (+ q1 q2))) (assoc r2 :qual 0)]
(if (<= q2 q1)
[(assoc r1 :qual (int (* 0.8 q1))) (assoc r2 :qual 0)]
[(assoc r1 :qual 0) (assoc r2 :qual (int (* 0.8 q2)))]))))

Changes

  • Use short primitive type hinting instead of byte in cljam.io.pileup.PileupBase
  • Fix broken tests related to pileup

Tests

  • lein check 馃啑
  • lein test :all 馃啑

@alumi alumi changed the title Fix a bug in Fix a bug in cljam.algo.pileup/pileup Sep 4, 2018
@alumi alumi requested review from totakke and athos September 4, 2018 02:34
@alumi alumi added the bug label Sep 4, 2018
@alumi alumi requested a review from r6eve September 4, 2018 02:38
Copy link
Member

@athos athos left a comment

Choose a reason for hiding this comment

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

Good catch! Seems reasonable.

Copy link
Member

@totakke totakke left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@r6eve r6eve left a comment

Choose a reason for hiding this comment

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

Looks good. Thank you for the modifications.

@alumi alumi merged commit bf711af into master Sep 4, 2018
@alumi alumi deleted the fix/pileup-base-qual branch September 4, 2018 07:07
@alumi
Copy link
Member Author

alumi commented Sep 4, 2018

@athos @totakke @r6eve Thanks for your review! 馃樃

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

Successfully merging this pull request may close these issues.

None yet

4 participants