Fix for bug GSA-314: Detect -XL and -L incompatibility. An ArgumentException is
now thrown if the combination of -L and -XL intervals specified on the command line results in an empty interval set after set subtraction. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5571 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
798fb6a7a2
commit
a5acb0b7a6
|
|
@ -118,6 +118,14 @@ public class GenomeAnalysisEngine {
|
||||||
*/
|
*/
|
||||||
private GenomeLocSortedSet intervals = null;
|
private GenomeLocSortedSet intervals = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explicitly assign the interval set to use for this traversal (for unit testing purposes)
|
||||||
|
* @param intervals set of intervals to use for this traversal
|
||||||
|
*/
|
||||||
|
public void setIntervals( GenomeLocSortedSet intervals ) {
|
||||||
|
this.intervals = intervals;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collection of inputs used by the engine.
|
* Collection of inputs used by the engine.
|
||||||
*/
|
*/
|
||||||
|
|
@ -395,6 +403,16 @@ public class GenomeAnalysisEngine {
|
||||||
if(intervals != null && getIntervals().contains(GenomeLoc.UNMAPPED))
|
if(intervals != null && getIntervals().contains(GenomeLoc.UNMAPPED))
|
||||||
throw new ArgumentException("Interval list specifies unmapped region. Only read walkers may include the unmapped region.");
|
throw new ArgumentException("Interval list specifies unmapped region. Only read walkers may include the unmapped region.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If intervals is non-null and empty at this point, it means that the list of intervals to process
|
||||||
|
// was filtered down to an empty set (eg., the user specified something like -L chr1 -XL chr1). Since
|
||||||
|
// this was very likely unintentional, the user should be informed of this. Note that this is different
|
||||||
|
// from the case where intervals == null, which indicates either that there were no interval arguments,
|
||||||
|
// or that -L all was specified.
|
||||||
|
if ( intervals != null && intervals.isEmpty() ) {
|
||||||
|
throw new ArgumentException("The given combination of -L and -XL options results in an empty set. " +
|
||||||
|
"No intervals to process.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,13 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk;
|
package org.broadinstitute.sting.gatk;
|
||||||
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
|
|
||||||
import org.broadinstitute.sting.BaseTest;
|
import org.broadinstitute.sting.BaseTest;
|
||||||
import org.broadinstitute.sting.commandline.ArgumentException;
|
import org.broadinstitute.sting.commandline.ArgumentException;
|
||||||
import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID;
|
import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID;
|
||||||
import org.broadinstitute.sting.commandline.Tags;
|
import org.broadinstitute.sting.commandline.Tags;
|
||||||
|
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
|
||||||
|
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -66,4 +67,16 @@ public class GenomeAnalysisEngineUnitTest extends BaseTest {
|
||||||
testEngine.setSAMFileIDs(samFiles);
|
testEngine.setSAMFileIDs(samFiles);
|
||||||
testEngine.checkForDuplicateSamFiles();
|
testEngine.checkForDuplicateSamFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test(expectedExceptions=ArgumentException.class)
|
||||||
|
public void testEmptyIntervalSetHandling() throws Exception {
|
||||||
|
GenomeAnalysisEngine testEngine = new GenomeAnalysisEngine();
|
||||||
|
|
||||||
|
WalkerManager walkerManager = new WalkerManager();
|
||||||
|
testEngine.setWalker(walkerManager.createByName("PrintReadsWalker"));
|
||||||
|
|
||||||
|
testEngine.setIntervals(new GenomeLocSortedSet(null));
|
||||||
|
|
||||||
|
testEngine.validateSuppliedIntervals();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue