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

fix small bug in VariantContextBuilder #1403

Merged
merged 6 commits into from
Aug 2, 2019

Conversation

yfarjoun
Copy link
Contributor

@yfarjoun yfarjoun commented Aug 1, 2019

  • clean up braces while I'm at it.

Description

Please explain the changes you made here.
Explain the motivation for making this change. What existing problem does the pull request solve?

Things to think about before submitting:

  • Make sure your changes compile and new tests pass locally.
  • Add new tests or update existing ones:
    • A bug fix should include a test that previously would have failed and passes now.
    • New features should come with new tests that exercise and validate the new functionality.
  • Extended the README / documentation, if necessary
  • Check your code style.
  • Write a clear commit title and message
    • The commit message should describe what changed and is targeted at htsjdk developers
    • Breaking changes should be mentioned in the commit message.

- clean up braces while I'm at it.
@@ -435,6 +434,7 @@ public VariantContextBuilder passFilters() {
*/
public VariantContextBuilder unfiltered() {
this.filters = null;
this.filtersCanBeModified = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the bugfix



@Test
public void testCanResetFilters() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this test failed prior to adding the bugfix.

@codecov-io
Copy link

codecov-io commented Aug 1, 2019

Codecov Report

Merging #1403 into master will increase coverage by 0.003%.
The diff coverage is 84.091%.

@@               Coverage Diff               @@
##              master     #1403       +/-   ##
===============================================
+ Coverage     68.116%   68.118%   +0.003%     
  Complexity      8369      8369               
===============================================
  Files            573       573               
  Lines          33929     33938        +9     
  Branches        5667      5667               
===============================================
+ Hits           23111     23118        +7     
- Misses          8629      8631        +2     
  Partials        2189      2189
Impacted Files Coverage Δ Complexity Δ
.../variant/variantcontext/VariantContextBuilder.java 82.635% <100%> (+0.105%) 39 <0> (ø) ⬇️
src/main/java/htsjdk/variant/vcf/VCFEncoder.java 85.859% <82.927%> (-0.457%) 68 <10> (ø)

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.

@yfarjoun I changed the deeply nested

else {
  if {}
}

blocks to flatter

else if {}

variants because I think they're more readable. Any objection?

* @return this builder
*/
public VariantContextBuilder filters(final String ... filters) {
if(filters == null){
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
if(filters == null){
if (filters == null) {

builder.filters((Set<String>)null);
builder.make();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

remove NLs

@yfarjoun
Copy link
Contributor Author

yfarjoun commented Aug 2, 2019

Thanks @lbergelson for taking over this. happy with your changes with a few comments. Feel free to merge after addressing them.

Co-authored-by: Yossi Farjoun <[email protected]>
Co-authored-by: Louis Bergelson <[email protected]>
@lbergelson lbergelson force-pushed the yf_can_add_filter_after_unfiltered branch from c05c1e2 to f63282e Compare August 2, 2019 17:01
@lbergelson lbergelson merged commit 833a0e2 into master Aug 2, 2019
@lbergelson lbergelson deleted the yf_can_add_filter_after_unfiltered branch August 2, 2019 18:41
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