From 99d4ebc26db3e6dc5d6e80e0f5d291a489a02cb1 Mon Sep 17 00:00:00 2001 From: aaron Date: Fri, 15 May 2009 20:20:27 +0000 Subject: [PATCH] Added functionality to return the final accumulator of a traversal, so external tools can get the result of a walker. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@724 348d0f76-0448-11de-a6fe-93d51630548a --- .../sting/gatk/executive/HierarchicalMicroScheduler.java | 4 +++- .../sting/gatk/executive/LinearMicroScheduler.java | 4 +++- .../broadinstitute/sting/gatk/executive/MicroScheduler.java | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java b/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java index b98b30928..0c6560e31 100755 --- a/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/HierarchicalMicroScheduler.java @@ -65,7 +65,7 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce throw new UnsupportedOperationException("Traversal engine supports only traverse loci by reference at this time."); } - public void execute( Walker walker, List intervals ) { + public Object execute( Walker walker, List intervals ) { // Fast fail for walkers not supporting TreeReducible interface. if( !(walker instanceof TreeReducible) ) throw new IllegalArgumentException("Hierarchical microscheduler only works with TreeReducible walkers"); @@ -110,6 +110,8 @@ public class HierarchicalMicroScheduler extends MicroScheduler implements Reduce traversalEngine.printOnTraversalDone(result); walker.onTraversalDone(result); + + return result; } /** diff --git a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java index 3c12d2b57..8da7618c0 100644 --- a/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/LinearMicroScheduler.java @@ -30,7 +30,7 @@ public class LinearMicroScheduler extends MicroScheduler { * @param walker Computation to perform over dataset. * @param locations Subset of the dataset over which to walk. */ - public void execute(Walker walker, List locations) { + public Object execute(Walker walker, List locations) { ShardStrategy shardStrategy = getShardStrategy(reference, locations); walker.initialize(); @@ -45,6 +45,8 @@ public class LinearMicroScheduler extends MicroScheduler { traversalEngine.printOnTraversalDone(accumulator); walker.onTraversalDone(accumulator); + + return accumulator; } diff --git a/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java b/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java index f76f6d859..55b9b540b 100755 --- a/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java +++ b/java/src/org/broadinstitute/sting/gatk/executive/MicroScheduler.java @@ -91,8 +91,9 @@ public abstract class MicroScheduler { * Walks a walker over the given list of intervals. * @param walker Computation to perform over dataset. * @param intervals A list of intervals over which to walk. Null for whole dataset. + * @return the return type of the walker */ - public abstract void execute( Walker walker, List intervals); + public abstract Object execute( Walker walker, List intervals); /** * Get the sharding strategy given a driving data source.