-
Notifications
You must be signed in to change notification settings - Fork 602
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
VariantsToTable: Include all fields when none specified #7911
Changes from all commits
f20763f
3e9d123
dc7ff59
0a6d1ef
8a33af3
9b956ba
cb09924
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import org.broadinstitute.hellbender.testutils.IntegrationTestSpec; | ||
import org.testng.annotations.Test; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Arrays; | ||
|
||
|
@@ -236,4 +237,44 @@ public void testMoltenOutputWithMultipleAlleles() throws IOException { | |
spec.setTrimWhiteSpace(false); | ||
spec.executeTest("testMoltenOutputWithMultipleAlleles", this); | ||
} | ||
|
||
@Test | ||
public void testNoFieldsSpecifiedNoSamples() throws IOException { | ||
final File inputFile = new File(getToolTestDataDir(), "VCFWithoutGenotypes_dbsnp_138.snippet.vcf"); | ||
final File outputFile = createTempFile("noFieldsSpecifiedOutput", ".table"); | ||
final File expectedFile = new File(getToolTestDataDir(), "expected.noFieldsSpecifiedNoSamples.table"); | ||
|
||
final String[] args = new String[] {"--variant", inputFile.getAbsolutePath(), | ||
"-O", outputFile.getAbsolutePath()}; | ||
runCommandLine(args); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests don't actually assert anything. Typically (even for "this shouldn't crash" type tests) we would want to assert that the files match the expected outputs. It looks like you are most of the way there though. You already have checked in some output files that look reasonable, now all you need to do is check that the output of THIS run matches those. One way to do that is with |
||
|
||
IntegrationTestSpec.assertEqualTextFiles(outputFile, expectedFile); | ||
} | ||
|
||
@Test | ||
public void testNoFieldsSpecifiedWithSamples() throws IOException { | ||
final File inputFile = new File(getToolTestDataDir(), "VCFWithGenotypes_1000G.phase3.snippet.vcf"); | ||
final File outputFile = createTempFile("noFieldsSpecifiedWithSamplesOutput", ".table"); | ||
final File expectedFile = new File(getToolTestDataDir(), "expected.noFieldsSpecifiedWithSamples.table"); | ||
|
||
final String[] args = new String[] {"--variant", inputFile.getAbsolutePath(), | ||
"-O", outputFile.getAbsolutePath()}; | ||
runCommandLine(args); | ||
|
||
IntegrationTestSpec.assertEqualTextFiles(outputFile, expectedFile); | ||
} | ||
|
||
@Test | ||
public void testNoFieldsSpecifiedFormatFieldInHeaderNoSamples() throws IOException { | ||
final File inputFile = new File(getToolTestDataDir(), "VCFWithoutGenotypesWithFormatField_dbsnp_138.snippet.vcf"); | ||
final File outputFile = createTempFile("noFieldsSpecifiedNoSamplesOutput", ".table"); | ||
final File expectedFile = new File(getToolTestDataDir(), "expected.noFieldsSpecifiedNoSamples.table"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test case should produce output identical to the first test case above, so you should use the same expected output file as that test uses to make this clear. |
||
|
||
final String[] args = new String[] {"--variant", inputFile.getAbsolutePath(), | ||
"-O", outputFile.getAbsolutePath()}; | ||
runCommandLine(args); | ||
|
||
IntegrationTestSpec.assertEqualTextFiles(outputFile, expectedFile); | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After reviewing the changes to the tool, I think you should add a third integration test with a VCF that contains declarations for FORMAT fields in its header, but no samples. This will exercise the following case:
It's a bit weird, but theoretically possible. You should be able to create this by making a copy of your |
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.
In the tool documentation at the top of the class, document the fact that if the tool is run without specifying any fields it defaults to including all fields declared in the VCF header. Also include an example command line for that case in the "Usage Example" section.