-
Notifications
You must be signed in to change notification settings - Fork 593
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 feature to check if input has been annotated #7349
Conversation
3197e99
to
885bb94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haileypfox Back to you with my review comments -- looks good overall, but some minor changes are needed
* | ||
* No need to annotate again. | ||
*/ | ||
static void checkIfAlreadyAnnotated(final VCFHeader vcfHeader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this method has package level access so that test code can access it, it should be annotated with the @VisibleForTesting
annotation.
*/ | ||
static void checkIfAlreadyAnnotated(final VCFHeader vcfHeader) { | ||
if (vcfHeader.getOtherHeaderLine("Funcotator") != null) { | ||
throw new UserException.BadInput("Given VCF has already been annotated!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the file name / URI in the exception messages
if (vcfHeader.getOtherHeaderLine("Funcotator") != null) { | ||
throw new UserException.BadInput("Given VCF has already been annotated!"); | ||
} | ||
else if (vcfHeader.getOtherHeaderLine("Funcotator Version") != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These header line keys "Funcotator Version" and "Funcotator" should ideally be declared as static final
constants somewhere -- possibly in FuncotatorConstants
or GATKVCFConstants
@@ -36,6 +36,7 @@ private StandardArgumentDefinitions(){} | |||
public static final String DISABLE_SEQUENCE_DICT_VALIDATION_NAME = "disable-sequence-dictionary-validation"; | |||
public static final String ADD_OUTPUT_SAM_PROGRAM_RECORD = "add-output-sam-program-record"; | |||
public static final String ADD_OUTPUT_VCF_COMMANDLINE = "add-output-vcf-command-line"; | |||
public static final String REANNOTATE_VCF_LONG_NAME = "reannotate-vcf"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the declaration of this constant in FuncotatorArgumentDefinitions
below is sufficient, and you don't need to repeat it here in StandardArgumentDefinitions
@@ -40,4 +41,12 @@ | |||
) | |||
public int threePrimeFlankSize = FuncotatorArgumentDefinitions.THREE_PRIME_FLANK_SIZE_DEFAULT_VALUE; | |||
|
|||
@Argument( | |||
fullName = StandardArgumentDefinitions.REANNOTATE_VCF_LONG_NAME, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FuncotatorArgumentDefinitions
outputFormatType, | ||
true, | ||
Collections.emptyList(), | ||
true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment noting that the --reannotate-vcf
is being turned on here, to make that clearer for the reader of your code
} | ||
|
||
/** In this instance, we are again giving an already annotated file, but | ||
* we are using the flag argument "true" to indicate that we want this file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention the --reannotate-vcf
argument in this comment
* to be reannotated. There should be no errors. | ||
*/ | ||
@Test(dataProvider = "provideForCheckIfAlreadyAnnotatedTestWrong") | ||
public void testCheckWhenWantReannotate(final String inputVcfName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The names of your test methods are a bit hard to understand -- I suggest tweaking the names to make it clearer what configuration each method is running with. Eg.,
testAlreadyAnnotatedInputWithOverrideArgument()
testAlreadyAnnotatedInputWithoutOverrideArgument()
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); | ||
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); | ||
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); | ||
headerLines.add(new VCFHeaderLine("Funcotator", "Funcotator")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a second test case with a header containing a "Funcotator Version" line, but not a "Funcotator" line, to exercise the else if
clause in the method you're testing.
headerLines.add(new VCFHeaderLine("FILTER", "FILTER")); | ||
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); | ||
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); | ||
headerLines.add(new VCFHeaderLine("FORMAT", "FORMAT")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't need quite so many non-Funcotator header lines here -- 4-5 would be sufficient :)
ce30d6f
to
70ead30
Compare
@haileypfox You have a failing test in https://storage.googleapis.com/hellbender-test-logs/build_reports/master_34997.12/tests/test/index.html Can you fix this test failure before I re-review? |
Added ability for user to override to annotate again Wrote unit and integration tests for new feature and override ability resolves #5679
ee7d126
to
562e2f3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@haileypfox Latest version looks good, and is passing tests now. Merging!
For future reference, note that in FuncotatorUnitTest
, the two test cases provideDataForAnnotationCheckWrong
and provideDataForAnnotationCheckWrongSecond
should ideally have been combined into a single DataProvider
with two test cases, so that the same test method could be used for both.
Added ability for user to override to annotate again
Wrote unit and integration tests for new feature and override ability
resolves #5679