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

require reference as asserted in documentation #8067

Merged
merged 3 commits into from
Oct 21, 2022
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 @@ -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);
}

}