more fixes for the empty interval list problem; you can now run LocusWindow traversals with an empty interval list, but the GATK will give you a warning (unless you're running in unsafe mode).

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2563 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2010-01-12 18:47:43 +00:00
parent 35a4fcc481
commit 16777e3875
3 changed files with 7 additions and 21 deletions

View File

@ -626,8 +626,9 @@ public class GenomeAnalysisEngine {
SHARD_SIZE, maxIterations); SHARD_SIZE, maxIterations);
} }
} else if (walker instanceof LocusWindowWalker) { } else if (walker instanceof LocusWindowWalker) {
if (intervals == null || intervals.isEmpty()) if ((intervals == null || intervals.isEmpty()) && !this.argCollection.unsafe)
throw new StingException("Unable to shard: walker is of type LocusWindow, but no intervals were provided"); Utils.warnUser("walker is of type LocusWindow (which operates over intervals), but no intervals were provided." +
"This may be unintentional, check your command-line arguments.");
shardStrategy = ShardStrategyFactory.shatter(ShardStrategyFactory.SHATTER_STRATEGY.INTERVAL, shardStrategy = ShardStrategyFactory.shatter(ShardStrategyFactory.SHATTER_STRATEGY.INTERVAL,
drivingDataSource.getSequenceDictionary(), drivingDataSource.getSequenceDictionary(),
SHARD_SIZE, SHARD_SIZE,

View File

@ -57,7 +57,7 @@ public class IntervalShardStrategy implements ShardStrategy {
* @param size the next recommended shard size. * @param size the next recommended shard size.
*/ */
public void adjustNextShardSize( long size ) { public void adjustNextShardSize( long size ) {
this.size = size; this.size = size; // we don't do anything with the size in this case, but we should store it anyway
} }
/** /**
@ -67,26 +67,11 @@ public class IntervalShardStrategy implements ShardStrategy {
* @param locations * @param locations
*/ */
IntervalShardStrategy( long size, GenomeLocSortedSet locations, Shard.ShardType shardType ) { IntervalShardStrategy( long size, GenomeLocSortedSet locations, Shard.ShardType shardType ) {
if (locations == null || locations.isEmpty()) {
throw new StingException("IntervalShardStrategy: genomic regions list is empty.");
}
type = shardType; type = shardType;
this.regions = locations.clone(); this.regions = locations == null ? new GenomeLocSortedSet() : locations.clone();
this.size = size; this.size = size;
} }
/**
* the default constructor
*
* @param dict the sequence dictionary to use
*/
IntervalShardStrategy( SAMSequenceDictionary dict, GenomeLocSortedSet locations ) {
if (locations == null || locations.isEmpty()) {
throw new StingException("IntervalShardStrategy: genomic regions list is empty.");
}
this.regions = locations.clone();
}
/** /**
* returns true if there are additional shards * returns true if there are additional shards
* *

View File

@ -65,8 +65,8 @@ public class IntervalShardStrategyTest extends BaseTest {
mSortedSet = new GenomeLocSortedSet(); mSortedSet = new GenomeLocSortedSet();
} }
@Test(expected = StingException.class) @Test
public void testExceptionOnEmpty() { public void testNoExceptionOnEmpty() {
IntervalShardStrategy strat = new IntervalShardStrategy(100, mSortedSet,Shard.ShardType.LOCUS_INTERVAL); IntervalShardStrategy strat = new IntervalShardStrategy(100, mSortedSet,Shard.ShardType.LOCUS_INTERVAL);
} }