Skip to content

Commit

Permalink
require reference as asserted in documentation (#8067)
Browse files Browse the repository at this point in the history
* require reference as asserted in documentation
:

* Subbed File.createTempFile for BaseTest.createTempFile

* Changed args from list to ArgumentBuilder
  • Loading branch information
tmelman committed Oct 21, 2022
1 parent 07a8278 commit 9321181
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ public class MergeAnnotatedRegions extends GATKTool {

final static String DEFAULT_SEPARATOR = "__";

@Override
public boolean requiresReference() {
return true;
}

@Override
public void traverse() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package org.broadinstitute.hellbender.tools.copynumber.utils;

import com.google.common.collect.ImmutableSortedMap;
import org.broadinstitute.barclay.argparser.CommandLineException;
import org.broadinstitute.hellbender.CommandLineProgramTest;
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions;
import org.broadinstitute.hellbender.tools.copynumber.arguments.CopyNumberStandardArgument;
import org.broadinstitute.hellbender.tools.copynumber.utils.annotatedinterval.AnnotatedInterval;
import org.broadinstitute.hellbender.tools.copynumber.utils.annotatedinterval.AnnotatedIntervalCollection;
import org.broadinstitute.hellbender.utils.SimpleInterval;
import org.broadinstitute.hellbender.testutils.BaseTest;
import org.broadinstitute.hellbender.testutils.ArgumentsBuilder;
import org.testng.Assert;
import org.testng.annotations.Test;

Expand All @@ -23,14 +26,11 @@ public class MergeAnnotatedRegionsIntegrationTest extends CommandLineProgramTest
@Test
public void basicTest() throws IOException {
// This test is a bit more like the real world
final File outputFile = File.createTempFile("mergeannotatedregions", ".seg");
final List<String> arguments = new ArrayList<>();
arguments.add("--" + CopyNumberStandardArgument.SEGMENTS_FILE_LONG_NAME);
arguments.add(SIMPLE_TEST_FILE);
arguments.add("--" + StandardArgumentDefinitions.REFERENCE_LONG_NAME);
arguments.add(REF);
arguments.add("-" + StandardArgumentDefinitions.OUTPUT_SHORT_NAME);
arguments.add(outputFile.getAbsolutePath());
final File outputFile = BaseTest.createTempFile("mergeannotatedregions", ".seg");
final ArgumentsBuilder arguments = new ArgumentsBuilder();
arguments.add(CopyNumberStandardArgument.SEGMENTS_FILE_LONG_NAME, SIMPLE_TEST_FILE);
arguments.add(StandardArgumentDefinitions.REFERENCE_LONG_NAME, REF);
arguments.add(StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getAbsolutePath());
runCommandLine(arguments);

final AnnotatedIntervalCollection collection =
Expand All @@ -50,4 +50,15 @@ public void basicTest() throws IOException {
Assert.assertEquals(collection.getRecords().get(4), new AnnotatedInterval(new SimpleInterval("2", 1098, 2305),
ImmutableSortedMap.of("Num_Probes", "200", "Segment_Mean", "-0.10", "Segment_Call", "0")));
}

@Test(expectedExceptions = CommandLineException.class)
public void requiresReferenceTest() throws IOException {
// This test is a bit more like the real world
final File outputFile = BaseTest.createTempFile("mergeannotatedregions", ".seg");
final ArgumentsBuilder arguments = new ArgumentsBuilder();
arguments.add(CopyNumberStandardArgument.SEGMENTS_FILE_LONG_NAME, SIMPLE_TEST_FILE);
arguments.add(StandardArgumentDefinitions.OUTPUT_SHORT_NAME, outputFile.getAbsolutePath());
runCommandLine(arguments);
}

}

0 comments on commit 9321181

Please sign in to comment.