From 8e1aa6059afc862042c71af0a179da0dd484b067 Mon Sep 17 00:00:00 2001 From: rpoplin Date: Wed, 2 Mar 2011 15:52:17 +0000 Subject: [PATCH] New mode for CombineVariants to assume the incoming VCFs have the same samples and disjoint calls. Drastically reduces the runtime for routine combining operations. Very useful with Queue. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5356 348d0f76-0448-11de-a6fe-93d51630548a --- .../gatk/walkers/variantutils/CombineVariants.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java index 1a21a92e0..2b91a4b8b 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java @@ -79,6 +79,9 @@ public class CombineVariants extends RodWalker { @Argument(fullName="setKey", shortName="setKey", doc="Key, by default set, in the INFO key=value tag emitted describing which set the combined VCF record came from. Set to null if you don't want the set field emitted.", required=false) public String SET_KEY = "set"; + @Argument(fullName="assumeIdenticalSamples", shortName="assumeIdenticalSamples", doc="If true, assume input VCFs have identical sample sets and disjoint calls so that one can simply perform a merge sort to combine the VCFs into one, drastically reducing the runtime.", required=false) + public boolean ASSUME_IDENTICAL_SAMPLES = false; + private List priority = null; public void initialize() { @@ -127,6 +130,15 @@ public class CombineVariants extends RodWalker { // Need to provide reference bases to simpleMerge starting at current locus Collection vcs = tracker.getAllVariantContexts(ref, context.getLocation()); + if ( ASSUME_IDENTICAL_SAMPLES ) { + final VariantContext vc = vcs.iterator().next(); + if( vc != null ) { + vcfWriter.add( vc, ref.getBase() ); + } + + return vcs.isEmpty() ? 0 : 1; + } + VariantContext mergedVC = null; if ( variantMergeOption == VariantContextUtils.VariantMergeType.MASTER ) { mergedVC = VariantContextUtils.masterMerge(vcs, "master");