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

Makes IntervalKeepPairFilter filter out single ended reads #1252

Merged
merged 1 commit into from
Jan 7, 2019

Conversation

meganshand
Copy link
Contributor

Description

When a BAM contains both single ended and paired ended reads this filter throws an exception (java.lang.IllegalStateException: Inappropriate call if not paired read). Since the filter is only meant to keep paired reads it now also filters out single ended reads and doesn't throw an exception.

Checklist

  • Code compiles correctly
  • New tests covering changes and new functionality
  • All tests passing
  • Extended the README / documentation, if necessary
  • Is not backward compatible (breaks binary or source compatibility)

@codecov-io
Copy link

codecov-io commented Jan 4, 2019

Codecov Report

Merging #1252 into master will increase coverage by 0.018%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##              master     #1252       +/-   ##
===============================================
+ Coverage     69.366%   69.384%   +0.018%     
- Complexity      8155      8158        +3     
===============================================
  Files            548       548               
  Lines          32702     32702               
  Branches        5522      5522               
===============================================
+ Hits           22684     22690        +6     
+ Misses          7798      7794        -4     
+ Partials        2220      2218        -2
Impacted Files Coverage Δ Complexity Δ
...htsjdk/samtools/filter/IntervalKeepPairFilter.java 93.333% <100%> (ø) 10 <7> (+1) ⬆️
...samtools/util/AsyncBlockCompressedInputStream.java 76% <0%> (+4%) 13% <0%> (+1%) ⬆️
...sjdk/samtools/util/Md5CalculatingOutputStream.java 74.359% <0%> (+7.692%) 8% <0%> (+1%) ⬆️

@meganshand
Copy link
Contributor Author

@lbergelson could you please take a look at this?

Copy link
Member

@lbergelson lbergelson left a comment

Choose a reason for hiding this comment

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

@meganshand One comment about the test. Looks good otherwise. If you can address that then 👍


final IntervalKeepPairFilter filter = new IntervalKeepPairFilter(intervalList);

boolean singleEnded = StreamSupport.stream(builder.spliterator(), false)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this might be cleaner if you use builder.getRecords().stream() instead of this spliterator path.

Also, instead of assertingFalse it might be cleaner to use noneMatch and have one less inversion.

@lbergelson
Copy link
Member

On further inspection you're just copying the pattern around it... maybe we can fix them all in a separate PR.

@lbergelson lbergelson merged commit 2c97cce into samtools:master Jan 7, 2019
@lbergelson
Copy link
Member

@meganshand Thank you for this!

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.

3 participants