Interval support for ref walkers while streaming.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3725 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-07-07 03:14:59 +00:00
parent 773a72e6ea
commit 120f90da5b
3 changed files with 21 additions and 10 deletions

View File

@ -729,8 +729,10 @@ public class GenomeAnalysisEngine {
// Use monolithic sharding if no index is present. Monolithic sharding is always required for the original
// sharding system; it's required with the new sharding system only for locus walkers.
if(readsDataSource != null && !readsDataSource.hasIndex() ) {
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM) || intervals != null)
throw new StingException("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM, or with unindexed BAM files with the -L option");
if(!exclusions.contains(ValidationExclusion.TYPE.ALLOW_UNINDEXED_BAM))
throw new StingException("The GATK cannot currently process unindexed BAM files without the -U ALLOW_UNINDEXED_BAM");
if(intervals != null && WalkerManager.getWalkerDataSource(walker) != DataSource.REFERENCE)
throw new StingException("Cannot shard input by interval when walker is not driven by reference.");
Shard.ShardType shardType;
if(walker instanceof LocusWalker) {
@ -743,7 +745,16 @@ public class GenomeAnalysisEngine {
else
throw new StingException("The GATK cannot currently process unindexed BAM files");
return new MonolithicShardStrategy(shardType,drivingDataSource.getSequenceDictionary());
List<GenomeLoc> region;
if(intervals != null)
region = intervals.toList();
else {
region = new ArrayList<GenomeLoc>();
for(SAMSequenceRecord sequenceRecord: drivingDataSource.getSequenceDictionary().getSequences())
region.add(GenomeLocParser.createGenomeLoc(sequenceRecord.getSequenceName(),1,sequenceRecord.getSequenceLength()));
}
return new MonolithicShardStrategy(shardType,region);
}
ShardStrategy shardStrategy = null;

View File

@ -25,19 +25,18 @@ public class MonolithicShard implements Shard {
/**
* Locations. For the monolithic shard, should be a list of all available contigs in the reference.
*/
private final List<GenomeLoc> locs = new ArrayList<GenomeLoc>();
private final List<GenomeLoc> locs;
/**
* Creates a new monolithic shard of the given type.
* @param shardType Type of the shard. Must be either read or locus; cannot be intervalic.
* @param sequenceDictionary the sequence dictionary from which to derive contig info.
* @param locs Intervals that this monolithic shard should process.
*/
public MonolithicShard(ShardType shardType, SAMSequenceDictionary sequenceDictionary) {
public MonolithicShard(ShardType shardType, List<GenomeLoc> locs) {
if(shardType != ShardType.LOCUS && shardType != ShardType.READ)
throw new StingException("Invalid shard type for monolithic shard: " + shardType);
this.shardType = shardType;
for(SAMSequenceRecord sequenceRecord: sequenceDictionary.getSequences())
locs.add(GenomeLocParser.createGenomeLoc(sequenceRecord.getSequenceName(),1,sequenceRecord.getSequenceLength()));
this.locs = locs;
}
/**

View File

@ -5,6 +5,7 @@ import org.broadinstitute.sting.utils.StingException;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.List;
import net.sf.samtools.SAMSequenceDictionary;
@ -24,8 +25,8 @@ public class MonolithicShardStrategy implements ShardStrategy {
* Create a new shard strategy for shards of the given type.
* @param shardType The shard type.
*/
public MonolithicShardStrategy(final Shard.ShardType shardType, final SAMSequenceDictionary sequenceDictionary) {
shard = new MonolithicShard(shardType,sequenceDictionary);
public MonolithicShardStrategy(final Shard.ShardType shardType, final List<GenomeLoc> region) {
shard = new MonolithicShard(shardType,region);
}
/**