From 7f2ded070653f09a41cc34a6e4978ddfb5435de1 Mon Sep 17 00:00:00 2001 From: aaron Date: Tue, 30 Nov 2010 05:49:20 +0000 Subject: [PATCH] belated special case fix for Menachem; if the results of a BTI and BTIMR produce an empty interval list, exception out. This would be solved long term with better handling or empty and / or null interval lists. I'll add a JIRA git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4754 348d0f76-0448-11de-a6fe-93d51630548a --- .../broadinstitute/sting/utils/interval/IntervalUtils.java | 4 ++++ .../sting/utils/interval/IntervalUtilsUnitTest.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/org/broadinstitute/sting/utils/interval/IntervalUtils.java b/java/src/org/broadinstitute/sting/utils/interval/IntervalUtils.java index 7b10ccf86..4197982c9 100644 --- a/java/src/org/broadinstitute/sting/utils/interval/IntervalUtils.java +++ b/java/src/org/broadinstitute/sting/utils/interval/IntervalUtils.java @@ -113,6 +113,10 @@ public class IntervalUtils { else iTwo++; } + //if we have an empty list, throw an exception. If they specified intersection and there are no items, this is bad. + if (retList == null || retList.size() == 0) + throw new UserException.BadInput("The INTERSECTION of your -BTI and -L options produced no intervals."); + // we don't need to add the rest of remaining locations, since we know they don't overlap. return what we have return retList; } diff --git a/java/test/org/broadinstitute/sting/utils/interval/IntervalUtilsUnitTest.java b/java/test/org/broadinstitute/sting/utils/interval/IntervalUtilsUnitTest.java index 637b4571c..da1913e9a 100644 --- a/java/test/org/broadinstitute/sting/utils/interval/IntervalUtilsUnitTest.java +++ b/java/test/org/broadinstitute/sting/utils/interval/IntervalUtilsUnitTest.java @@ -31,7 +31,7 @@ public class IntervalUtilsUnitTest extends BaseTest { genomeLocParser = new GenomeLocParser(seq); } - @Test + @Test(expectedExceptions=UserException.class) public void testMergeListsBySetOperatorNoOverlap() { // a couple of lists we'll use for the testing List listEveryTwoFromOne = new ArrayList();