Cleanup, and support either by-interval traversals or full traversals in data source-backed code.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@362 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-04-10 22:09:01 +00:00
parent 2322bb7d86
commit c2669021b8
1 changed files with 23 additions and 8 deletions

View File

@ -56,26 +56,41 @@ public class MicroManager {
public void execute( Walker walker, // the analysis technique to use.
List<GenomeLoc> locations ) { // list of work to do
ShardStrategy shardStrategy = ShardStrategyFactory.shatter( ShardStrategyFactory.SHATTER_STRATEGY.LINEAR,
ref.getSequenceDictionary(),
SHARD_SIZE );
ShardStrategy shardStrategy = null;
if( locations != null )
shardStrategy = ShardStrategyFactory.shatter( ShardStrategyFactory.SHATTER_STRATEGY.LINEAR,
ref.getSequenceDictionary(),
SHARD_SIZE,
locations );
else
shardStrategy = ShardStrategyFactory.shatter( ShardStrategyFactory.SHATTER_STRATEGY.LINEAR,
ref.getSequenceDictionary(),
SHARD_SIZE );
ReferenceIterator refIter = new ReferenceIterator(ref);
SAMBAMDataSource dataSource = null;
try {
dataSource = new SAMBAMDataSource( Arrays.asList( new String[] { reads.getCanonicalPath() } ) );
}
catch( SimpleDataSourceLoadException ex ) {
throw new RuntimeException( ex );
}
catch( IOException ex ) {
throw new RuntimeException( ex );
}
Object accumulator = ((LocusWalker<?,?>)walker).reduceInit();
for(Shard shard: shardStrategy) {
Iterator<SAMRecord> readShard = null;
try {
SAMBAMDataSource dataSource = new SAMBAMDataSource( Arrays.asList( new String[] { reads.getCanonicalPath() } ) );
readShard = dataSource.seek( shard.getGenomeLoc() );
}
catch( SimpleDataSourceLoadException ex ) {
throw new RuntimeException( ex );
}
catch( IOException ex ) {
throw new RuntimeException( ex );
}
ReferenceProvider referenceProvider = new ReferenceProvider( refIter );
LocusContextProvider locusProvider = new LocusContextProvider( readShard );