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

added --inverted-read-filter argument to allow for selecting reads failing read filters from the command line easily #8724

Merged
merged 3 commits into from
Mar 11, 2024

Conversation

jamesemery
Copy link
Collaborator

A quick and dirty implementation. The on thing that needs extra scrutiny is going to be the various conditions/failure states in the validate method. I think i caught most of the cases but there might be a gap somewhere.

@jamesemery jamesemery requested a review from ldgauthier March 8, 2024 18:46
@jamesemery jamesemery changed the title added --inverted-read-filter argument to specify inverted read filter s from the command line easily added --inverted-read-filter argument to specify inverted read filter from the command line easily Mar 8, 2024
@jamesemery jamesemery changed the title added --inverted-read-filter argument to specify inverted read filter from the command line easily added --inverted-read-filter argument to allow for selecting reads failing read filters from the command line easily Mar 8, 2024
@jamesemery jamesemery requested a review from lbergelson March 8, 2024 18:59
@@ -23,6 +24,11 @@ public class DefaultGATKReadFilterArgumentCollection extends GATKReadFilterArgum
doc="Read filters to be applied before analysis", optional=true, common = true)
public final List<String> userEnabledReadFilterNames = new ArrayList<>(); // preserve order

@Argument(fullName = ReadFilterArgumentDefinitions.INVERTED_READ_FILTER_LONG_NAME,
Copy link
Member

Choose a reason for hiding this comment

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

Ah, I thought you were going to implement special handling of not in the read filter name which sounded complicated. This is much clearer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I considered it but when we add a read filter named Not___ReadFilter i really didn't want to deal with NotNot___ReadFilters cropping up...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does mean that you can't interleave the inverted filters with regular filters in any arbitrary order however...

Copy link
Member

Choose a reason for hiding this comment

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

We could potentially allow !ReadFilter because ! shouldn't be allowed in read filter names, but yeah, it would be more complicated I think.

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.

@jamesemery This is much simpler than what I was imaginging, good thinking. Could you add tests cases for disabled/inverted interactions? I don't trust that there isn't some weird issue there that we don't notice. Other than that, just some documentation issues.

@@ -538,6 +538,27 @@ public void testEnableDisableConflict() {
"--" + ReadFilterArgumentDefinitions.DISABLE_READ_FILTER_LONG_NAME, "GoodCigarReadFilter"});
}

@Test(expectedExceptions = CommandLineException.class)
Copy link
Member

Choose a reason for hiding this comment

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

I might either add a new more specific exception type or scrape the message. It's really easy to tests like this failing for other reasons like typos and not the one you expect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

idk... commandline is a very specfic exception and i'm not super inclined to split the exception up into dozens of hyper specific commandline exceptions. Furthermore.... if you look up in the class this is already all over the place in these tests. No action

Copy link
Member

Choose a reason for hiding this comment

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

I'm in favor of hyper specific exceptions all over the place but that's fine. Did you check that it's actually erroring for the reasons you expect? I says this from experience constructing commandline tests that turned out to be typos and not valid tests.

@@ -538,6 +538,27 @@ public void testEnableDisableConflict() {
"--" + ReadFilterArgumentDefinitions.DISABLE_READ_FILTER_LONG_NAME, "GoodCigarReadFilter"});
}

@Test(expectedExceptions = CommandLineException.class)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not 100% sure, but I think there are issues with inverted and disabled read filters. You should be allowed to
a) disable the tool defaults and add back one of them but inverted.
b) disable a specific read filter and add it back inverted

Could you add tests for those cases?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will add a test for A, B is very thorny... i'm going to say thats an edge case and not handle it as it is a whole lot more complicated for a very niche case (if you want to invert a default filter you must construct your own filter list)

Copy link
Member

Choose a reason for hiding this comment

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

Ok, that seems fine. I doubt we'll ever have someone complain.

@lbergelson
Copy link
Member

Additional comment from @jamesemery

the negate read filter doesn't display the name correctly in the logs

@jamesemery
Copy link
Collaborator Author

@lbergelson back to you. Responded to everything with one pushback... The --disable-tool-default + inverte mode was broken and i've fixed it. And a fix to make the not filters display correctly on the commandline.

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.

👍 Looks good. Only further comment, would it be better to use !, &&, and || in the names? Would that be more confusing or less? I think I would prefer it but I'm not sure if our users generally would.

@jamesemery
Copy link
Collaborator Author

I thank there is a very low chance that our users would be able to find or even notice if we add !s and &&s to the filters...

@jamesemery jamesemery merged commit b81a638 into master Mar 11, 2024
20 checks passed
@jamesemery jamesemery deleted the je_addInvertReadFilterMode branch March 11, 2024 16:57
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.

2 participants