From c2669021b8224d6e18682c6a7ac665e7abbbcd08 Mon Sep 17 00:00:00 2001 From: hanna Date: Fri, 10 Apr 2009 22:09:01 +0000 Subject: [PATCH] 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 --- .../sting/gatk/executive/MicroManager.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/executive/MicroManager.java b/java/src/org/broadinstitute/sting/gatk/executive/MicroManager.java index a4a53db37..4dea622b9 100644 --- a/java/src/org/broadinstitute/sting/gatk/executive/MicroManager.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/MicroManager.java @@ -56,26 +56,41 @@ public class MicroManager { public void execute( Walker walker, // the analysis technique to use. List 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 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 );