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 feature to check if input has been annotated #7349

Merged
merged 1 commit into from
Jul 20, 2021

Conversation

haileypfox
Copy link
Contributor

Added ability for user to override to annotate again

Wrote unit and integration tests for new feature and override ability

resolves #5679

@gatk-bot
Copy link

gatk-bot commented Jul 14, 2021

Travis reported job failures from build 34953
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 34953.12 logs
integration openjdk8 34953.2 logs

haileypfox added a commit that referenced this pull request Jul 16, 2021
@gatk-bot
Copy link

gatk-bot commented Jul 16, 2021

Travis reported job failures from build 34989
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 34989.12 logs
integration openjdk8 34989.2 logs

@droazen droazen self-requested a review July 16, 2021 16:26
@droazen droazen assigned droazen and unassigned jonn-smith Jul 16, 2021
Copy link
Contributor

@droazen droazen left a 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) {
Copy link
Contributor

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!");
Copy link
Contributor

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) {
Copy link
Contributor

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";
Copy link
Contributor

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,
Copy link
Contributor

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);
Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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"));
Copy link
Contributor

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"));
Copy link
Contributor

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 :)

@droazen droazen assigned haileypfox and unassigned droazen Jul 16, 2021
@gatk-bot
Copy link

gatk-bot commented Jul 16, 2021

Travis reported job failures from build 34993
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 34993.12 logs
integration openjdk8 34993.2 logs

@gatk-bot
Copy link

gatk-bot commented Jul 16, 2021

Travis reported job failures from build 34999
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 34999.12 logs
integration openjdk8 34999.2 logs

@gatk-bot
Copy link

gatk-bot commented Jul 16, 2021

Travis reported job failures from build 34997
Failures in the following jobs:

Test Type JDK Job ID Logs
integration openjdk11 34997.12 logs
integration openjdk8 34997.2 logs

@droazen
Copy link
Contributor

droazen commented Jul 19, 2021

@haileypfox You have a failing test in FuncotatorIntegrationTest -- see the test logs in the gatk-bot comment above:

https://storage.googleapis.com/hellbender-test-logs/build_reports/master_34997.12/tests/test/index.html
https://storage.googleapis.com/hellbender-test-logs/build_reports/master_34997.2/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
Copy link
Contributor

@droazen droazen left a 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.

@droazen droazen merged commit 31a92ba into master Jul 20, 2021
@droazen droazen deleted the hf_checkingalreadyannotated branch July 20, 2021 17:02
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.

Funcotator should error and stop when annotating a VCF that already contains funcotations.
4 participants