Locus (non-intervalled) traversal with new sharding system.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2903 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-03-01 01:58:44 +00:00
parent 80f5d2829d
commit 6133d73bf0
3 changed files with 21 additions and 3 deletions

View File

@ -674,7 +674,8 @@ public class GenomeAnalysisEngine {
SHARD_SIZE,
intervals, maxIterations);
} else
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,ShardStrategyFactory.SHATTER_STRATEGY.LINEAR,
shardStrategy = ShardStrategyFactory.shatter(readsDataSource,
argCollection.experimentalSharding ? ShardStrategyFactory.SHATTER_STRATEGY.LOCUS_EXPERIMENTAL : ShardStrategyFactory.SHATTER_STRATEGY.LINEAR,
drivingDataSource.getSequenceDictionary(),
SHARD_SIZE, maxIterations);
} else if (walker instanceof ReadWalker ||

View File

@ -2,6 +2,8 @@ package org.broadinstitute.sting.gatk.datasources.shards;
import org.broadinstitute.sting.utils.GenomeLocSortedSet;
import org.broadinstitute.sting.utils.StingException;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMDataSource;
import org.broadinstitute.sting.gatk.datasources.simpleDataSources.BlockDrivenSAMDataSource;
@ -9,6 +11,8 @@ import java.util.*;
import net.sf.samtools.Chunk;
import net.sf.samtools.SAMFileReader2;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMSequenceRecord;
/*
* Copyright (c) 2009 The Broad Institute
@ -62,8 +66,21 @@ public class IndexDelimitedLocusShardStrategy implements ShardStrategy {
if(!(dataSource instanceof BlockDrivenSAMDataSource))
throw new StingException("Cannot power an IndexDelimitedLocusShardStrategy with this data source.");
List<GenomeLoc> intervals;
if(locations == null) {
// If no locations were passed in, shard the entire BAM file.
SAMFileHeader header = dataSource.getHeader();
intervals = new ArrayList<GenomeLoc>();
for(SAMSequenceRecord sequenceRecord: header.getSequenceDictionary().getSequences())
intervals.add(GenomeLocParser.createGenomeLoc(sequenceRecord.getSequenceName(),1,sequenceRecord.getSequenceLength()));
}
else
intervals = locations.toList();
this.dataSource = (BlockDrivenSAMDataSource)dataSource;
filePointers.addAll(IntervalSharder.shardIntervals(this.dataSource,locations.toList(),this.dataSource.getNumIndexLevels()-1));
filePointers.addAll(IntervalSharder.shardIntervals(this.dataSource,intervals,this.dataSource.getNumIndexLevels()-1));
filePointerIterator = filePointers.iterator();
}

View File

@ -76,7 +76,7 @@ public class ShardStrategyFactory {
case INTERVAL:
throw new StingException("Requested trategy: " + strat + " doesn't work with the limiting count (-M) command line option");
case LOCUS_EXPERIMENTAL:
throw new UnsupportedOperationException("Cannot do experimental locus sharding without intervals");
return new IndexDelimitedLocusShardStrategy(dataSource,null);
case READS_EXPERIMENTAL:
return new BlockDelimitedReadShardStrategy(dataSource,null);
default: