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

Change VariantEval to not require the output file to already exist. #5681

Merged
merged 2 commits into from
Feb 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ protected void initializeDrivingVariants() {
@Override
public void onTraversalStart() {
Utils.nonNull(outFile);
IOUtils.assertFileIsReadable(outFile.toPath());
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add at least one test that would have failed without this patch?


// Just list the modules, and exit quickly.
if (LIST) { variantEvalUtils.listModulesAndExit(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import org.broadinstitute.barclay.argparser.CommandLineException;
import org.broadinstitute.hellbender.CommandLineProgramTest;
import org.broadinstitute.hellbender.exceptions.UserException;
import org.broadinstitute.hellbender.testutils.ArgumentsBuilder;
import org.broadinstitute.hellbender.testutils.IntegrationTestSpec;
import org.broadinstitute.hellbender.utils.SimpleInterval;
import org.broadinstitute.hellbender.utils.io.IOUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -636,4 +640,29 @@ public void testPrintMissingComp() throws IOException {
spec.executeTest(name, this);

}

@Test
public void testOutputFileCreation() throws IOException {
// duplicate of "testPrintMissingComp", this time without using IntegrationTestSpec in order to force the
// tool to create the output file directly (tests fix for https://github.com/broadinstitute/gatk/issues/5674)

final String testName = "testOutputFileCreation";
final File tmpDir = createTempDir(testName);
final File outputFile = new File(tmpDir, testName + ".txt");

ArgumentsBuilder argBuilder= new ArgumentsBuilder();
argBuilder.addReference(new File(b37_reference_20_21));
argBuilder.addArgument("eval", getTestFilePath("validationReportEval.noGenotypes.vcf"));
argBuilder.addArgument("comp", getTestFilePath("validationReportComp.noGenotypes.vcf"));
argBuilder.addInterval(new SimpleInterval("20"));
argBuilder.addArgument("EV", "PrintMissingComp");
argBuilder.addOutput(outputFile);

runCommandLine(argBuilder);

IntegrationTestSpec.assertEqualTextFiles(
outputFile,
new File(getToolTestDataDir() + "expected/" + "testPrintMissingComp" + ".expected.txt"));
}

}