diff --git a/build.xml b/build.xml
index 1a9c72bd8..34dcc05fb 100644
--- a/build.xml
+++ b/build.xml
@@ -403,7 +403,11 @@
-
+
+
+
+
+
@@ -415,6 +419,15 @@
+
+
+
+
+
+
+
+
+
@@ -497,7 +510,7 @@
-
+
diff --git a/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java b/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
index af355ab03..f8527c33b 100755
--- a/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
+++ b/java/src/org/broadinstitute/sting/gatk/GenomeAnalysisEngine.java
@@ -30,7 +30,7 @@ import net.sf.samtools.*;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.commandline.ArgumentException;
import org.broadinstitute.sting.commandline.ArgumentSource;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.CommandLineUtils;
import org.broadinstitute.sting.commandline.ParsingEngine;
import org.broadinstitute.sting.commandline.Tags;
diff --git a/java/src/org/broadinstitute/sting/gatk/datasources/sample/SampleDataSource.java b/java/src/org/broadinstitute/sting/gatk/datasources/sample/SampleDataSource.java
index e85ef80be..0a5981a1b 100644
--- a/java/src/org/broadinstitute/sting/gatk/datasources/sample/SampleDataSource.java
+++ b/java/src/org/broadinstitute/sting/gatk/datasources/sample/SampleDataSource.java
@@ -3,8 +3,8 @@ package org.broadinstitute.sting.gatk.datasources.sample;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
import net.sf.samtools.SAMRecord;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.StingException;
diff --git a/java/src/org/broadinstitute/sting/gatk/io/storage/VCFWriterStorage.java b/java/src/org/broadinstitute/sting/gatk/io/storage/VCFWriterStorage.java
index fdac507f7..74176ec35 100644
--- a/java/src/org/broadinstitute/sting/gatk/io/storage/VCFWriterStorage.java
+++ b/java/src/org/broadinstitute/sting/gatk/io/storage/VCFWriterStorage.java
@@ -2,8 +2,8 @@ package org.broadinstitute.sting.gatk.io.storage;
import org.apache.log4j.Logger;
import org.broad.tribble.source.BasicFeatureSource;
-import org.broad.tribble.vcf.*;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
diff --git a/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterArgumentTypeDescriptor.java b/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterArgumentTypeDescriptor.java
index 888f8b36e..7521e754d 100644
--- a/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterArgumentTypeDescriptor.java
+++ b/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterArgumentTypeDescriptor.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.io.stubs;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
diff --git a/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterStub.java b/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterStub.java
index a31a16d50..1a79d2785 100755
--- a/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterStub.java
+++ b/java/src/org/broadinstitute/sting/gatk/io/stubs/VCFWriterStub.java
@@ -30,10 +30,10 @@ import java.io.PrintStream;
import java.io.OutputStream;
import java.util.Collection;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.gatk.CommandLineExecutable;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.io.OutputTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java b/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java
index 239877ccf..43bf6f8e0 100644
--- a/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java
+++ b/java/src/org/broadinstitute/sting/gatk/refdata/RefMetaDataTracker.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.refdata;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java
index d2595a39e..7d7a9d32c 100755
--- a/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java
+++ b/java/src/org/broadinstitute/sting/gatk/refdata/VariantContextAdaptors.java
@@ -3,21 +3,19 @@ package org.broadinstitute.sting.gatk.refdata;
import org.broad.tribble.Feature;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broad.tribble.gelitext.GeliTextFeature;
-import org.broad.tribble.hapmap.HapMapFeature;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.MutableGenotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.codecs.hapmap.HapMapFeature;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.MutableGenotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
import org.broadinstitute.sting.utils.classloader.PluginManager;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
-import javax.xml.stream.events.Attribute;
import java.util.*;
-import java.util.jar.Attributes;
/**
* A terrible but temporary approach to converting objects to VariantContexts. If you want to add a converter,
diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/beagle/BeagleFeature.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/beagle/BeagleFeature.java
index dd946287d..c7bf86569 100755
--- a/java/src/org/broadinstitute/sting/gatk/refdata/features/beagle/BeagleFeature.java
+++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/beagle/BeagleFeature.java
@@ -31,7 +31,7 @@ import java.util.ArrayList;
import java.util.Map;
import net.sf.samtools.util.StringUtil;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
public class BeagleFeature implements Feature {
diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/utils/helpers/DbSNPHelper.java b/java/src/org/broadinstitute/sting/gatk/refdata/utils/helpers/DbSNPHelper.java
index d2a5d17ed..75e7c1a32 100644
--- a/java/src/org/broadinstitute/sting/gatk/refdata/utils/helpers/DbSNPHelper.java
+++ b/java/src/org/broadinstitute/sting/gatk/refdata/utils/helpers/DbSNPHelper.java
@@ -3,7 +3,7 @@ package org.broadinstitute.sting.gatk.refdata.utils.helpers;
import net.sf.samtools.util.SequenceUtil;
import org.broad.tribble.annotation.Strand;
import org.broad.tribble.dbsnp.DbSNPFeature;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.utils.Utils;
import java.util.ArrayList;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnalyzeAnnotationsWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnalyzeAnnotationsWalker.java
index 8ffc7d957..54fd0a20c 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnalyzeAnnotationsWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnalyzeAnnotationsWalker.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.analyzeannotations;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnnotationDataManager.java b/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnnotationDataManager.java
index 726b659e3..2c06b30d6 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnnotationDataManager.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/analyzeannotations/AnnotationDataManager.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.analyzeannotations;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java
index e9f324363..b02dcd8e2 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java
@@ -25,10 +25,10 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java
index b853ed5f3..0be737897 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java
@@ -1,12 +1,11 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.vcf.VCFFormatHeaderLine;
-import org.broad.tribble.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
import org.broadinstitute.sting.gatk.contexts.*;
-import org.broad.tribble.util.variantcontext.*;
+import org.broadinstitute.sting.utils.variantcontext.*;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
-import org.broadinstitute.sting.utils.pileup.*;
import org.broadinstitute.sting.utils.*;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java
index 9b1ee4b4f..51b5381dc 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AnnotationByDepth.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
import java.util.Map;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseCounts.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseCounts.java
index 9d441918f..244627154 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseCounts.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseCounts.java
@@ -31,9 +31,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
index 588a86087..ff916bedd 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/BaseQualityRankSumTest.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.walkers.genotyper.IndelGenotypeLikelihoodsCalculationModel;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
index 9c5ba40aa..143722d7c 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ChromosomeCounts.java
@@ -25,13 +25,13 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java
index bc6f71cbf..e56825dbe 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthOfCoverage.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
index 2e033a865..754d28dfd 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
@@ -1,11 +1,11 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFCompoundHeaderLine;
-import org.broad.tribble.vcf.VCFFormatHeaderLine;
-import org.broad.tribble.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCompoundHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
index 66d927e1c..2115526a6 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java
@@ -32,10 +32,10 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.genotyper.IndelGenotypeLikelihoodsCalculationModel;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.pileup.PileupElement;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
-import org.broad.tribble.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
import cern.jet.math.Arithmetic;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
index 8dc7b294c..5eaa30bf3 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GCContent.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GLstats.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GLstats.java
index 081d43498..3a5db2884 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GLstats.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/GLstats.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
index cb7bcbeed..bd8c51a41 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HaplotypeScore.java
@@ -24,11 +24,11 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
index 05f7fa2e6..ecebfbbd2 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HardyWeinberg.java
@@ -1,10 +1,10 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broad.tribble.util.popgen.HardyWeinbergCalculation;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
index 16287491c..099780fa7 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/HomopolymerRun.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/IndelType.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/IndelType.java
index 2a0ae0290..ee8b01d7d 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/IndelType.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/IndelType.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java
index b3e3a742c..33069f1f5 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/LowMQ.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
index 0f874ed7f..11f86b972 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityRankSumTest.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.walkers.genotyper.IndelGenotypeLikelihoodsCalculationModel;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
index 665f5c0a4..25a7b286d 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZero.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroBySample.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroBySample.java
index de64741dd..00cc30309 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroBySample.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroBySample.java
@@ -31,11 +31,11 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFFormatHeaderLine;
import java.util.Map;
import java.util.HashMap;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroFraction.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroFraction.java
index 46beed71d..dc4934ade 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroFraction.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/MappingQualityZeroFraction.java
@@ -1,9 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/NBaseCount.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/NBaseCount.java
index 760f68b9e..ba3e2cc8b 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/NBaseCount.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/NBaseCount.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java
index 2ef9947e2..720984835 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/QualByDepth.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
index 4ac4880d3..6e80c7555 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RMSMappingQuality.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
index e5e08472a..1a967293f 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java
index 3f0105376..f287549bb 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadDepthAndAllelicFractionBySample.java
@@ -27,19 +27,18 @@ package org.broadinstitute.sting.gatk.walkers.annotator;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.GenotypeAnnotation;
-import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.StandardAnnotation;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import org.broadinstitute.sting.utils.pileup.ExtendedEventPileupElement;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.vcf.VCFFormatHeaderLine;
-import org.broad.tribble.vcf.VCFCompoundHeaderLine;
-import org.broad.tribble.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCompoundHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
import java.util.Map;
import java.util.HashMap;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
index 9d5f2ec1a..2a17cd436 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/ReadPosRankSumTest.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.walkers.genotyper.IndelGenotypeLikelihoodsCalculationModel;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java
index 5e38fd5b2..fc769ac54 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SBByDepth.java
@@ -1,10 +1,10 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
index 3c1c87170..82f16be42 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SampleList.java
@@ -25,16 +25,14 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
-import org.broadinstitute.sting.utils.MathUtils;
-import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import java.util.Arrays;
import java.util.HashMap;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
index fb34b56ae..0b6cbcc2e 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/SpanningDeletions.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java
index 0d9ccf738..cd5b6694b 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotator.java
@@ -25,13 +25,13 @@
package org.broadinstitute.sting.gatk.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.AnnotationType;
@@ -42,7 +42,7 @@ import org.broadinstitute.sting.utils.classloader.PluginManager;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java
index 3eb60a54f..54c8be73a 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/VariantAnnotatorEngine.java
@@ -37,9 +37,9 @@ import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotation.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotation.java
index caa32fef3..e02c62baf 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotation.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotation.java
@@ -28,10 +28,10 @@ package org.broadinstitute.sting.gatk.walkers.annotator.genomicannotator;
import java.util.*;
import java.util.Map.Entry;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotator.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotator.java
index f10101328..69a35a584 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/genomicannotator/GenomicAnnotator.java
@@ -31,10 +31,10 @@ import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -47,7 +47,7 @@ import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
/**
* Annotates variant calls with information from user-specified tabular files.
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/GenotypeAnnotation.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/GenotypeAnnotation.java
index ee0038ee8..29b256479 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/GenotypeAnnotation.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/GenotypeAnnotation.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFFormatHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFFormatHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/InfoFieldAnnotation.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/InfoFieldAnnotation.java
index c82da908f..5b33395b5 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/InfoFieldAnnotation.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/interfaces/InfoFieldAnnotation.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.annotator.interfaces;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/BeagleOutputToVCFWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/BeagleOutputToVCFWalker.java
index 3f5dd1396..aa23abc67 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/BeagleOutputToVCFWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/BeagleOutputToVCFWalker.java
@@ -25,14 +25,14 @@
package org.broadinstitute.sting.gatk.walkers.beagle;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.features.beagle.BeagleFeature;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@@ -41,8 +41,8 @@ import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import java.util.*;
import static java.lang.Math.log10;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/ProduceBeagleInputWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/ProduceBeagleInputWalker.java
index 98ec7f3d7..93ee0b085 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/ProduceBeagleInputWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/ProduceBeagleInputWalker.java
@@ -25,10 +25,10 @@
package org.broadinstitute.sting.gatk.walkers.beagle;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.commandline.Input;
@@ -36,7 +36,7 @@ import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.RMD;
@@ -46,13 +46,10 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.StingException;
-import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.io.PrintStream;
-import java.text.DecimalFormat;
-import java.text.MessageFormat;
import java.util.*;
/**
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/VariantsToBeagleUnphasedWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/VariantsToBeagleUnphasedWalker.java
index 9a9aff457..18aa3e257 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/beagle/VariantsToBeagleUnphasedWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/beagle/VariantsToBeagleUnphasedWalker.java
@@ -25,17 +25,17 @@
package org.broadinstitute.sting.gatk.walkers.beagle;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.gatk.walkers.Requires;
@@ -43,7 +43,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.PrintStream;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/fasta/FastaAlternateReferenceWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/fasta/FastaAlternateReferenceWalker.java
index 6c8eef9a6..828d39717 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/fasta/FastaAlternateReferenceWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/fasta/FastaAlternateReferenceWalker.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.fasta;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/filters/ClusteredSnps.java b/java/src/org/broadinstitute/sting/gatk/walkers/filters/ClusteredSnps.java
index a5a74ffa4..b31526987 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/filters/ClusteredSnps.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/filters/ClusteredSnps.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.filters;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.UserException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/filters/FiltrationContext.java b/java/src/org/broadinstitute/sting/gatk/walkers/filters/FiltrationContext.java
index 4ef007e05..c3849e240 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/filters/FiltrationContext.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/filters/FiltrationContext.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.filters;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java
index 61536e758..884d0ac24 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/filters/VariantFiltrationWalker.java
@@ -25,12 +25,12 @@
package org.broadinstitute.sting.gatk.walkers.filters;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
@@ -39,7 +39,7 @@ import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/AlleleFrequencyCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/AlleleFrequencyCalculationModel.java
index 07e8fc2ce..47be7e6fe 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/AlleleFrequencyCalculationModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/AlleleFrequencyCalculationModel.java
@@ -26,11 +26,11 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import java.io.PrintStream;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BiallelicGenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BiallelicGenotypeLikelihoods.java
index 2220dd6bc..fbd9c1dbf 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BiallelicGenotypeLikelihoods.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/BiallelicGenotypeLikelihoods.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
public class BiallelicGenotypeLikelihoods {
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java
index 7f4185229..89504b371 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/ExactAFCalculationModel.java
@@ -26,9 +26,9 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
index 5b8a2c761..3902a0b7f 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoodsCalculationModel.java
@@ -30,7 +30,7 @@ import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.pileup.PileupElement;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GridSearchAFEstimation.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GridSearchAFEstimation.java
index ca162c749..c4e315f68 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GridSearchAFEstimation.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GridSearchAFEstimation.java
@@ -26,9 +26,9 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.utils.collections.Pair;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
index 1ee658f5c..1f430548b 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java
@@ -27,7 +27,7 @@ package org.broadinstitute.sting.gatk.walkers.genotyper;
import net.sf.samtools.SAMRecord;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.walkers.indels.HaplotypeIndelErrorModel;
@@ -44,7 +44,7 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedExtendedEventPileup;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
import org.broadinstitute.sting.utils.sam.ReadUtils;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/MultiallelicGenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/MultiallelicGenotypeLikelihoods.java
index a983036f3..2cf149fd0 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/MultiallelicGenotypeLikelihoods.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/MultiallelicGenotypeLikelihoods.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.utils.exceptions.StingException;
import java.util.ArrayList;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
index 9800ea5c7..9f4d4182f 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.utils.*;
@@ -37,7 +37,7 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.apache.log4j.Logger;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileupImpl;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java
index 4bfb93e80..cf1c57a05 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCalcLikelihoods.java
@@ -25,8 +25,8 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.ArgumentCollection;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.DownsampleType;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java
index 4a6ab0eaf..1533e8777 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UGCallVariants.java
@@ -24,14 +24,14 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.ArgumentCollection;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
index 0a2b6f503..7a765c602 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyper.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.*;
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@@ -37,7 +37,7 @@ import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.baq.BAQ;
import org.broadinstitute.sting.commandline.*;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
import java.io.PrintStream;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java
index 69c616584..4c9080884 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java
@@ -26,10 +26,10 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.GenotypeLikelihoods;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.GenotypeLikelihoods;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -39,7 +39,7 @@ import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.baq.BAQ;
import org.broadinstitute.sting.utils.pileup.*;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import com.google.java.contract.*;
import java.io.PrintStream;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java
index 8153d9b11..5896e784e 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/VariantCallContext.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.genotyper;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
/**
* Created by IntelliJ IDEA.
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java
index 5de01392c..7617aa9de 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/HaplotypeIndelErrorModel.java
@@ -27,8 +27,8 @@ package org.broadinstitute.sting.gatk.walkers.indels;
import net.sf.samtools.AlignmentBlock;
import net.sf.samtools.SAMRecord;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.walkers.genotyper.ExactAFCalculationModel;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.QualityUtils;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java
index c0b170d25..28b88f9f2 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java
@@ -30,7 +30,7 @@ import net.sf.samtools.util.RuntimeIOException;
import net.sf.samtools.util.StringUtil;
import net.sf.samtools.util.SequenceUtil;
import net.sf.picard.reference.IndexedFastaSequenceFile;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java
index 56e2ab6b3..89bdd53c8 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/PairHMMIndelErrorModel.java
@@ -29,7 +29,7 @@ import net.sf.samtools.Cigar;
import net.sf.samtools.CigarElement;
import net.sf.samtools.CigarOperator;
import net.sf.samtools.SAMRecord;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
/*import org.broadinstitute.sting.oneoffprojects.walkers.IndelCountCovariates.Covariate;
import org.broadinstitute.sting.oneoffprojects.walkers.IndelCountCovariates.RecalDataManager;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java
index b536a0cb5..048dbd8cb 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreator.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.gatk.walkers.indels;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.filters.BadCigarFilter;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/SomaticIndelDetectorWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/SomaticIndelDetectorWalker.java
index 0d9edcde1..c2953d1d7 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/SomaticIndelDetectorWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/SomaticIndelDetectorWalker.java
@@ -25,11 +25,10 @@
package org.broadinstitute.sting.gatk.walkers.indels;
-import net.sf.samtools.*;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Tags;
import org.broadinstitute.sting.gatk.datasources.reads.SAMReaderID;
import org.broadinstitute.sting.gatk.datasources.reference.ReferenceDataSource;
@@ -58,6 +57,8 @@ import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.commandline.Hidden;
+import net.sf.samtools.*;
+
import java.io.*;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AllelePair.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AllelePair.java
index f7e763d8c..869edf784 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AllelePair.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AllelePair.java
@@ -23,8 +23,8 @@
*/
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.util.ArrayList;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AnnotateMNPsWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AnnotateMNPsWalker.java
index fac4b5dc1..7989f52db 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AnnotateMNPsWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/AnnotateMNPsWalker.java
@@ -24,14 +24,14 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.refdata.features.annotator.AnnotatorInputTableFeature;
@@ -43,11 +43,11 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeMNPsWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeMNPsWalker.java
index 5122e10c3..709bc44ce 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeMNPsWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeMNPsWalker.java
@@ -24,11 +24,10 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -36,11 +35,11 @@ import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.walkers.*;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesVCFWriter.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesVCFWriter.java
index 8acece2ed..abced442e 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesVCFWriter.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesVCFWriter.java
@@ -27,12 +27,12 @@ package org.broadinstitute.sting.gatk.walkers.phasing;
import net.sf.picard.reference.IndexedFastaSequenceFile;
import net.sf.picard.reference.ReferenceSequenceFile;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFWriter;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesWalker.java
index 0c1bc7180..ec6f5c648 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/MergeSegregatingAlternateAllelesWalker.java
@@ -24,24 +24,24 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.ReferenceOrderedDatum;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
* Walks along all variant ROD loci, and merges consecutive sites if some sample has segregating alt alleles in the ROD.
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java
index 7e2476f8d..e59b29502 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/ReadBackedPhasingWalker.java
@@ -23,14 +23,14 @@
*/
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.sample.Sample;
import org.broadinstitute.sting.gatk.filters.ZeroMappingQualityReadFilter;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
@@ -40,15 +40,15 @@ import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
-import org.broad.tribble.vcf.SortingVCFWriter;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.SortingVCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import java.io.*;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/RefSeqDataParser.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/RefSeqDataParser.java
index af3960b1a..55da1c152 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/RefSeqDataParser.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/RefSeqDataParser.java
@@ -24,7 +24,7 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/SNPallelePair.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/SNPallelePair.java
index 55a877c57..db1f888a1 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/SNPallelePair.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/SNPallelePair.java
@@ -23,8 +23,8 @@
*/
package org.broadinstitute.sting.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/WriteVCF.java b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/WriteVCF.java
index ddeadee37..f82e48abd 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/phasing/WriteVCF.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/phasing/WriteVCF.java
@@ -24,9 +24,9 @@
package org.broadinstitute.sting.gatk.walkers.phasing;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
public class WriteVCF {
public static void writeVCF(VariantContext vc, VCFWriter writer, Logger logger) {
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/qc/ProfileRodSystem.java b/java/src/org/broadinstitute/sting/gatk/walkers/qc/ProfileRodSystem.java
index 142c383e3..67879a442 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/qc/ProfileRodSystem.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/qc/ProfileRodSystem.java
@@ -24,10 +24,10 @@
package org.broadinstitute.sting.gatk.walkers.qc;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broad.tribble.util.ParsingUtils;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFCodec;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
import org.broad.tribble.readers.AsciiLineReader;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CountCovariatesWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CountCovariatesWalker.java
index 5bf7738ca..ee504b6e7 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CountCovariatesWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/recalibration/CountCovariatesWalker.java
@@ -27,9 +27,8 @@ package org.broadinstitute.sting.gatk.walkers.recalibration;
import org.broad.tribble.bed.BEDCodec;
import org.broad.tribble.dbsnp.DbSNPCodec;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCF3Codec;
-import org.broad.tribble.vcf.VCFCodec;
+import org.broadinstitute.sting.utils.codecs.vcf.VCF3Codec;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
import org.broadinstitute.sting.commandline.Gather;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/CreateSequenomMask.java b/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/CreateSequenomMask.java
index 19c272bbf..c1c17bda5 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/CreateSequenomMask.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/CreateSequenomMask.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.sequenom;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/PickSequenomProbes.java b/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/PickSequenomProbes.java
index 466184da6..f350e7531 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/PickSequenomProbes.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/sequenom/PickSequenomProbes.java
@@ -28,8 +28,8 @@ package org.broadinstitute.sting.gatk.walkers.sequenom;
import net.sf.samtools.util.CloseableIterator;
import org.broad.tribble.bed.BEDCodec;
import org.broad.tribble.dbsnp.DbSNPCodec;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java
index 2a21bfe41..15d808ebe 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/VariantEvalWalker.java
@@ -2,13 +2,13 @@ package org.broadinstitute.sting.gatk.walkers.varianteval;
import net.sf.samtools.SAMSequenceRecord;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
@@ -29,11 +29,9 @@ import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.utils.exceptions.StingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.TableType;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import net.sf.picard.reference.FastaSequenceFile;
import net.sf.picard.reference.IndexedFastaSequenceFile;
-import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
-import org.broadinstitute.sting.gatk.walkers.fasta.FastaSequence;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import net.sf.picard.reference.ReferenceSequence;
import java.io.FileNotFoundException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompEvalGenotypes.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompEvalGenotypes.java
index 00c997a67..787dbe9af 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompEvalGenotypes.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompEvalGenotypes.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.utils.GenomeLoc;
class NewCompEvalGenotypes {
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompOverlap.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompOverlap.java
index 37172617a..76db330ed 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompOverlap.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CompOverlap.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java
index db4a11960..c4277adc9 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/CountVariants.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypeConcordance.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypeConcordance.java
index ad8bfbbe4..4b56cf130 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypeConcordance.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypeConcordance.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
index be0b96d3c..3d14dd0e5 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/GenotypePhasingEvaluator.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelLengthHistogram.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelLengthHistogram.java
index 6c8ac3dc6..5daf33a9f 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelLengthHistogram.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelLengthHistogram.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelMetricsByAC.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelMetricsByAC.java
index c6133acdf..eca6c5193 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelMetricsByAC.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelMetricsByAC.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelStatistics.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelStatistics.java
index 410e5da9c..48b06d532 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelStatistics.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/IndelStatistics.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/MendelianViolationEvaluator.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/MendelianViolationEvaluator.java
index 6f2f89fcf..85e0b5889 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/MendelianViolationEvaluator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/MendelianViolationEvaluator.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/PrintMissingComp.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/PrintMissingComp.java
index 3085e358c..7d54d0df8 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/PrintMissingComp.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/PrintMissingComp.java
@@ -24,7 +24,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SamplePreviousGenotypes.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SamplePreviousGenotypes.java
index c1ba8cccb..5f3e6b0fa 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SamplePreviousGenotypes.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SamplePreviousGenotypes.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.util.HashMap;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SimpleMetricsByAC.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SimpleMetricsByAC.java
index 6be2786d2..deed05508 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SimpleMetricsByAC.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/SimpleMetricsByAC.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.VariantEvalWalker;
import org.broadinstitute.sting.gatk.walkers.varianteval.stratifications.Degeneracy;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ThetaVariantEvaluator.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ThetaVariantEvaluator.java
index 0d4f4df77..89c67cfe9 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ThetaVariantEvaluator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ThetaVariantEvaluator.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/TiTvVariantEvaluator.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/TiTvVariantEvaluator.java
index 99b4daec8..8811dc001 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/TiTvVariantEvaluator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/TiTvVariantEvaluator.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.Analysis;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.DataPoint;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
index 8bf317b25..405f35635 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/ValidationReport.java
@@ -1,18 +1,15 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broadinstitute.sting.gatk.walkers.varianteval.VariantEvalWalker;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.Analysis;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.DataPoint;
-import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
-import org.broadinstitute.sting.utils.exceptions.UserException;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantEvaluator.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantEvaluator.java
index 2180bb732..6017ecca3 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantEvaluator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantEvaluator.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantQualityScore.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantQualityScore.java
index bc8f9a8f8..4af14810b 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantQualityScore.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/evaluators/VariantQualityScore.java
@@ -25,11 +25,11 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.evaluators;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.Analysis;
import org.broadinstitute.sting.gatk.walkers.varianteval.tags.DataPoint;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java
index 19f207df1..ff59c9e29 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleCount.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleFrequency.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleFrequency.java
index 0daad99dc..48b4ffa91 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleFrequency.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/AlleleFrequency.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CompRod.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CompRod.java
index e4d95c514..9942ba8d6 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CompRod.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CompRod.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Contig.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Contig.java
index 0ce74f518..1a9d31085 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Contig.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Contig.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CpG.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CpG.java
index 65608f6b7..15b1d41c1 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CpG.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/CpG.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Degeneracy.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Degeneracy.java
index 7c41ea58e..65af6090c 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Degeneracy.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Degeneracy.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/EvalRod.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/EvalRod.java
index 6400d612c..7bd15a974 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/EvalRod.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/EvalRod.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Filter.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Filter.java
index 10e628520..8d8782ab7 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Filter.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Filter.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/FunctionalClass.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/FunctionalClass.java
index ed9d4d266..fd724d6d1 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/FunctionalClass.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/FunctionalClass.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/JexlExpression.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/JexlExpression.java
index 9fa0eca61..a7ccd3182 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/JexlExpression.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/JexlExpression.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Novelty.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Novelty.java
index ab0fa7f4a..39d2e6b4d 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Novelty.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Novelty.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Sample.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Sample.java
index 940352246..f909de4f3 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Sample.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/Sample.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/VariantStratifier.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/VariantStratifier.java
index 96603edaf..218cb23ca 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/VariantStratifier.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/stratifications/VariantStratifier.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.stratifications;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.varianteval.VariantEvalWalker;
import org.broadinstitute.sting.gatk.walkers.varianteval.util.SortableJexlVCMatchExp;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/NewEvaluationContext.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/NewEvaluationContext.java
index 44248e169..3208c26bb 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/NewEvaluationContext.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/NewEvaluationContext.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.util;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/SortableJexlVCMatchExp.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/SortableJexlVCMatchExp.java
index dce08da45..0281653af 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/SortableJexlVCMatchExp.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/SortableJexlVCMatchExp.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.util;
import org.apache.commons.jexl2.*;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
public class SortableJexlVCMatchExp extends VariantContextUtils.JexlVCMatchExp implements Comparable {
/**
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java
index 32996a0bc..b8e45e462 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/varianteval/util/VariantEvalUtils.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.gatk.walkers.varianteval.util;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.report.GATKReport;
import org.broadinstitute.sting.gatk.report.GATKReportTable;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyRecalibration.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyRecalibration.java
index 48deabc14..9877781d1 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyRecalibration.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/ApplyRecalibration.java
@@ -25,8 +25,8 @@
package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@@ -37,7 +37,7 @@ import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.collections.NestedHashMap;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.text.XReadLines;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VQSRCalibrationCurve.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VQSRCalibrationCurve.java
index 4ebe9807b..2914385a4 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VQSRCalibrationCurve.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VQSRCalibrationCurve.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.walkers.varianteval.evaluators.VariantQualityScore;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java
index 1d6d9a1e4..2fd1326fe 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java
@@ -2,7 +2,7 @@ package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
import cern.jet.random.Normal;
import org.apache.log4j.Logger;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java
index 4eb3f7639..e651b62e0 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java
@@ -25,14 +25,14 @@
package org.broadinstitute.sting.gatk.walkers.variantrecalibration;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.ArgumentCollection;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
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 4cee70def..597a54dc1 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/CombineVariants.java
@@ -25,13 +25,12 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import com.sun.tools.internal.xjc.reader.gbind.ElementSets;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.Reference;
import org.broadinstitute.sting.gatk.walkers.Requires;
@@ -42,7 +41,7 @@ import org.broadinstitute.sting.utils.Utils;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/FilterLiftedVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/FilterLiftedVariants.java
index 298a7e38c..ba6f5e513 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/FilterLiftedVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/FilterLiftedVariants.java
@@ -24,16 +24,16 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFWriter;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.commandline.Output;
-import org.broad.tribble.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LeftAlignVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LeftAlignVariants.java
index bb39e2765..d9dd85f0c 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LeftAlignVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LeftAlignVariants.java
@@ -28,13 +28,13 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
import net.sf.samtools.Cigar;
import net.sf.samtools.CigarElement;
import net.sf.samtools.CigarOperator;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.SortingVCFWriter;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.SortingVCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@@ -42,7 +42,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LiftoverVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LiftoverVariants.java
index 56c5d8db3..7eda54387 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LiftoverVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/LiftoverVariants.java
@@ -24,18 +24,18 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import java.io.File;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/RandomlySplitVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/RandomlySplitVariants.java
index 1c9155045..0c41a9728 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/RandomlySplitVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/RandomlySplitVariants.java
@@ -24,11 +24,11 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.StandardVCFWriter;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
@@ -40,7 +40,7 @@ import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java
index 0f1d5221c..963aa0ce5 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/SelectVariants.java
@@ -24,26 +24,25 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.*;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.utils.MendelianViolation;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java
index 19932ca2b..ec7395f85 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/ValidateVariants.java
@@ -25,8 +25,8 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
import org.broad.tribble.dbsnp.DbSNPFeature;
import org.broad.tribble.TribbleException;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantValidationAssessor.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantValidationAssessor.java
index c3de49a83..482679593 100644
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantValidationAssessor.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantValidationAssessor.java
@@ -25,18 +25,17 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToTable.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToTable.java
index 4aa854946..71dd5df3f 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToTable.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToTable.java
@@ -24,12 +24,12 @@
package org.broadinstitute.sting.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToVCF.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToVCF.java
index 56fb4c75c..7eb49da34 100755
--- a/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToVCF.java
+++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToVCF.java
@@ -28,14 +28,14 @@ package org.broadinstitute.sting.gatk.walkers.variantutils;
import net.sf.samtools.util.CloseableIterator;
import org.broad.tribble.dbsnp.DbSNPCodec;
import org.broad.tribble.dbsnp.DbSNPFeature;
-import org.broad.tribble.hapmap.HapMapFeature;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.codecs.hapmap.HapMapFeature;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.commandline.Argument;
@@ -45,7 +45,7 @@ import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.SampleUtils;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AffectedConsistencyWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AffectedConsistencyWalker.java
index 044c12cf7..4100b500d 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AffectedConsistencyWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AffectedConsistencyWalker.java
@@ -1,14 +1,14 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.report.GATKReport;
import org.broadinstitute.sting.gatk.report.GATKReportTable;
@@ -19,7 +19,7 @@ import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.text.XReadLines;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AlleleBalanceHistogramWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AlleleBalanceHistogramWalker.java
index a8c374d63..509d65441 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AlleleBalanceHistogramWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AlleleBalanceHistogramWalker.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotateTruthROD.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotateTruthROD.java
index 901a85fd1..3fac966ea 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotateTruthROD.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotateTruthROD.java
@@ -25,21 +25,21 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.MutableVariantContext;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.MutableVariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.ArrayList;
import java.util.List;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotationByAlleleFrequencyWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotationByAlleleFrequencyWalker.java
index 926842b7f..40bec19f6 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotationByAlleleFrequencyWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AnnotationByAlleleFrequencyWalker.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessLikelihoodsAtTruth.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessLikelihoodsAtTruth.java
index 8fa4a3ed1..57d143127 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessLikelihoodsAtTruth.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessLikelihoodsAtTruth.java
@@ -25,9 +25,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.GenotypeLikelihoods;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.GenotypeLikelihoods;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessMissingBroadCalls.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessMissingBroadCalls.java
index 3b134849d..4478bd501 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessMissingBroadCalls.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessMissingBroadCalls.java
@@ -25,8 +25,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@@ -35,7 +35,7 @@ import org.broadinstitute.sting.gatk.walkers.Reference;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.Window;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSimulatedPerformance.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSimulatedPerformance.java
index 844a16c3b..47bd82d2f 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSimulatedPerformance.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSimulatedPerformance.java
@@ -24,12 +24,12 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSnpsNearIndels.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSnpsNearIndels.java
index f3baf24f7..b7aa1defe 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSnpsNearIndels.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/AssessSnpsNearIndels.java
@@ -25,27 +25,17 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.iterators.DownsampleIterator;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broadinstitute.sting.gatk.walkers.Reference;
-import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
-import org.broadinstitute.sting.gatk.walkers.Window;
import org.broadinstitute.sting.utils.BaseUtils;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
import java.io.PrintStream;
-import java.io.Writer;
-import java.security.PrivilegedActionException;
import java.util.*;
/**
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BeagleOutputByDepthWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BeagleOutputByDepthWalker.java
index 5242125db..64e2633da 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BeagleOutputByDepthWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/BeagleOutputByDepthWalker.java
@@ -25,11 +25,10 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
-import org.broadinstitute.sting.commandline.Argument;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CNV/CNVstatsWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CNV/CNVstatsWalker.java
index 0cdb07e4b..b29917f48 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CNV/CNVstatsWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CNV/CNVstatsWalker.java
@@ -24,9 +24,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers.CNV;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CalibrateGenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CalibrateGenotypeLikelihoods.java
index ff0a9696c..d454dec7e 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CalibrateGenotypeLikelihoods.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CalibrateGenotypeLikelihoods.java
@@ -26,9 +26,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
import net.sf.samtools.SAMReadGroupRecord;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.GenotypeLikelihoods;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.GenotypeLikelihoods;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CreateTiTvTrack.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CreateTiTvTrack.java
index 60078cbfb..63b17bda3 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CreateTiTvTrack.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/CreateTiTvTrack.java
@@ -1,11 +1,11 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.wiggle.WiggleHeader;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/GenotypeConcordanceTable.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/GenotypeConcordanceTable.java
index cfe7fb9a3..d4b73cb59 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/GenotypeConcordanceTable.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/GenotypeConcordanceTable.java
@@ -24,8 +24,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java
index 13499214e..399a3e6df 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelAnnotator.java
@@ -1,8 +1,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.FeatureSource;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -12,12 +11,11 @@ import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqCodec;
import org.broadinstitute.sting.gatk.refdata.features.refseq.RefSeqFeature;
import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack;
import org.broadinstitute.sting.gatk.refdata.tracks.builders.RMDTrackBuilder;
-import org.broadinstitute.sting.gatk.refdata.utils.RMDTriplet;
import org.broadinstitute.sting.gatk.refdata.utils.RODRecordList;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelConsistencyReadCounter.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelConsistencyReadCounter.java
index fb22c7577..1c7a2d8e4 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelConsistencyReadCounter.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelConsistencyReadCounter.java
@@ -31,7 +31,7 @@ import org.broadinstitute.sting.gatk.refdata.*;
import org.broadinstitute.sting.gatk.refdata.utils.GATKFeature;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.filters.BadMateFilter;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelCountCovariates/IndelCountCovariatesWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelCountCovariates/IndelCountCovariatesWalker.java
index a6166be53..a6fcce290 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelCountCovariates/IndelCountCovariatesWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelCountCovariates/IndelCountCovariatesWalker.java
@@ -27,8 +27,8 @@ package org.broadinstitute.sting.oneoffprojects.walkers.IndelCountCovariates;
import org.broad.tribble.bed.BEDCodec;
import org.broad.tribble.dbsnp.DbSNPCodec;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFCodec;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
import org.broadinstitute.sting.commandline.Gather;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelDBRateWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelDBRateWalker.java
index b90a152dc..189db5206 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelDBRateWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/IndelDBRateWalker.java
@@ -1,15 +1,15 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.StandardVCFWriter;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
import org.broadinstitute.sting.gatk.walkers.Reference;
@@ -19,7 +19,7 @@ import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.collections.ExpandingArrayList;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.PrintStream;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MarkIntervals.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MarkIntervals.java
index 109fa6b40..54bdfdf3f 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MarkIntervals.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MarkIntervals.java
@@ -38,7 +38,7 @@ import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.text.XReadLines;
import org.broadinstitute.sting.utils.collections.Pair;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import java.util.List;
import java.util.Collection;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MendelianViolationClassifier.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MendelianViolationClassifier.java
index 4ae95f265..65e09f0db 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MendelianViolationClassifier.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/MendelianViolationClassifier.java
@@ -1,18 +1,18 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.StandardVCFWriter;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.StandardVCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContextUtils;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.LocusWalker;
import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedArgumentCollection;
@@ -21,7 +21,7 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.pileup.PileupElement;
import java.io.PrintStream;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/SimulateReadsForVariants.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/SimulateReadsForVariants.java
index bb058a6f1..914a9d745 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/SimulateReadsForVariants.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/SimulateReadsForVariants.java
@@ -24,37 +24,35 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.vcf.VCFWriter;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RefWalker;
import org.broadinstitute.sting.gatk.walkers.Reference;
import org.broadinstitute.sting.gatk.walkers.Window;
import org.broadinstitute.sting.gatk.io.StingSAMFileWriter;
-import org.broadinstitute.sting.gatk.filters.ReadGroupBlackListFilter;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileup;
import org.broadinstitute.sting.utils.pileup.ReadBackedPileupImpl;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
import org.broadinstitute.sting.utils.text.TextFormattingUtils;
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.*;
import net.sf.samtools.*;
+
import cern.jet.math.Arithmetic;
import cern.jet.random.Poisson;
import cern.jet.random.engine.MersenneTwister;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/TestVariantContextWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/TestVariantContextWalker.java
index 0bd969874..a23b064f1 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/TestVariantContextWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/TestVariantContextWalker.java
@@ -25,9 +25,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.StandardVCFWriter;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.*;
@@ -38,7 +37,6 @@ import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.walkers.Window;
import java.util.EnumSet;
-import java.io.File;
import java.io.PrintStream;
/**
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/VCF4WriterTestWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/VCF4WriterTestWalker.java
index 2c476442a..1519aa02e 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/VCF4WriterTestWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/VCF4WriterTestWalker.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers;
import org.broad.tribble.readers.AsciiLineReader;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -12,7 +12,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.GenomeLoc;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.io.FileInputStream;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/HammingDistance.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/HammingDistance.java
index 95a980a8a..62490b66f 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/HammingDistance.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/HammingDistance.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java
index d1618697e..95d4b6bf5 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/InsertSizeDistribution.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java
index 51ebfb2db..1af1fa491 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/ProportionOfNonrefBasesSupportingSNP.java
@@ -25,9 +25,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.annotator.interfaces.InfoFieldAnnotation;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/QualByDepthV2.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/QualByDepthV2.java
index 72079733e..416b7e8c2 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/QualByDepthV2.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/annotator/QualByDepthV2.java
@@ -1,9 +1,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers.annotator;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeaderLineType;
-import org.broad.tribble.vcf.VCFInfoHeaderLine;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLineType;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFInfoHeaderLine;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CalcFullHaplotypesWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CalcFullHaplotypesWalker.java
index 4f8d84965..c0dce0d46 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CalcFullHaplotypesWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CalcFullHaplotypesWalker.java
@@ -24,9 +24,9 @@
package org.broadinstitute.sting.oneoffprojects.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -40,7 +40,7 @@ import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.io.PrintStream;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
* Walks along all variant ROD loci and verifies the phasing from the reads for user-defined pairs of sites.
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/ComparePhasingToTrioPhasingNoRecombinationWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/ComparePhasingToTrioPhasingNoRecombinationWalker.java
index f10062185..a385f870d 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/ComparePhasingToTrioPhasingNoRecombinationWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/ComparePhasingToTrioPhasingNoRecombinationWalker.java
@@ -24,12 +24,12 @@
package org.broadinstitute.sting.oneoffprojects.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -46,12 +46,12 @@ import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.PrintStream;
import java.util.*;
-import static org.broadinstitute.sting.utils.vcf.VCFUtils.getVCFHeadersFromRods;
+import static org.broadinstitute.sting.utils.codecs.vcf.VCFUtils.getVCFHeadersFromRods;
/**
* Walks along all variant ROD loci and verifies the phasing from the reads for user-defined pairs of sites.
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CountHetPhasingInIntervalWalker.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CountHetPhasingInIntervalWalker.java
index 00f34c03e..5c0af0e41 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CountHetPhasingInIntervalWalker.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/CountHetPhasingInIntervalWalker.java
@@ -24,8 +24,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhaseByTransmission.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhaseByTransmission.java
index 27d583b4a..ed5406b8b 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhaseByTransmission.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhaseByTransmission.java
@@ -1,23 +1,20 @@
package org.broadinstitute.sting.oneoffprojects.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
-import org.broadinstitute.sting.gatk.report.GATKReport;
-import org.broadinstitute.sting.gatk.report.GATKReportTable;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.MathUtils;
-import org.broadinstitute.sting.utils.QualityUtils;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhasingEval.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhasingEval.java
index 58d007cc2..4a1b51d4c 100644
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhasingEval.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/phasing/PhasingEval.java
@@ -24,8 +24,8 @@
package org.broadinstitute.sting.oneoffprojects.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
@@ -36,7 +36,7 @@ import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.phasing.ReadBackedPhasingWalker;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.Utils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.PrintStream;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/validation/PickSequenomProbes2.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/validation/PickSequenomProbes2.java
index 627b5d59b..045d442a9 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/validation/PickSequenomProbes2.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/validation/PickSequenomProbes2.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.oneoffprojects.walkers.validation;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/varianteval/PrivatePermutations.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/varianteval/PrivatePermutations.java
index 0b0b87981..b6af87637 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/varianteval/PrivatePermutations.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/varianteval/PrivatePermutations.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.oneoffprojects.walkers.varianteval;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/BootstrapCallsMerger.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/BootstrapCallsMerger.java
index 4d9de6eda..b8937d5dd 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/BootstrapCallsMerger.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/BootstrapCallsMerger.java
@@ -1,22 +1,19 @@
package org.broadinstitute.sting.oneoffprojects.walkers.vcftools;
import com.google.common.collect.ArrayListMultimap;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.gatk.walkers.TreeReducible;
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotator;
-import org.broadinstitute.sting.utils.GenomeLoc;
-import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
-import javax.management.NotificationBroadcaster;
import java.util.*;
/**
diff --git a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/FixRefBases.java b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/FixRefBases.java
index f0c4bbf10..933fc629d 100755
--- a/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/FixRefBases.java
+++ b/java/src/org/broadinstitute/sting/oneoffprojects/walkers/vcftools/FixRefBases.java
@@ -1,24 +1,23 @@
package org.broadinstitute.sting.oneoffprojects.walkers.vcftools;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Hidden;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.RMD;
import org.broadinstitute.sting.gatk.walkers.Requires;
import org.broadinstitute.sting.gatk.walkers.RodWalker;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.StingException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.exceptions.*;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/features/maf/MafFeature.java b/java/src/org/broadinstitute/sting/playground/gatk/features/maf/MafFeature.java
index e66f1c2b0..49d9713dd 100644
--- a/java/src/org/broadinstitute/sting/playground/gatk/features/maf/MafFeature.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/features/maf/MafFeature.java
@@ -26,10 +26,10 @@
package org.broadinstitute.sting.playground.gatk.features.maf;
import org.broad.tribble.Feature;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFConstants;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.VariantContextAdaptors;
import org.broadinstitute.sting.utils.exceptions.StingException;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/GenotypeAndValidateWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/GenotypeAndValidateWalker.java
index 9e768d166..437fed843 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/GenotypeAndValidateWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/GenotypeAndValidateWalker.java
@@ -25,16 +25,16 @@
package org.broadinstitute.sting.playground.gatk.walkers;
-import org.broad.tribble.util.variantcontext.MutableVariantContext;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.VCFHeader;
-import org.broad.tribble.vcf.VCFHeaderLine;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.variantcontext.MutableVariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeaderLine;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
@@ -44,7 +44,7 @@ import org.broadinstitute.sting.gatk.walkers.genotyper.UnifiedGenotyperEngine;
import org.broadinstitute.sting.gatk.walkers.genotyper.VariantCallContext;
import org.broadinstitute.sting.utils.SampleUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java
index 1a2025d0d..96d3d175a 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/LocusMismatchWalker.java
@@ -25,8 +25,8 @@
package org.broadinstitute.sting.playground.gatk.walkers;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java
index 12a5f372c..272e9ad26 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/SnpCallRateByCoverageWalker.java
@@ -26,8 +26,8 @@
package org.broadinstitute.sting.playground.gatk.walkers;
import net.sf.samtools.SAMRecord;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/ValidationGenotyper.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/ValidationGenotyper.java
index 08a74a431..94df8c69b 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/ValidationGenotyper.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/ValidationGenotyper.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.playground.gatk.walkers;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/diagnostics/SNPDensity.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/diagnostics/SNPDensity.java
index 06632766c..37745c003 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/diagnostics/SNPDensity.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/diagnostics/SNPDensity.java
@@ -25,7 +25,7 @@
package org.broadinstitute.sting.playground.gatk.walkers.diagnostics;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/PrintReferenceVariantsWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/PrintReferenceVariantsWalker.java
index 725bf140a..eeaa3ff41 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/PrintReferenceVariantsWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/PrintReferenceVariantsWalker.java
@@ -23,10 +23,10 @@
*/
package org.broadinstitute.sting.playground.gatk.walkers.phasing;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
@@ -34,7 +34,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.gatk.walkers.phasing.WriteVCF;
import org.broadinstitute.sting.utils.GenomeLoc;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/ReadBasedPhasingValidationWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/ReadBasedPhasingValidationWalker.java
index 698dceee8..b3136b54f 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/ReadBasedPhasingValidationWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/phasing/ReadBasedPhasingValidationWalker.java
@@ -25,9 +25,9 @@
package org.broadinstitute.sting.playground.gatk.walkers.phasing;
import org.broad.tribble.readers.AsciiLineReader;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/replication_validation/ReplicationValidationWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/replication_validation/ReplicationValidationWalker.java
index 489cfca8f..661f746f6 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/replication_validation/ReplicationValidationWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/replication_validation/ReplicationValidationWalker.java
@@ -1,8 +1,8 @@
package org.broadinstitute.sting.playground.gatk.walkers.replication_validation;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/DeclareValidityWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/DeclareValidityWalker.java
index 1ebdac489..95266d2e9 100644
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/DeclareValidityWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/DeclareValidityWalker.java
@@ -24,38 +24,18 @@
package org.broadinstitute.sting.playground.gatk.walkers.validation;
-import com.sun.tools.corba.se.idl.constExpr.Not;
-import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIConversion;
-import org.broad.tribble.Feature;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
-import org.broadinstitute.sting.commandline.ArgumentCollection;
-import org.broadinstitute.sting.gatk.arguments.GATKArgumentCollection;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
-import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
-import org.broadinstitute.sting.gatk.io.OutputTracker;
-import org.broadinstitute.sting.gatk.io.stubs.VCFWriterStub;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.walkers.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
-import org.broadinstitute.sting.gatk.walkers.DataSource;
-import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
-import org.broadinstitute.sting.utils.GenomeLoc;
-import org.broadinstitute.sting.utils.SampleUtils;
-import org.broadinstitute.sting.utils.bed.BedParser;
import org.broadinstitute.sting.utils.exceptions.UserException;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
-import javax.activation.*;
-import java.beans.VetoableChangeSupport;
-import java.io.PrintStream;
-import java.io.Writer;
-import java.security.KeyStore;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/RodSystemValidationWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/RodSystemValidationWalker.java
index ce73dfd8c..9e832fde6 100644
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/RodSystemValidationWalker.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/validation/RodSystemValidationWalker.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.playground.gatk.walkers.validation;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variantutils/CGVarToVCF.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variantutils/CGVarToVCF.java
index 0263937c8..51951e56c 100755
--- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/variantutils/CGVarToVCF.java
+++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/variantutils/CGVarToVCF.java
@@ -25,10 +25,10 @@
package org.broadinstitute.sting.playground.gatk.walkers.variantutils;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.codecs.vcf.*;
import org.broadinstitute.sting.commandline.Argument;
import org.broadinstitute.sting.commandline.Output;
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
diff --git a/java/src/org/broadinstitute/sting/playground/tools/SortROD.java b/java/src/org/broadinstitute/sting/playground/tools/SortROD.java
index 6acb98dab..0a659c010 100644
--- a/java/src/org/broadinstitute/sting/playground/tools/SortROD.java
+++ b/java/src/org/broadinstitute/sting/playground/tools/SortROD.java
@@ -28,15 +28,14 @@ package org.broadinstitute.sting.playground.tools;
import org.apache.log4j.BasicConfigurator;
import org.broad.tribble.FeatureCodec;
import org.broad.tribble.Feature;
-import org.broad.tribble.completegenomics.CGVarCodec;
+import org.broadinstitute.sting.utils.codecs.completegenomics.CGVarCodec;
import org.broad.tribble.readers.AsciiLineReader;
-import org.broad.tribble.soapsnp.SoapSNPCodec;
+import org.broadinstitute.sting.utils.codecs.soapsnp.SoapSNPCodec;
import org.broad.tribble.gelitext.GeliTextCodec;
import org.broad.tribble.dbsnp.DbSNPCodec;
import org.broad.tribble.bed.BEDCodec;
-import org.broad.tribble.vcf.VCFCodec;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFCodec;
import org.broadinstitute.sting.utils.exceptions.StingException;
-import org.broadinstitute.sting.utils.text.XReadLines;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.playground.gatk.features.maf.MafCodec;
diff --git a/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java b/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
index 0ac08b7f7..fe6758e76 100644
--- a/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
+++ b/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentDefinitionField.java
@@ -27,7 +27,7 @@ package org.broadinstitute.sting.queue.extensions.gatk;
import net.sf.samtools.BAMIndex;
import net.sf.samtools.SAMFileWriter;
import org.broad.tribble.Tribble;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import org.broadinstitute.sting.commandline.*;
import org.broadinstitute.sting.gatk.io.stubs.SAMFileWriterArgumentTypeDescriptor;
diff --git a/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentField.java b/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentField.java
index f035892ce..2da427d44 100644
--- a/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentField.java
+++ b/java/src/org/broadinstitute/sting/queue/extensions/gatk/ArgumentField.java
@@ -29,7 +29,7 @@ import net.sf.samtools.SAMFileWriter;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.broadinstitute.sting.gatk.filters.PlatformUnitFilterHelper;
-import org.broad.tribble.vcf.VCFWriter;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFWriter;
import java.io.File;
import java.io.InputStream;
diff --git a/java/src/org/broadinstitute/sting/utils/IndelUtils.java b/java/src/org/broadinstitute/sting/utils/IndelUtils.java
index 86363cba0..30e1a3f5b 100755
--- a/java/src/org/broadinstitute/sting/utils/IndelUtils.java
+++ b/java/src/org/broadinstitute/sting/utils/IndelUtils.java
@@ -1,6 +1,6 @@
package org.broadinstitute.sting.utils;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
diff --git a/java/src/org/broadinstitute/sting/utils/MendelianViolation.java b/java/src/org/broadinstitute/sting/utils/MendelianViolation.java
index dab1f51fd..a8089ffe8 100755
--- a/java/src/org/broadinstitute/sting/utils/MendelianViolation.java
+++ b/java/src/org/broadinstitute/sting/utils/MendelianViolation.java
@@ -1,7 +1,7 @@
package org.broadinstitute.sting.utils;
-import org.broad.tribble.util.variantcontext.Genotype;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.datasources.sample.Sample;
import org.broadinstitute.sting.utils.exceptions.UserException;
diff --git a/java/src/org/broadinstitute/sting/utils/SampleUtils.java b/java/src/org/broadinstitute/sting/utils/SampleUtils.java
index d15eb8e86..c0370064d 100755
--- a/java/src/org/broadinstitute/sting/utils/SampleUtils.java
+++ b/java/src/org/broadinstitute/sting/utils/SampleUtils.java
@@ -27,12 +27,12 @@ package org.broadinstitute.sting.utils;
import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMReadGroupRecord;
-import org.broad.tribble.vcf.VCFHeader;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFHeader;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.collections.Pair;
import org.broadinstitute.sting.utils.text.XReadLines;
-import org.broadinstitute.sting.utils.vcf.VCFUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFUtils;
import java.io.File;
import java.io.FileNotFoundException;
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/completegenomics/CGVarCodec.java b/java/src/org/broadinstitute/sting/utils/codecs/completegenomics/CGVarCodec.java
new file mode 100755
index 000000000..a286ce789
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/completegenomics/CGVarCodec.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.completegenomics;
+
+import org.broad.tribble.Feature;
+import org.broad.tribble.FeatureCodec;
+import org.broad.tribble.readers.LineReader;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * a codec for the VAR file types produced by the Complete Genomics Institute
+ */
+public class CGVarCodec implements FeatureCodec {
+
+ private static final String REF_TYPE = "ref";
+ private static final String SNP_TYPE = "snp";
+ private static final String DELETION_TYPE = "del";
+ private static final String INSERTION_TYPE = "ins";
+ private static final String SUBSTITUTION_TYPE = "sub";
+
+ // the minimum number of features in the CG file line
+ private static final int minimumFeatureCount = 8;
+
+ /**
+ * decode the location only
+ * @param line the input line to decode
+ * @return a HapMapFeature
+ */
+ public Feature decodeLoc(String line) {
+ return decode(line);
+ }
+
+ /**
+ * decode the CG record
+ * @param line the input line to decode
+ * @return a VariantContext
+ */
+ public Feature decode(String line) {
+ String[] array = line.split("\\s+");
+
+ // make sure the split was successful - that we got an appropriate number of fields
+ if ( array.length < minimumFeatureCount )
+ return null;
+
+ String type = array[6];
+
+ long start = Long.valueOf(array[4]);
+ long end;
+ Allele ref, alt = null;
+
+ //System.out.println(line);
+
+ if ( type.equals(SNP_TYPE) ) {
+ ref = Allele.create(array[7], true);
+ alt = Allele.create(array[8], false);
+ end = start;
+ } else if ( type.equals(INSERTION_TYPE) ) {
+ ref = Allele.create(Allele.NULL_ALLELE_STRING, true);
+ alt = Allele.create(array[7], false);
+ end = start;
+ } else if ( type.equals(DELETION_TYPE) ) {
+ ref = Allele.create(array[7], true);
+ alt = Allele.create(Allele.NULL_ALLELE_STRING, false);
+ end = start + ref.length();
+ //} else if ( type.equals(REF_TYPE) ) {
+ // ref = Allele.create("N", true); // ref bases aren't accurate
+ // start++;
+ // end = start;
+ //} else if ( type.equals(SUBSTITUTION_TYPE) ) {
+ // ref = Allele.create(array[7], true);
+ // alt = Allele.create(array[8], false);
+ // end = start + Math.max(ref.length(), alt.length());
+ } else {
+ return null; // we don't handle other types
+ }
+
+ HashSet alleles = new HashSet();
+ alleles.add(ref);
+ if ( alt != null )
+ alleles.add(alt);
+
+ HashMap attrs = new HashMap();
+ String id = array[array.length - 1];
+ if ( id.indexOf("dbsnp") != -1 ) {
+ attrs.put(VariantContext.ID_KEY, parseID(id));
+ }
+
+ // create a new feature given the array
+ return new VariantContext("CGI", array[3], start, end, alleles, VariantContext.NO_NEG_LOG_10PERROR, null, attrs);
+ }
+
+ public Class getFeatureType() {
+ return VariantContext.class;
+ }
+
+ // There's no spec and no character to distinguish header lines...
+ private final static int NUM_HEADER_LINES = 12;
+ public Object readHeader(LineReader reader) {
+ return null;
+
+ //String headerLine = null;
+ //try {
+ // for (int i = 0; i < NUM_HEADER_LINES; i++)
+ // headerLine = reader.readLine();
+ //} catch (IOException e) {
+ // throw new IllegalArgumentException("Unable to read a line from the line reader");
+ //}
+ //return headerLine;
+ }
+
+ private static final Pattern DBSNP_PATTERN = Pattern.compile("^dbsnp\\.\\d+:(.*)");
+ private String parseID(String raw) {
+ StringBuilder sb = null;
+
+ String[] ids = raw.split(";");
+ for ( String id : ids ) {
+ Matcher matcher = DBSNP_PATTERN.matcher(id);
+ if ( matcher.matches() ) {
+ String rsID = matcher.group(1);
+ if ( sb == null ) {
+ sb = new StringBuilder(rsID);
+ } else {
+ sb.append(";");
+ sb.append(rsID);
+ }
+ }
+ }
+
+ return sb == null ? null : sb.toString();
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapCodec.java b/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapCodec.java
new file mode 100644
index 000000000..bd95e0f3d
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapCodec.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.hapmap;
+
+import org.broad.tribble.Feature;
+import org.broad.tribble.FeatureCodec;
+import org.broad.tribble.annotation.Strand;
+import org.broad.tribble.readers.LineReader;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+/**
+ * a codec for the file types produced by the HapMap consortium, available on their website:
+ * http://hapmap.ncbi.nlm.nih.gov/downloads/genotypes/
+ *
+ * The format includes eleven standard fields, plus genotypes for each of the samples included
+ * in the file
+ *
+ */
+public class HapMapCodec implements FeatureCodec {
+ // the minimum number of features in the HapMap file line
+ private static final int minimumFeatureCount = 11;
+
+ private String headerLine;
+ /**
+ * decode the location only
+ * @param line the input line to decode
+ * @return a HapMapFeature
+ */
+ public Feature decodeLoc(String line) {
+ return decode(line);
+ }
+
+ /**
+ * decode the hapmap record
+ * @param line the input line to decode
+ * @return a HapMapFeature, with the given fields
+ */
+ public Feature decode(String line) {
+ String[] array = line.split("\\s+");
+
+ // make sure the split was successful - that we got an appropriate number of fields
+ if (array.length < minimumFeatureCount)
+ throw new IllegalArgumentException("Unable to parse line " + line + ", the length of split features is less than the minimum of " + minimumFeatureCount);
+
+ // create a new feature given the array
+ return new HapMapFeature(array[0],
+ array[1].split("/"),
+ array[2],
+ Long.valueOf(array[3]),
+ Strand.toStrand(array[4]),
+ array[5],
+ array[6],
+ array[7],
+ array[8],
+ array[9],
+ array[10],
+ Arrays.copyOfRange(array,11,array.length),
+ headerLine);
+ }
+
+ public Class getFeatureType() {
+ return HapMapFeature.class;
+ }
+
+ public Object readHeader(LineReader reader) {
+ try {
+ headerLine = reader.readLine();
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Unable to read a line from the line reader");
+ }
+ return headerLine;
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapFeature.java b/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapFeature.java
new file mode 100755
index 000000000..7a47a4b8d
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/hapmap/HapMapFeature.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.hapmap;
+
+import org.broad.tribble.Feature;
+import org.broad.tribble.annotation.Strand;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * a feature returned by the HapMap Codec - it represents contig, position, name,
+ * alleles, other hapmap information, and genotypes for specified samples
+ */
+public class HapMapFeature implements Feature {
+
+ public static final String INSERTION = "I";
+ public static final String DELETION = "D";
+
+ // the variables we store internally in the class
+ private final String name;
+ private final String[] alleles;
+ private Map actualAlleles = null;
+ private final String contig ;
+ private long position;
+ private final Strand strand;
+ private final String assembly;
+ private final String center;
+ private final String protLSID;
+ private final String assayLSID;
+ private final String panelLSID;
+ private final String qccode;
+ private final String[] genotypes;
+
+ // we store the header line, if they'd like to get the samples
+ private final String headerLine;
+
+ /**
+ * create a HapMap Feature, based on all the records available in the hapmap file
+ * @param contig the contig name
+ * @param position the position
+ * @param strand the strand enum
+ * @param assembly what assembly this feature is from
+ * @param center the center that provided this SNP
+ * @param protLSID ??
+ * @param assayLSID ??
+ * @param panelLSID ??
+ * @param qccode ??
+ * @param genotypes a list of strings, representing the genotypes for the list of samples
+ */
+ public HapMapFeature(String name,
+ String[] alleles,
+ String contig,
+ Long position,
+ Strand strand,
+ String assembly,
+ String center,
+ String protLSID,
+ String assayLSID,
+ String panelLSID,
+ String qccode,
+ String[] genotypes,
+ String headerLine) {
+ this.name = name;
+ this.alleles = alleles;
+ this.contig = contig;
+ this.position = position;
+ this.strand = strand;
+ this.assembly = assembly;
+ this.center = center;
+ this.protLSID = protLSID ;
+ this.assayLSID = assayLSID ;
+ this.panelLSID = panelLSID ;
+ this.qccode = qccode;
+ this.genotypes = genotypes;
+ this.headerLine = headerLine;
+ }
+
+ /**
+ * get the contig value
+ * @return a string representing the contig
+ */
+ public String getChr() {
+ return contig;
+ }
+
+ /**
+ * get the start position, as an integer
+ * @return an int, representing the start position
+ */
+ public int getStart() {
+ return (int)position;
+ }
+
+ /**
+ * get the end position
+ * @return get the end position as an int
+ */
+ public int getEnd() {
+ return (int)position;
+ }
+
+ /**
+ * Getter methods
+ */
+
+ public Strand getStrand() {
+ return strand;
+ }
+
+ public String getAssembly() {
+ return assembly;
+ }
+
+ public String getCenter() {
+ return center;
+ }
+
+ public String getProtLSID() {
+ return protLSID;
+ }
+
+ public String getAssayLSID() {
+ return assayLSID;
+ }
+
+ public String getPanelLSID() {
+ return panelLSID;
+ }
+
+ public String getQCCode() {
+ return qccode;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String[] getAlleles() {
+ return alleles;
+ }
+
+ public String[] getGenotypes() {
+ return genotypes;
+ }
+
+ // This is necessary because HapMap places insertions in the incorrect position
+ public void updatePosition(long position) {
+ this.position = position;
+ }
+
+ public void setActualAlleles(Map alleleMap) {
+ actualAlleles = new HashMap(alleleMap);
+ }
+
+ public Map getActualAlleles() {
+ return actualAlleles;
+ }
+
+ /**
+ * get a list of the samples from the header (in order)
+ * @return a string array of sample names
+ */
+ public String[] getSampleIDs() {
+ String[] header = headerLine.split("\\s+");
+ String[] sample_ids = new String[header.length-11];
+ for (int i = 11; i < header.length; i++)
+ sample_ids[i-11] = header[i];
+ return sample_ids;
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/soapsnp/SoapSNPCodec.java b/java/src/org/broadinstitute/sting/utils/codecs/soapsnp/SoapSNPCodec.java
new file mode 100755
index 000000000..618d9ce79
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/soapsnp/SoapSNPCodec.java
@@ -0,0 +1,209 @@
+package org.broadinstitute.sting.utils.codecs.soapsnp;
+
+import org.broad.tribble.Feature;
+import org.broad.tribble.FeatureCodec;
+import org.broad.tribble.NameAwareCodec;
+import org.broad.tribble.TribbleException;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broad.tribble.exception.CodecLineParsingException;
+import org.broad.tribble.readers.LineReader;
+
+import java.util.*;
+
+/**
+ * @author depristo
+ *
+ * a codec for parsing soapsnp files (see http://soap.genomics.org.cn/soapsnp.html#usage2)
+ *
+ *
+ * A simple text file format with the following whitespace separated fields:
+ *
+1) Chromosome ID
+2) Coordinate on chromosome, start from 1
+3) Reference genotype
+4) Consensus genotype
+5) Quality score of consensus genotype
+6) Best base
+7) Average quality score of best base
+8) Count of uniquely mapped best base
+9) Count of all mapped best base
+10) Second best bases
+11) Average quality score of second best base
+12) Count of uniquely mapped second best base
+13) Count of all mapped second best base
+14) Sequencing depth of the site
+15) Rank sum test p_value
+16) Average copy number of nearby region
+17) Whether the site is a dbSNP.
+ */
+public class SoapSNPCodec implements FeatureCodec, NameAwareCodec {
+ private String[] parts;
+
+ // we store a name to give to each of the variant contexts we emit
+ private String name = "Unknown";
+
+ public Feature decodeLoc(String line) {
+ return decode(line);
+ }
+
+ /**
+ * Decode a line as a Feature.
+ *
+ * @param line
+ *
+ * @return Return the Feature encoded by the line, or null if the line does not represent a feature (e.g. is
+ * a comment)
+ */
+ public Feature decode(String line) {
+ try {
+ // parse into lines
+ parts = line.trim().split("\\s+");
+
+ // check that we got the correct number of tokens in the split
+ if (parts.length != 18)
+ throw new CodecLineParsingException("Invalid SoapSNP row found -- incorrect element count. Expected 18, got " + parts.length + " line = " + line);
+
+ String contig = parts[0];
+ long start = Long.valueOf(parts[1]);
+ AlleleAndGenotype allelesAndGenotype = parseAlleles(parts[2], parts[3], line);
+
+ double negLog10PError = Integer.valueOf(parts[4]) / 10.0;
+
+ Map attributes = new HashMap();
+ attributes.put("BestBaseQ", parts[6]);
+ attributes.put("SecondBestBaseQ", parts[10]);
+ attributes.put("RankSumP", parts[15]);
+ // add info to keys
+
+ //System.out.printf("Alleles = " + allelesAndGenotype.alleles);
+ //System.out.printf("genotype = " + allelesAndGenotype.genotype);
+
+ VariantContext vc = new VariantContext(name, contig, start, start, allelesAndGenotype.alleles, allelesAndGenotype.genotype, negLog10PError, VariantContext.PASSES_FILTERS, attributes);
+
+ //System.out.printf("line = %s%n", line);
+ //System.out.printf("vc = %s%n", vc);
+
+ return vc;
+ } catch (CodecLineParsingException e) {
+ throw new TribbleException("Unable to parse line " + line,e);
+ } catch (NumberFormatException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ throw new TribbleException("Unable to parse line " + line,e);
+ }
+ }
+
+ private static class AlleleAndGenotype {
+ Collection alleles;
+ Collection genotype;
+
+ public AlleleAndGenotype(Collection alleles, Genotype genotype) {
+ this.alleles = alleles;
+ this.genotype = new HashSet();
+ this.genotype.add(genotype);
+ }
+ }
+
+ private AlleleAndGenotype parseAlleles(String ref, String consensusGenotype, String line) {
+ /* A Adenine
+ C Cytosine
+ G Guanine
+ T (or U) Thymine (or Uracil)
+ R A or G
+ Y C or T
+ S G or C
+ W A or T
+ K G or T
+ M A or C
+ B C or G or T
+ D A or G or T
+ H A or C or T
+ V A or C or G
+ N any base
+ . or - gap
+ */
+ if ( ref.equals(consensusGenotype) )
+ throw new TribbleException.InternalCodecException("Ref base and consensus genotype are the same " + ref);
+
+ Allele refAllele = Allele.create(ref, true);
+ List genotypeAlleles = null;
+
+ char base = consensusGenotype.charAt(0);
+
+ switch ( base ) {
+ case 'A': case 'C': case 'G': case 'T':
+ Allele a = Allele.create(consensusGenotype);
+ genotypeAlleles = Arrays.asList(a, a);
+ break;
+ case 'R': case 'Y': case 'S': case 'W': case 'K': case 'M':
+ genotypeAlleles = determineAlt(refAllele, ref.charAt(0), base);
+ break;
+ default:
+ throw new TribbleException("Unexpected consensus genotype " + consensusGenotype + " at line = " + line);
+ }
+
+
+ Collection alleles = new HashSet(genotypeAlleles);
+ alleles.add(refAllele);
+ Genotype genotype = new Genotype("unknown", genotypeAlleles); // todo -- probably should include genotype quality
+
+ return new AlleleAndGenotype( alleles, genotype );
+ }
+
+ private static final Map IUPAC_SNPS = new HashMap();
+ static {
+ IUPAC_SNPS.put('R', "AG");
+ IUPAC_SNPS.put('Y', "CT");
+ IUPAC_SNPS.put('S', "GC");
+ IUPAC_SNPS.put('W', "AT");
+ IUPAC_SNPS.put('K', "GT");
+ IUPAC_SNPS.put('M', "AC");
+ }
+
+ private List determineAlt(Allele ref, char refbase, char alt) {
+ String alts = IUPAC_SNPS.get(alt);
+ if ( alts == null )
+ throw new IllegalStateException("BUG: unexpected consensus genotype " + alt);
+
+ Allele a1 = alts.charAt(0) == refbase ? ref : Allele.create((byte)alts.charAt(0));
+ Allele a2 = alts.charAt(1) == refbase ? ref : Allele.create((byte)alts.charAt(1));
+
+ //if ( a1 != ref && a2 != ref )
+ // throw new IllegalStateException("BUG: unexpected consensus genotype " + alt + " does not contain the reference base " + ref);
+
+ return Arrays.asList(a1, a2);
+ }
+
+ /**
+ * @return VariantContext
+ */
+ public Class getFeatureType() {
+ return VariantContext.class;
+ }
+
+ public Object readHeader(LineReader reader) {
+
+ return null; // we don't have a meaningful header
+ }
+
+ /**
+ * get the name of this codec
+ * @return our set name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set the name of this codec
+ * @param name new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public static void main(String[] args) {
+ System.out.printf("Testing " + args[0]);
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/AbstractVCFCodec.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/AbstractVCFCodec.java
new file mode 100755
index 000000000..cd0f52c68
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/AbstractVCFCodec.java
@@ -0,0 +1,617 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.apache.log4j.Logger;
+import org.broad.tribble.Feature;
+import org.broad.tribble.FeatureCodec;
+import org.broad.tribble.NameAwareCodec;
+import org.broad.tribble.TribbleException;
+import org.broad.tribble.readers.LineReader;
+import org.broad.tribble.util.ParsingUtils;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+import java.util.*;
+
+
+public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec, VCFParser {
+
+ protected final static Logger log = Logger.getLogger(VCFCodec.class);
+ protected final static int NUM_STANDARD_FIELDS = 8; // INFO is the 8th column
+
+ protected VCFHeaderVersion version;
+
+ // we have to store the list of strings that make up the header until they're needed
+ protected VCFHeader header = null;
+
+ // a mapping of the allele
+ protected Map> alleleMap = new HashMap>(3);
+
+ // for ParsingUtils.split
+ protected String[] GTValueArray = new String[100];
+ protected String[] genotypeKeyArray = new String[100];
+ protected String[] infoValueArray = new String[1000];
+
+ // for performance testing purposes
+ public static boolean validate = true;
+
+ // a key optimization -- we need a per thread string parts array, so we don't allocate a big array over and over
+ // todo: make this thread safe?
+ protected String[] parts = null;
+ protected String[] genotypeParts = null;
+
+ // for performance we cache the hashmap of filter encodings for quick lookup
+ protected HashMap> filterHash = new HashMap>();
+
+ // a mapping of the VCF fields to their type, filter fields, and format fields, for quick lookup to validate against
+ TreeMap infoFields = new TreeMap();
+ TreeMap formatFields = new TreeMap();
+ Set filterFields = new HashSet();
+
+ // we store a name to give to each of the variant contexts we emit
+ protected String name = "Unknown";
+
+ protected int lineNo = 0;
+
+ protected Map stringCache = new HashMap();
+
+
+ /**
+ * @param reader the line reader to take header lines from
+ * @return the number of header lines
+ */
+ public abstract Object readHeader(LineReader reader);
+
+ /**
+ * create a genotype map
+ * @param str the string
+ * @param alleles the list of alleles
+ * @param chr chrom
+ * @param pos position
+ * @return a mapping of sample name to genotype object
+ */
+ public abstract Map createGenotypeMap(String str, List alleles, String chr, int pos);
+
+
+ /**
+ * parse the filter string, first checking to see if we already have parsed it in a previous attempt
+ * @param filterString the string to parse
+ * @return a set of the filters applied
+ */
+ protected abstract Set parseFilters(String filterString);
+
+ /**
+ * create a VCF header
+ * @param headerStrings a list of strings that represent all the ## entries
+ * @param line the single # line (column names)
+ * @return the count of header lines
+ */
+ protected Object createHeader(List headerStrings, String line) {
+
+ headerStrings.add(line);
+
+ Set metaData = new TreeSet();
+ Set auxTags = new LinkedHashSet();
+ // iterate over all the passed in strings
+ for ( String str : headerStrings ) {
+ if ( !str.startsWith(VCFHeader.METADATA_INDICATOR) ) {
+ String[] strings = str.substring(1).split(VCFConstants.FIELD_SEPARATOR);
+ int arrayIndex = 0;
+ for (VCFHeader.HEADER_FIELDS field : VCFHeader.HEADER_FIELDS.values()) {
+ try {
+ if (field != VCFHeader.HEADER_FIELDS.valueOf(strings[arrayIndex]))
+ throw new TribbleException.InvalidHeader("we were expecting column name '" + field + "' but we saw '" + strings[arrayIndex] + "'");
+ } catch (IllegalArgumentException e) {
+ throw new TribbleException.InvalidHeader("unknown column name '" + strings[arrayIndex] + "'; it does not match a legal column header name.");
+ }
+ arrayIndex++;
+ }
+ if ( arrayIndex < strings.length ) {
+ if ( !strings[arrayIndex].equals("FORMAT") )
+ throw new TribbleException.InvalidHeader("we were expecting column name 'FORMAT' but we saw '" + strings[arrayIndex] + "'");
+ arrayIndex++;
+ }
+
+ while (arrayIndex < strings.length)
+ auxTags.add(strings[arrayIndex++]);
+
+ } else {
+ if ( str.startsWith("##INFO=") ) {
+ VCFInfoHeaderLine info = new VCFInfoHeaderLine(str.substring(7),version);
+ metaData.add(info);
+ infoFields.put(info.getName(), info.getType());
+ } else if ( str.startsWith("##FILTER=") ) {
+ VCFFilterHeaderLine filter = new VCFFilterHeaderLine(str.substring(9),version);
+ metaData.add(filter);
+ filterFields.add(filter.getName());
+ } else if ( str.startsWith("##FORMAT=") ) {
+ VCFFormatHeaderLine format = new VCFFormatHeaderLine(str.substring(9),version);
+ metaData.add(format);
+ formatFields.put(format.getName(), format.getType());
+ } else {
+ int equals = str.indexOf("=");
+ if ( equals != -1 )
+ metaData.add(new VCFHeaderLine(str.substring(2, equals), str.substring(equals+1)));
+ }
+ }
+ }
+
+ header = new VCFHeader(metaData, auxTags);
+ return header;
+ }
+
+ /**
+ * the fast decode function
+ * @param line the line of text for the record
+ * @return a feature, (not guaranteed complete) that has the correct start and stop
+ */
+ public Feature decodeLoc(String line) {
+ return reallyDecode(line);
+ }
+
+ /**
+ * decode the line into a feature (VariantContext)
+ * @param line the line
+ * @return a VariantContext
+ */
+ public Feature decode(String line) {
+ return reallyDecode(line);
+ }
+
+ private Feature reallyDecode(String line) {
+ try {
+ // the same line reader is not used for parsing the header and parsing lines, if we see a #, we've seen a header line
+ if (line.startsWith(VCFHeader.HEADER_INDICATOR)) return null;
+
+ // our header cannot be null, we need the genotype sample names and counts
+ if (header == null) throw new IllegalStateException("VCF Header cannot be null when decoding a record");
+
+ if (parts == null)
+ parts = new String[Math.min(header.getColumnCount(), NUM_STANDARD_FIELDS+1)];
+
+ int nParts = ParsingUtils.split(line, parts, VCFConstants.FIELD_SEPARATOR_CHAR, true);
+
+ // if we have don't have a header, or we have a header with no genotyping data check that we have eight columns. Otherwise check that we have nine (normal colummns + genotyping data)
+ if (( (header == null || (header != null && !header.hasGenotypingData())) && nParts != NUM_STANDARD_FIELDS) ||
+ (header != null && header.hasGenotypingData() && nParts != (NUM_STANDARD_FIELDS + 1)) )
+ throw new IllegalArgumentException("There aren't enough columns for line " + line + " (we expected " + (header == null ? NUM_STANDARD_FIELDS : NUM_STANDARD_FIELDS + 1) +
+ " tokens, and saw " + nParts + " )");
+
+ return parseVCFLine(parts);
+ } catch (TribbleException e) {
+ throw new TribbleException.InvalidDecodeLine(e.getMessage(), line);
+ }
+ }
+
+ protected void generateException(String message) {
+ throw new TribbleException.InvalidDecodeLine(message, lineNo);
+ }
+
+ /**
+ * parse out the VCF line
+ *
+ * @param parts the parts split up
+ * @return a variant context object
+ */
+ private VariantContext parseVCFLine(String[] parts) {
+ // increment the line count
+ lineNo++;
+
+ // parse out the required fields
+ String contig = getCachedString(parts[0]);
+ long pos = Long.valueOf(parts[1]);
+ String id = null;
+ if ( parts[2].length() == 0 )
+ generateException("The VCF specification requires a valid ID field");
+ else if ( parts[2].equals(VCFConstants.EMPTY_ID_FIELD) )
+ id = VCFConstants.EMPTY_ID_FIELD;
+ else
+ id = new String(parts[2]);
+ String ref = getCachedString(parts[3].toUpperCase());
+ String alts = getCachedString(parts[4].toUpperCase());
+ Double qual = parseQual(parts[5]);
+ String filter = getCachedString(parts[6]);
+ String info = new String(parts[7]);
+
+ // get our alleles, filters, and setup an attribute map
+ List alleles = parseAlleles(ref, alts, lineNo);
+ Set filters = parseFilters(filter);
+ Map attributes = parseInfo(info, id);
+
+ // find out our current location, and clip the alleles down to their minimum length
+ long loc = pos;
+ // ref alleles don't need to be single bases for monomorphic sites
+ if ( alleles.size() == 1 ) {
+ loc = pos + alleles.get(0).length() - 1;
+ } else if ( !isSingleNucleotideEvent(alleles) ) {
+ ArrayList newAlleles = new ArrayList();
+ loc = clipAlleles(pos, ref, alleles, newAlleles);
+ alleles = newAlleles;
+ }
+
+ // do we have genotyping data
+ if (parts.length > NUM_STANDARD_FIELDS) {
+ attributes.put(VariantContext.UNPARSED_GENOTYPE_MAP_KEY, new String(parts[8]));
+ attributes.put(VariantContext.UNPARSED_GENOTYPE_PARSER_KEY, this);
+ }
+
+ VariantContext vc = null;
+ try {
+ vc = new VariantContext(name, contig, pos, loc, alleles, qual, filters, attributes);
+ } catch (Exception e) {
+ generateException(e.getMessage());
+ }
+
+ // did we resort the sample names? If so, we need to load the genotype data
+ if ( !header.samplesWereAlreadySorted() )
+ vc.getGenotypes();
+
+ // Trim bases of all alleles if necessary
+ return createVariantContextWithTrimmedAlleles(vc);
+ }
+
+ /**
+ *
+ * @return the type of record
+ */
+ public Class getFeatureType() {
+ return VariantContext.class;
+ }
+
+ /**
+ * get the name of this codec
+ * @return our set name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * set the name of this codec
+ * @param name new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Return a cached copy of the supplied string.
+ *
+ * @param str string
+ * @return interned string
+ */
+ protected String getCachedString(String str) {
+ String internedString = stringCache.get(str);
+ if ( internedString == null ) {
+ internedString = new String(str);
+ stringCache.put(internedString, internedString);
+ }
+ return internedString;
+ }
+
+ /**
+ * parse out the info fields
+ * @param infoField the fields
+ * @param id the indentifier
+ * @return a mapping of keys to objects
+ */
+ private Map parseInfo(String infoField, String id) {
+ Map attributes = new HashMap();
+
+ if ( infoField.length() == 0 )
+ generateException("The VCF specification requires a valid info field");
+
+ if ( !infoField.equals(VCFConstants.EMPTY_INFO_FIELD) ) {
+ int infoValueSplitSize = ParsingUtils.split(infoField, infoValueArray, VCFConstants.INFO_FIELD_SEPARATOR_CHAR);
+ for (int i = 0; i < infoValueSplitSize; i++) {
+ String key;
+ Object value;
+
+ int eqI = infoValueArray[i].indexOf("=");
+ if ( eqI != -1 ) {
+ key = infoValueArray[i].substring(0, eqI);
+ String str = infoValueArray[i].substring(eqI+1, infoValueArray[i].length());
+
+ // lets see if the string contains a , separator
+ if ( str.contains(",") )
+ value = Arrays.asList(str.split(","));
+ else
+ value = str;
+ } else {
+ key = infoValueArray[i];
+ value = true;
+ }
+
+ attributes.put(key, value);
+ }
+ }
+
+ attributes.put(VariantContext.ID_KEY, id);
+ return attributes;
+ }
+
+ /**
+ * create a an allele from an index and an array of alleles
+ * @param index the index
+ * @param alleles the alleles
+ * @return an Allele
+ */
+ protected static Allele oneAllele(String index, List alleles) {
+ if ( index.equals(VCFConstants.EMPTY_ALLELE) )
+ return Allele.NO_CALL;
+ int i = Integer.valueOf(index);
+ if ( i >= alleles.size() )
+ throw new TribbleException.InternalCodecException("The allele with index " + index + " is not defined in the REF/ALT columns in the record");
+ return alleles.get(i);
+ }
+
+
+ /**
+ * parse genotype alleles from the genotype string
+ * @param GT GT string
+ * @param alleles list of possible alleles
+ * @param cache cache of alleles for GT
+ * @return the allele list for the GT string
+ */
+ protected static List parseGenotypeAlleles(String GT, List alleles, Map> cache) {
+ // cache results [since they are immutable] and return a single object for each genotype
+ List GTAlleles = cache.get(GT);
+
+ if ( GTAlleles == null ) {
+ StringTokenizer st = new StringTokenizer(GT, VCFConstants.PHASING_TOKENS);
+ GTAlleles = new ArrayList(st.countTokens());
+ while ( st.hasMoreTokens() ) {
+ String genotype = st.nextToken();
+ GTAlleles.add(oneAllele(genotype, alleles));
+ }
+ cache.put(GT, GTAlleles);
+ }
+
+ return GTAlleles;
+ }
+
+ /**
+ * parse out the qual value
+ * @param qualString the quality string
+ * @return return a double
+ */
+ protected static Double parseQual(String qualString) {
+ // if we're the VCF 4 missing char, return immediately
+ if ( qualString.equals(VCFConstants.MISSING_VALUE_v4))
+ return VariantContext.NO_NEG_LOG_10PERROR;
+
+ Double val = Double.valueOf(qualString);
+
+ // check to see if they encoded the missing qual score in VCF 3 style, with either the -1 or -1.0. check for val < 0 to save some CPU cycles
+ if ((val < 0) && (Math.abs(val - VCFConstants.MISSING_QUALITY_v3_DOUBLE) < VCFConstants.VCF_ENCODING_EPSILON))
+ return VariantContext.NO_NEG_LOG_10PERROR;
+
+ // scale and return the value
+ return val / 10.0;
+ }
+
+ /**
+ * parse out the alleles
+ * @param ref the reference base
+ * @param alts a string of alternates to break into alleles
+ * @param lineNo the line number for this record
+ * @return a list of alleles, and a pair of the shortest and longest sequence
+ */
+ protected static List parseAlleles(String ref, String alts, int lineNo) {
+ List alleles = new ArrayList(2); // we are almost always biallelic
+ // ref
+ checkAllele(ref, true, lineNo);
+ Allele refAllele = Allele.create(ref, true);
+ alleles.add(refAllele);
+
+ if ( alts.indexOf(",") == -1 ) // only 1 alternatives, don't call string split
+ parseSingleAltAllele(alleles, alts, lineNo);
+ else
+ for ( String alt : alts.split(",") )
+ parseSingleAltAllele(alleles, alt, lineNo);
+
+ return alleles;
+ }
+
+ /**
+ * check to make sure the allele is an acceptable allele
+ * @param allele the allele to check
+ * @param isRef are we the reference allele?
+ * @param lineNo the line number for this record
+ */
+ private static void checkAllele(String allele, boolean isRef, int lineNo) {
+ if ( allele == null || allele.length() == 0 )
+ generateException("Empty alleles are not permitted in VCF records", lineNo);
+
+ if ( isSymbolicAllele(allele) ) {
+ if ( isRef ) {
+ generateException("Symbolic alleles not allowed as reference allele: " + allele, lineNo);
+ }
+ } else {
+ // check for VCF3 insertions or deletions
+ if ( (allele.charAt(0) == VCFConstants.DELETION_ALLELE_v3) || (allele.charAt(0) == VCFConstants.INSERTION_ALLELE_v3) )
+ generateException("Insertions/Deletions are not supported when reading 3.x VCF's. Please" +
+ " convert your file to VCF4 using VCFTools, available at http://vcftools.sourceforge.net/index.html", lineNo);
+
+ if (!Allele.acceptableAlleleBases(allele))
+ generateException("Unparsable vcf record with allele " + allele, lineNo);
+
+ if ( isRef && allele.equals(VCFConstants.EMPTY_ALLELE) )
+ generateException("The reference allele cannot be missing", lineNo);
+ }
+ }
+
+ /**
+ * return true if this is a symbolic allele (e.g. ) otherwise false
+ * @param allele the allele to check
+ * @return true if the allele is a symbolic allele, otherwise false
+ */
+ private static boolean isSymbolicAllele(String allele) {
+ return (allele != null && allele.startsWith("<") && allele.endsWith(">") && allele.length() > 2);
+ }
+
+ /**
+ * parse a single allele, given the allele list
+ * @param alleles the alleles available
+ * @param alt the allele to parse
+ * @param lineNo the line number for this record
+ */
+ private static void parseSingleAltAllele(List alleles, String alt, int lineNo) {
+ checkAllele(alt, false, lineNo);
+
+ Allele allele = Allele.create(alt, false);
+ if ( ! allele.isNoCall() )
+ alleles.add(allele);
+ }
+
+ protected static boolean isSingleNucleotideEvent(List alleles) {
+ for ( Allele a : alleles ) {
+ if ( a.length() != 1 )
+ return false;
+ }
+ return true;
+ }
+
+ private static void generateException(String message, int lineNo) {
+ throw new TribbleException.InvalidDecodeLine(message, lineNo);
+ }
+
+ private static int computeForwardClipping(List unclippedAlleles, String ref) {
+ boolean clipping = true;
+ // Note that the computation of forward clipping here is meant only to see whether there is a common
+ // base to all alleles, and to correctly compute reverse clipping,
+ // but it is not used for actually changing alleles - this is done in function
+ // createVariantContextWithTrimmedAlleles() below.
+
+ for (Allele a : unclippedAlleles) {
+ if (a.isSymbolic()) {
+ continue;
+ }
+ if (a.length() < 1 || (a.getBases()[0] != ref.getBytes()[0])) {
+ clipping = false;
+ }
+ }
+ return (clipping) ? 1 : 0;
+
+ }
+
+ /**
+ * clip the alleles, based on the reference
+ *
+ * @param position the unadjusted start position (pre-clipping)
+ * @param ref the reference string
+ * @param unclippedAlleles the list of unclipped alleles
+ * @param clippedAlleles output list of clipped alleles
+ * @return a list of alleles, clipped to the reference
+ */
+ protected static long clipAlleles(long position, String ref, List unclippedAlleles, List clippedAlleles) {
+
+ // Note that the computation of forward clipping here is meant only to see whether there is a common
+ // base to all alleles, and to correctly compute reverse clipping,
+ // but it is not used for actually changing alleles - this is done in function
+ // createVariantContextWithTrimmedAlleles() below.
+
+ int forwardClipping = computeForwardClipping(unclippedAlleles, ref);
+
+ int reverseClipped = 0;
+ boolean clipping = true;
+ while (clipping) {
+ for (Allele a : unclippedAlleles) {
+ if (a.isSymbolic()) {
+ continue;
+ }
+ if (a.length() - reverseClipped <= forwardClipping || a.length() - forwardClipping == 0)
+ clipping = false;
+ else if (a.getBases()[a.length()-reverseClipped-1] != ref.getBytes()[ref.length()-reverseClipped-1])
+ clipping = false;
+ }
+ if (clipping) reverseClipped++;
+ }
+
+ for (Allele a : unclippedAlleles) {
+ if (a.isSymbolic()) {
+ clippedAlleles.add(a);
+ } else {
+ clippedAlleles.add(Allele.create(Arrays.copyOfRange(a.getBases(),0,a.getBases().length-reverseClipped),a.isReference()));
+ }
+ }
+
+ // the new reference length
+ int refLength = ref.length() - reverseClipped;
+
+ return position+Math.max(refLength - 1,0);
+ }
+
+ public static VariantContext createVariantContextWithTrimmedAlleles(VariantContext inputVC) {
+ // see if we need to trim common reference base from all alleles
+ boolean trimVC;
+
+ // We need to trim common reference base from all alleles in all genotypes if a ref base is common to all alleles
+ Allele refAllele = inputVC.getReference();
+ if (!inputVC.isVariant())
+ trimVC = false;
+ else if (refAllele.isNull())
+ trimVC = false;
+ else {
+ trimVC = (computeForwardClipping(new ArrayList(inputVC.getAlternateAlleles()),
+ inputVC.getReference().getDisplayString()) > 0);
+ }
+
+ // nothing to do if we don't need to trim bases
+ if (trimVC) {
+ List alleles = new ArrayList();
+ Map genotypes = new TreeMap();
+
+ // set the reference base for indels in the attributes
+ Map attributes = new TreeMap(inputVC.getAttributes());
+ attributes.put(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY, new Byte(inputVC.getReference().getBases()[0]));
+
+ Map originalToTrimmedAlleleMap = new HashMap();
+
+ for (Allele a : inputVC.getAlleles()) {
+ if (a.isSymbolic()) {
+ alleles.add(a);
+ originalToTrimmedAlleleMap.put(a, a);
+ } else {
+ // get bases for current allele and create a new one with trimmed bases
+ byte[] newBases = Arrays.copyOfRange(a.getBases(), 1, a.length());
+ Allele trimmedAllele = Allele.create(newBases, a.isReference());
+ alleles.add(trimmedAllele);
+ originalToTrimmedAlleleMap.put(a, trimmedAllele);
+ }
+ }
+
+ // detect case where we're trimming bases but resulting vc doesn't have any null allele. In that case, we keep original representation
+ // example: mixed records such as {TA*,TGA,TG}
+ boolean hasNullAlleles = false;
+
+ for (Allele a: originalToTrimmedAlleleMap.values()) {
+ if (a.isNull())
+ hasNullAlleles = true;
+ if (a.isReference())
+ refAllele = a;
+ }
+
+ if (!hasNullAlleles)
+ return inputVC;
+ // now we can recreate new genotypes with trimmed alleles
+ for ( Map.Entry sample : inputVC.getGenotypes().entrySet() ) {
+
+ List originalAlleles = sample.getValue().getAlleles();
+ List trimmedAlleles = new ArrayList();
+ for ( Allele a : originalAlleles ) {
+ if ( a.isCalled() )
+ trimmedAlleles.add(originalToTrimmedAlleleMap.get(a));
+ else
+ trimmedAlleles.add(Allele.NO_CALL);
+ }
+ genotypes.put(sample.getKey(), Genotype.modifyAlleles(sample.getValue(), trimmedAlleles));
+
+ }
+ return new VariantContext(inputVC.getSource(), inputVC.getChr(), inputVC.getStart(), inputVC.getEnd(), alleles, genotypes, inputVC.getNegLog10PError(), inputVC.filtersWereApplied() ? inputVC.getFilters() : null, attributes);
+
+ }
+
+ return inputVC;
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/ManualSortingVCFWriter.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/ManualSortingVCFWriter.java
new file mode 100755
index 000000000..7dcdab924
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/ManualSortingVCFWriter.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+/**
+ * this class writes VCF files, allowing records to be passed in unsorted.
+ */
+public class ManualSortingVCFWriter extends SortingVCFWriterBase {
+
+ /**
+ * create a local-sorting VCF writer, given an inner VCF writer to write to
+ *
+ * @param innerWriter the VCFWriter to write to
+ * @param takeOwnershipOfInner Should this Writer close innerWriter when it's done with it
+ */
+ public ManualSortingVCFWriter(VCFWriter innerWriter, boolean takeOwnershipOfInner) {
+ super(innerWriter, takeOwnershipOfInner);
+ }
+
+ public ManualSortingVCFWriter(VCFWriter innerWriter) {
+ super(innerWriter);
+ }
+
+ // Note that if mostUpstreamWritableLoc = null, then ALL records will be emitted (since not currently waiting for anything)
+ public void setmostUpstreamWritableLocus(Integer mostUpstreamWritableLoc) {
+ this.mostUpstreamWritableLoc = mostUpstreamWritableLoc;
+ emitSafeRecords();
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriter.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriter.java
new file mode 100755
index 000000000..7ece5edf8
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriter.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+/**
+ * this class writes VCF files, allowing records to be passed in unsorted (up to a certain genomic distance away)
+ */
+public class SortingVCFWriter extends SortingVCFWriterBase {
+
+ // the maximum START distance between records that we'll cache
+ private int maxCachingStartDistance;
+
+ /**
+ * create a local-sorting VCF writer, given an inner VCF writer to write to
+ *
+ * @param innerWriter the VCFWriter to write to
+ * @param maxCachingStartDistance the maximum start distance between records that we'll cache
+ * @param takeOwnershipOfInner Should this Writer close innerWriter when it's done with it
+ */
+ public SortingVCFWriter(VCFWriter innerWriter, int maxCachingStartDistance, boolean takeOwnershipOfInner) {
+ super(innerWriter, takeOwnershipOfInner);
+ this.maxCachingStartDistance = maxCachingStartDistance;
+ }
+
+ public SortingVCFWriter(VCFWriter innerWriter, int maxCachingStartDistance) {
+ this(innerWriter, maxCachingStartDistance, false); // by default, don't own inner
+ }
+
+ protected void noteCurrentRecord(VariantContext vc) {
+ super.noteCurrentRecord(vc); // first, check for errors
+
+ // then, update mostUpstreamWritableLoc:
+ int mostUpstreamWritableIndex = vc.getStart() - maxCachingStartDistance;
+ this.mostUpstreamWritableLoc = Math.max(BEFORE_MOST_UPSTREAM_LOC, mostUpstreamWritableIndex);
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriterBase.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriterBase.java
new file mode 100755
index 000000000..311aaecf7
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/SortingVCFWriterBase.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2010.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+import java.util.Comparator;
+import java.util.PriorityQueue;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * This class writes VCF files, allowing records to be passed in unsorted.
+ * It also enforces that it is never passed records of the same chromosome with any other chromosome in between them.
+ */
+public abstract class SortingVCFWriterBase implements VCFWriter {
+
+ // The VCFWriter to which to actually write the sorted VCF records
+ private VCFWriter innerWriter = null;
+
+ // the current queue of un-emitted records
+ private PriorityQueue queue = null;
+
+ // The locus until which we are permitted to write out (inclusive)
+ protected Integer mostUpstreamWritableLoc;
+ protected static final int BEFORE_MOST_UPSTREAM_LOC = 0; // No real locus index is <= 0
+
+ // The set of chromosomes already passed over and to which it is forbidden to return
+ private Set finishedChromosomes = null;
+
+ // Should we call innerWriter.close() in close()
+ private boolean takeOwnershipOfInner;
+
+ /**
+ * create a local-sorting VCF writer, given an inner VCF writer to write to
+ *
+ * @param innerWriter the VCFWriter to write to
+ * @param takeOwnershipOfInner Should this Writer close innerWriter when it's done with it
+ */
+ public SortingVCFWriterBase(VCFWriter innerWriter, boolean takeOwnershipOfInner) {
+ this.innerWriter = innerWriter;
+ this.queue = new PriorityQueue(50, new VariantContextComparator());
+ this.mostUpstreamWritableLoc = BEFORE_MOST_UPSTREAM_LOC;
+ this.finishedChromosomes = new TreeSet();
+ this.takeOwnershipOfInner = takeOwnershipOfInner;
+ }
+
+ public SortingVCFWriterBase(VCFWriter innerWriter) {
+ this(innerWriter, false); // by default, don't own inner
+ }
+
+ public void writeHeader(VCFHeader header) {
+ innerWriter.writeHeader(header);
+ }
+
+ /**
+ * attempt to close the VCF file; we need to flush the queue first
+ */
+ public void close() {
+ stopWaitingToSort();
+
+ if (takeOwnershipOfInner)
+ innerWriter.close();
+ }
+
+ private void stopWaitingToSort() {
+ emitRecords(true);
+ mostUpstreamWritableLoc = BEFORE_MOST_UPSTREAM_LOC;
+ }
+
+ protected void emitSafeRecords() {
+ emitRecords(false);
+ }
+
+ protected void noteCurrentRecord(VariantContext vc) {
+ // did the user break the contract by giving a record too late?
+ if (mostUpstreamWritableLoc != null && vc.getStart() < mostUpstreamWritableLoc) // went too far back, since may have already written anything that is <= mostUpstreamWritableLoc
+ throw new IllegalArgumentException("Permitted to write any record upstream of position " + mostUpstreamWritableLoc + ", but a record at " + vc.getChr() + ":" + vc.getStart() + " was just added.");
+ }
+
+ /**
+ * add a record to the file
+ *
+ * @param vc the Variant Context object
+ * @param refBase the ref base
+ */
+ public void add(VariantContext vc, byte refBase) {
+ /* Note that the code below does not prevent the successive add()-ing of: (chr1, 10), (chr20, 200), (chr15, 100)
+ since there is no implicit ordering of chromosomes:
+ */
+ VCFRecord firstRec = queue.peek();
+ if (firstRec != null && !vc.getChr().equals(firstRec.vc.getChr())) { // if we hit a new contig, flush the queue
+ if (finishedChromosomes.contains(vc.getChr()))
+ throw new IllegalArgumentException("Added a record at " + vc.getChr() + ":" + vc.getStart() + ", but already finished with chromosome" + vc.getChr());
+
+ finishedChromosomes.add(firstRec.vc.getChr());
+ stopWaitingToSort();
+ }
+
+ noteCurrentRecord(vc); // possibly overwritten
+
+ queue.add(new VCFRecord(vc, refBase));
+ emitSafeRecords();
+ }
+
+ private void emitRecords(boolean emitUnsafe) {
+ while (!queue.isEmpty()) {
+ VCFRecord firstRec = queue.peek();
+
+ // No need to wait, waiting for nothing, or before what we're waiting for:
+ if (emitUnsafe || mostUpstreamWritableLoc == null || firstRec.vc.getStart() <= mostUpstreamWritableLoc) {
+ queue.poll();
+ innerWriter.add(firstRec.vc, firstRec.refBase);
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ /**
+ * Gets a string representation of this object.
+ * @return
+ */
+ @Override
+ public String toString() {
+ return getClass().getName();
+ }
+
+ private static class VariantContextComparator implements Comparator {
+ public int compare(VCFRecord r1, VCFRecord r2) {
+ return r1.vc.getStart() - r2.vc.getStart();
+ }
+ }
+
+ private static class VCFRecord {
+ public VariantContext vc;
+ public byte refBase;
+
+ public VCFRecord(VariantContext vc, byte refBase) {
+ this.vc = vc;
+ this.refBase = refBase;
+ }
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/StandardVCFWriter.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/StandardVCFWriter.java
new file mode 100755
index 000000000..31251c089
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/StandardVCFWriter.java
@@ -0,0 +1,529 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broad.tribble.Tribble;
+import org.broad.tribble.TribbleException;
+import org.broad.tribble.index.DynamicIndexCreator;
+import org.broad.tribble.index.Index;
+import org.broad.tribble.index.IndexFactory;
+import org.broad.tribble.util.LittleEndianOutputStream;
+import org.broad.tribble.util.ParsingUtils;
+import org.broad.tribble.util.PositionalStream;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+
+import java.io.*;
+import java.util.*;
+import java.lang.reflect.Array;
+
+/**
+ * this class writes VCF files
+ */
+public class StandardVCFWriter implements VCFWriter {
+
+ // the VCF header we're storing
+ protected VCFHeader mHeader = null;
+
+ // the print stream we're writing to
+ protected BufferedWriter mWriter;
+ protected PositionalStream positionalStream = null;
+
+ // were filters applied?
+ protected boolean filtersWereAppliedToContext = false;
+
+ // should we write genotypes or just sites?
+ protected boolean doNotWriteGenotypes = false;
+
+ protected DynamicIndexCreator indexer = null;
+ protected File indexFile = null;
+ LittleEndianOutputStream idxStream = null;
+ File location = null;
+
+ /**
+ * create a VCF writer, given a file to write to
+ *
+ * @param location the file location to write to
+ */
+ public StandardVCFWriter(File location) {
+ this(location, openOutputStream(location), true, false);
+ }
+
+ public StandardVCFWriter(File location, boolean enableOnTheFlyIndexing) {
+ this(location, openOutputStream(location), enableOnTheFlyIndexing, false);
+ }
+
+ /**
+ * create a VCF writer, given a stream to write to
+ *
+ * @param output the file location to write to
+ */
+ public StandardVCFWriter(OutputStream output) {
+ this(output, false);
+ }
+
+ /**
+ * create a VCF writer, given a stream to write to
+ *
+ * @param output the file location to write to
+ * @param doNotWriteGenotypes do not write genotypes
+ */
+ public StandardVCFWriter(OutputStream output, boolean doNotWriteGenotypes) {
+ mWriter = new BufferedWriter(new OutputStreamWriter(output));
+ this.doNotWriteGenotypes = doNotWriteGenotypes;
+ }
+
+ public StandardVCFWriter(File location, OutputStream output, boolean enableOnTheFlyIndexing, boolean doNotWriteGenotypes) {
+ this.location = location;
+
+ if ( enableOnTheFlyIndexing ) {
+ indexFile = Tribble.indexFile(location);
+ try {
+ idxStream = new LittleEndianOutputStream(new FileOutputStream(indexFile));
+ //System.out.println("Creating index on the fly for " + location);
+ indexer = new DynamicIndexCreator(IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME);
+ indexer.initialize(location, indexer.defaultBinSize());
+ positionalStream = new PositionalStream(output);
+ output = positionalStream;
+ } catch ( IOException ex ) {
+ // No matter what we keep going, since we don't care if we can't create the index file
+ }
+ }
+
+ //mWriter = new BufferedWriter(new OutputStreamWriter(new PositionalStream(output)));
+ mWriter = new BufferedWriter(new OutputStreamWriter(output));
+ this.doNotWriteGenotypes = doNotWriteGenotypes;
+ }
+
+ public void writeHeader(VCFHeader header) {
+ mHeader = doNotWriteGenotypes ? new VCFHeader(header.getMetaData()) : header;
+
+ try {
+ // the file format field needs to be written first
+ mWriter.write(VCFHeader.METADATA_INDICATOR + VCFHeaderVersion.VCF4_0.getFormatString() + "=" + VCFHeaderVersion.VCF4_0.getVersionString() + "\n");
+
+ for ( VCFHeaderLine line : mHeader.getMetaData() ) {
+ if ( line.getKey().equals(VCFHeaderVersion.VCF4_0.getFormatString()) ||
+ line.getKey().equals(VCFHeaderVersion.VCF3_3.getFormatString()) ||
+ line.getKey().equals(VCFHeaderVersion.VCF3_2.getFormatString()) )
+ continue;
+
+ // are the records filtered (so we know what to put in the FILTER column of passing records) ?
+ if ( line instanceof VCFFilterHeaderLine)
+ filtersWereAppliedToContext = true;
+
+ mWriter.write(VCFHeader.METADATA_INDICATOR);
+ mWriter.write(line.toString());
+ mWriter.write("\n");
+ }
+
+ // write out the column line
+ mWriter.write(VCFHeader.HEADER_INDICATOR);
+ for ( VCFHeader.HEADER_FIELDS field : mHeader.getHeaderFields() ) {
+ mWriter.write(field.toString());
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+ }
+
+ if ( mHeader.hasGenotypingData() ) {
+ mWriter.write("FORMAT");
+ for ( String sample : mHeader.getGenotypeSamples() ) {
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+ mWriter.write(sample);
+ }
+ }
+
+ mWriter.write("\n");
+ mWriter.flush(); // necessary so that writing to an output stream will work
+ }
+ catch (IOException e) {
+ throw new TribbleException("IOException writing the VCF header to " + locationString(), e);
+ }
+ }
+
+ private String locationString() {
+ return location == null ? mWriter.toString() : location.getAbsolutePath();
+ }
+
+ /**
+ * attempt to close the VCF file
+ */
+ public void close() {
+ // try to close the vcf stream
+ try {
+ mWriter.flush();
+ mWriter.close();
+ } catch (IOException e) {
+ throw new TribbleException("Unable to close " + locationString() + " because of " + e.getMessage());
+ }
+
+ // try to close the index stream (keep it separate to help debugging efforts)
+ if ( indexer != null ) {
+ try {
+ Index index = indexer.finalizeIndex(positionalStream.getPosition());
+ index.write(idxStream);
+ idxStream.close();
+ } catch (IOException e) {
+ throw new TribbleException("Unable to close index for " + locationString() + " because of " + e.getMessage());
+ }
+ }
+ }
+
+ protected static OutputStream openOutputStream(File location) {
+ try {
+ return new FileOutputStream(location);
+ } catch (FileNotFoundException e) {
+ throw new TribbleException("Unable to create VCF file at location: " + location);
+ }
+ }
+
+ /**
+ * add a record to the file
+ *
+ * @param vc the Variant Context object
+ * @param refBase the ref base used for indels
+ */
+ public void add(VariantContext vc, byte refBase) {
+ add(vc, refBase, false);
+ }
+
+ /**
+ * add a record to the file
+ *
+ * @param vc the Variant Context object
+ * @param refBase the ref base used for indels
+ * @param refBaseShouldBeAppliedToEndOfAlleles *** THIS SHOULD BE FALSE EXCEPT FOR AN INDEL AT THE EXTREME BEGINNING OF A CONTIG (WHERE THERE IS NO PREVIOUS BASE, SO WE USE THE BASE AFTER THE EVENT INSTEAD)
+ */
+ public void add(VariantContext vc, byte refBase, boolean refBaseShouldBeAppliedToEndOfAlleles) {
+ if ( mHeader == null )
+ throw new IllegalStateException("The VCF Header must be written before records can be added: " + locationString());
+
+ if ( doNotWriteGenotypes )
+ vc = VariantContext.modifyGenotypes(vc, null);
+
+ try {
+ vc = VariantContext.createVariantContextWithPaddedAlleles(vc, refBase, refBaseShouldBeAppliedToEndOfAlleles);
+
+ // if we are doing on the fly indexing, add the record ***before*** we write any bytes
+ if ( indexer != null ) indexer.addFeature(vc, positionalStream.getPosition());
+
+ Map alleleMap = new HashMap(vc.getAlleles().size());
+ alleleMap.put(Allele.NO_CALL, VCFConstants.EMPTY_ALLELE); // convenience for lookup
+
+ // CHROM
+ mWriter.write(vc.getChr());
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // POS
+ mWriter.write(String.valueOf(vc.getStart()));
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // ID
+ String ID = vc.hasID() ? vc.getID() : VCFConstants.EMPTY_ID_FIELD;
+ mWriter.write(ID);
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // REF
+ alleleMap.put(vc.getReference(), "0");
+ String refString = vc.getReference().getDisplayString();
+ mWriter.write(refString);
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // ALT
+ if ( vc.isVariant() ) {
+ Allele altAllele = vc.getAlternateAllele(0);
+ alleleMap.put(altAllele, "1");
+ String alt = altAllele.getDisplayString();
+ mWriter.write(alt);
+
+ for (int i = 1; i < vc.getAlternateAlleles().size(); i++) {
+ altAllele = vc.getAlternateAllele(i);
+ alleleMap.put(altAllele, String.valueOf(i+1));
+ alt = altAllele.getDisplayString();
+ mWriter.write(",");
+ mWriter.write(alt);
+ }
+ } else {
+ mWriter.write(VCFConstants.EMPTY_ALTERNATE_ALLELE_FIELD);
+ }
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // QUAL
+ if ( !vc.hasNegLog10PError() )
+ mWriter.write(VCFConstants.MISSING_VALUE_v4);
+ else
+ mWriter.write(getQualValue(vc.getPhredScaledQual()));
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // FILTER
+ String filters = vc.isFiltered() ? ParsingUtils.join(";", ParsingUtils.sortList(vc.getFilters())) : (filtersWereAppliedToContext || vc.filtersWereApplied() ? VCFConstants.PASSES_FILTERS_v4 : VCFConstants.UNFILTERED);
+ mWriter.write(filters);
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ // INFO
+ Map infoFields = new TreeMap();
+ for ( Map.Entry field : vc.getAttributes().entrySet() ) {
+ String key = field.getKey();
+ if ( key.equals(VariantContext.ID_KEY) || key.equals(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY) || key.equals(VariantContext.UNPARSED_GENOTYPE_MAP_KEY) || key.equals(VariantContext.UNPARSED_GENOTYPE_PARSER_KEY) )
+ continue;
+
+ String outputValue = formatVCFField(field.getValue());
+ if ( outputValue != null )
+ infoFields.put(key, outputValue);
+ }
+ writeInfoString(infoFields);
+
+ // FORMAT
+ if ( vc.hasAttribute(VariantContext.UNPARSED_GENOTYPE_MAP_KEY) ) {
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+ mWriter.write(vc.getAttributeAsString(VariantContext.UNPARSED_GENOTYPE_MAP_KEY, ""));
+ } else {
+ List genotypeAttributeKeys = new ArrayList();
+ if ( vc.hasGenotypes() ) {
+ genotypeAttributeKeys.add(VCFConstants.GENOTYPE_KEY);
+ for ( String key : calcVCFGenotypeKeys(vc) ) {
+ genotypeAttributeKeys.add(key);
+ }
+ } else if ( mHeader.hasGenotypingData() ) {
+ // this needs to be done in case all samples are no-calls
+ genotypeAttributeKeys.add(VCFConstants.GENOTYPE_KEY);
+ }
+
+ if ( genotypeAttributeKeys.size() > 0 ) {
+ String genotypeFormatString = ParsingUtils.join(VCFConstants.GENOTYPE_FIELD_SEPARATOR, genotypeAttributeKeys);
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+ mWriter.write(genotypeFormatString);
+
+ addGenotypeData(vc, alleleMap, genotypeAttributeKeys);
+ }
+ }
+
+ mWriter.write("\n");
+ mWriter.flush(); // necessary so that writing to an output stream will work
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to write the VCF object to " + locationString());
+ }
+
+ }
+
+ private String getQualValue(double qual) {
+ String s = String.format(VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, qual);
+ if ( s.endsWith(VCFConstants.DOUBLE_PRECISION_INT_SUFFIX) )
+ s = s.substring(0, s.length() - VCFConstants.DOUBLE_PRECISION_INT_SUFFIX.length());
+ return s;
+ }
+
+ /**
+ * create the info string; assumes that no values are null
+ *
+ * @param infoFields a map of info fields
+ * @throws IOException for writer
+ */
+ private void writeInfoString(Map infoFields) throws IOException {
+ if ( infoFields.isEmpty() ) {
+ mWriter.write(VCFConstants.EMPTY_INFO_FIELD);
+ return;
+ }
+
+ boolean isFirst = true;
+ for ( Map.Entry entry : infoFields.entrySet() ) {
+ if ( isFirst )
+ isFirst = false;
+ else
+ mWriter.write(VCFConstants.INFO_FIELD_SEPARATOR);
+
+ String key = entry.getKey();
+ mWriter.write(key);
+
+ if ( !entry.getValue().equals("") ) {
+ int numVals = 1;
+ VCFInfoHeaderLine metaData = mHeader.getInfoHeaderLine(key);
+ if ( metaData != null )
+ numVals = metaData.getCount();
+
+ // take care of unbounded encoding
+ if ( numVals == VCFInfoHeaderLine.UNBOUNDED )
+ numVals = 1;
+
+ if ( numVals > 0 ) {
+ mWriter.write("=");
+ mWriter.write(entry.getValue());
+ }
+ }
+ }
+ }
+
+ /**
+ * add the genotype data
+ *
+ * @param vc the variant context
+ * @param genotypeFormatKeys Genotype formatting string
+ * @param alleleMap alleles for this context
+ * @throws IOException for writer
+ */
+ private void addGenotypeData(VariantContext vc, Map alleleMap, List genotypeFormatKeys)
+ throws IOException {
+
+ for ( String sample : mHeader.getGenotypeSamples() ) {
+ mWriter.write(VCFConstants.FIELD_SEPARATOR);
+
+ Genotype g = vc.getGenotype(sample);
+ if ( g == null ) {
+ // TODO -- The VariantContext needs to know what the general ploidy is of the samples
+ // TODO -- We shouldn't be assuming diploid genotypes here!
+ mWriter.write(VCFConstants.EMPTY_GENOTYPE);
+ continue;
+ }
+
+ writeAllele(g.getAllele(0), alleleMap);
+ for (int i = 1; i < g.getPloidy(); i++) {
+ mWriter.write(g.isPhased() ? VCFConstants.PHASED : VCFConstants.UNPHASED);
+ writeAllele(g.getAllele(i), alleleMap);
+ }
+
+ List attrs = new ArrayList(genotypeFormatKeys.size());
+ for ( String key : genotypeFormatKeys ) {
+ if ( key.equals(VCFConstants.GENOTYPE_KEY) )
+ continue;
+
+ Object val = g.hasAttribute(key) ? g.getAttribute(key) : VCFConstants.MISSING_VALUE_v4;
+
+ // some exceptions
+ if ( key.equals(VCFConstants.GENOTYPE_QUALITY_KEY) ) {
+ if ( Math.abs(g.getNegLog10PError() - Genotype.NO_NEG_LOG_10PERROR) < 1e-6)
+ val = VCFConstants.MISSING_VALUE_v4;
+ else {
+ val = getQualValue(Math.min(g.getPhredScaledQual(), VCFConstants.MAX_GENOTYPE_QUAL));
+ }
+ } else if ( key.equals(VCFConstants.GENOTYPE_FILTER_KEY) ) {
+ val = g.isFiltered() ? ParsingUtils.join(";", ParsingUtils.sortList(g.getFilters())) : (g.filtersWereApplied() ? VCFConstants.PASSES_FILTERS_v4 : VCFConstants.UNFILTERED);
+ }
+
+ VCFFormatHeaderLine metaData = mHeader.getFormatHeaderLine(key);
+ if ( metaData != null ) {
+ int numInFormatField = metaData.getCount();
+ if ( numInFormatField > 1 && val.equals(VCFConstants.MISSING_VALUE_v4) ) {
+ // If we have a missing field but multiple values are expected, we need to construct a new string with all fields.
+ // For example, if Number=2, the string has to be ".,."
+ StringBuilder sb = new StringBuilder(VCFConstants.MISSING_VALUE_v4);
+ for ( int i = 1; i < numInFormatField; i++ ) {
+ sb.append(",");
+ sb.append(VCFConstants.MISSING_VALUE_v4);
+ }
+ val = sb.toString();
+ }
+ }
+
+ // assume that if key is absent, then the given string encoding suffices
+ String outputValue = formatVCFField(val);
+ if ( outputValue != null )
+ attrs.add(outputValue);
+ }
+
+ // strip off trailing missing values
+ for (int i = attrs.size()-1; i >= 0; i--) {
+ if ( isMissingValue(attrs.get(i)) )
+ attrs.remove(i);
+ else
+ break;
+ }
+
+ for (String s : attrs ) {
+ mWriter.write(VCFConstants.GENOTYPE_FIELD_SEPARATOR);
+ mWriter.write(s);
+ }
+ }
+ }
+
+ private boolean isMissingValue(String s) {
+ // we need to deal with the case that it's a list of missing values
+ return (countOccurrences(VCFConstants.MISSING_VALUE_v4.charAt(0), s) + countOccurrences(',', s) == s.length());
+ }
+
+ private void writeAllele(Allele allele, Map alleleMap) throws IOException {
+ String encoding = alleleMap.get(allele);
+ if ( encoding == null )
+ throw new TribbleException.InternalCodecException("Allele " + allele + " is not an allele in the variant context");
+ mWriter.write(encoding);
+ }
+
+ private static String formatVCFField(Object val) {
+ String result;
+ if ( val == null )
+ result = VCFConstants.MISSING_VALUE_v4;
+ else if ( val instanceof Double )
+ result = String.format(VCFConstants.DOUBLE_PRECISION_FORMAT_STRING, (Double)val);
+ else if ( val instanceof Boolean )
+ result = (Boolean)val ? "" : null; // empty string for true, null for false
+ else if ( val instanceof List ) {
+ result = formatVCFField(((List)val).toArray());
+ } else if ( val.getClass().isArray() ) {
+ int length = Array.getLength(val);
+ if ( length == 0 )
+ return formatVCFField(null);
+ StringBuffer sb = new StringBuffer(formatVCFField(Array.get(val, 0)));
+ for ( int i = 1; i < length; i++) {
+ sb.append(",");
+ sb.append(formatVCFField(Array.get(val, i)));
+ }
+ result = sb.toString();
+ } else
+ result = val.toString();
+
+ return result;
+ }
+
+ private static List calcVCFGenotypeKeys(VariantContext vc) {
+ Set keys = new HashSet();
+
+ boolean sawGoodQual = false;
+ boolean sawGenotypeFilter = false;
+ for ( Genotype g : vc.getGenotypes().values() ) {
+ keys.addAll(g.getAttributes().keySet());
+ if ( g.hasNegLog10PError() )
+ sawGoodQual = true;
+ if (g.isFiltered() && g.isCalled())
+ sawGenotypeFilter = true;
+ }
+
+ if ( sawGoodQual )
+ keys.add(VCFConstants.GENOTYPE_QUALITY_KEY);
+
+ if (sawGenotypeFilter)
+ keys.add(VCFConstants.GENOTYPE_FILTER_KEY);
+
+ return ParsingUtils.sortList(new ArrayList(keys));
+ }
+
+
+ public static int countOccurrences(char c, String s) {
+ int count = 0;
+ for (int i = 0; i < s.length(); i++) {
+ count += s.charAt(i) == c ? 1 : 0;
+ }
+ return count;
+ }
+
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCF3Codec.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCF3Codec.java
new file mode 100755
index 000000000..f3c99e963
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCF3Codec.java
@@ -0,0 +1,182 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broad.tribble.TribbleException;
+import org.broad.tribble.readers.LineReader;
+import org.broad.tribble.util.ParsingUtils;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+import java.io.IOException;
+import java.util.*;
+
+
+/**
+ * a feature codec for the VCF 3 specification. Our aim is to read in the records and convert to VariantContext as
+ * quickly as possible, relying on VariantContext to do the validation of any contradictory (or malformed) record parameters.
+ */
+public class VCF3Codec extends AbstractVCFCodec {
+
+ /**
+ * @param reader the line reader to take header lines from
+ * @return the number of header lines
+ */
+ public Object readHeader(LineReader reader) {
+ List headerStrings = new ArrayList();
+
+ String line;
+ try {
+ boolean foundHeaderVersion = false;
+ while ((line = reader.readLine()) != null) {
+ lineNo++;
+ if (line.startsWith(VCFHeader.METADATA_INDICATOR)) {
+ String[] lineFields = line.substring(2).split("=");
+ if (lineFields.length == 2 && VCFHeaderVersion.isFormatString(lineFields[0]) ) {
+ if ( !VCFHeaderVersion.isVersionString(lineFields[1]) )
+ throw new TribbleException.InvalidHeader(lineFields[1] + " is not a supported version");
+ foundHeaderVersion = true;
+ version = VCFHeaderVersion.toHeaderVersion(lineFields[1]);
+ if ( version != VCFHeaderVersion.VCF3_3 && version != VCFHeaderVersion.VCF3_2 )
+ throw new TribbleException.InvalidHeader("This codec is strictly for VCFv3 and does not support " + lineFields[1]);
+ }
+ headerStrings.add(line);
+ }
+ else if (line.startsWith(VCFHeader.HEADER_INDICATOR)) {
+ if (!foundHeaderVersion) {
+ throw new TribbleException.InvalidHeader("We never saw a header line specifying VCF version");
+ }
+ return createHeader(headerStrings, line);
+ }
+ else {
+ throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
+ }
+
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("IO Exception ", e);
+ }
+ throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
+ }
+
+
+ /**
+ * parse the filter string, first checking to see if we already have parsed it in a previous attempt
+ * @param filterString the string to parse
+ * @return a set of the filters applied
+ */
+ protected Set parseFilters(String filterString) {
+
+ // null for unfiltered
+ if ( filterString.equals(VCFConstants.UNFILTERED) )
+ return null;
+
+ // empty set for passes filters
+ LinkedHashSet fFields = new LinkedHashSet();
+
+ if ( filterString.equals(VCFConstants.PASSES_FILTERS_v3) )
+ return fFields;
+
+ if ( filterString.length() == 0 )
+ generateException("The VCF specification requires a valid filter status");
+
+ // do we have the filter string cached?
+ if ( filterHash.containsKey(filterString) )
+ return filterHash.get(filterString);
+
+ // otherwise we have to parse and cache the value
+ if ( filterString.indexOf(VCFConstants.FILTER_CODE_SEPARATOR) == -1 )
+ fFields.add(filterString);
+ else
+ fFields.addAll(Arrays.asList(filterString.split(VCFConstants.FILTER_CODE_SEPARATOR)));
+
+ filterHash.put(filterString, fFields);
+
+ return fFields;
+ }
+
+ /**
+ * create a genotype map
+ * @param str the string
+ * @param alleles the list of alleles
+ * @param chr chrom
+ * @param pos position
+ * @return a mapping of sample name to genotype object
+ */
+ public Map createGenotypeMap(String str, List alleles, String chr, int pos) {
+ if (genotypeParts == null)
+ genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
+
+ int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
+
+ Map genotypes = new LinkedHashMap(nParts);
+
+ // get the format keys
+ int nGTKeys = ParsingUtils.split(genotypeParts[0], genotypeKeyArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
+
+ // cycle through the sample names
+ Iterator sampleNameIterator = header.getGenotypeSamples().iterator();
+
+ // clear out our allele mapping
+ alleleMap.clear();
+
+ // cycle through the genotype strings
+ for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
+ int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
+
+ double GTQual = VariantContext.NO_NEG_LOG_10PERROR;
+ Set genotypeFilters = null;
+ Map gtAttributes = null;
+ String sampleName = sampleNameIterator.next();
+
+ // check to see if the value list is longer than the key list, which is a problem
+ if (nGTKeys < GTValueSplitSize)
+ generateException("There are too many keys for the sample " + sampleName + ", keys = " + parts[8] + ", values = " + parts[genotypeOffset]);
+
+ int genotypeAlleleLocation = -1;
+ if (nGTKeys >= 1) {
+ gtAttributes = new HashMap(nGTKeys - 1);
+
+ for (int i = 0; i < nGTKeys; i++) {
+ final String gtKey = new String(genotypeKeyArray[i]);
+ boolean missing = i >= GTValueSplitSize;
+
+ if (gtKey.equals(VCFConstants.GENOTYPE_KEY)) {
+ if (i != 0)
+ generateException("Saw GT at position " + i + ", but it must be at the first position for genotypes");
+ genotypeAlleleLocation = i;
+ } else if (gtKey.equals(VCFConstants.GENOTYPE_QUALITY_KEY)) {
+ GTQual = missing ? parseQual(VCFConstants.MISSING_VALUE_v4) : parseQual(GTValueArray[i]);
+ } else if (gtKey.equals(VCFConstants.GENOTYPE_FILTER_KEY)) {
+ genotypeFilters = missing ? parseFilters(VCFConstants.MISSING_VALUE_v4) : parseFilters(getCachedString(GTValueArray[i]));
+ } else if ( missing || GTValueArray[i].equals(VCFConstants.MISSING_GENOTYPE_QUALITY_v3) ) {
+ gtAttributes.put(gtKey, VCFConstants.MISSING_VALUE_v4);
+ } else {
+ gtAttributes.put(gtKey, new String(GTValueArray[i]));
+ }
+ }
+ }
+
+ // check to make sure we found a gentoype field
+ if (genotypeAlleleLocation < 0) generateException("Unable to find required field GT for the record; we don't yet support a missing GT field");
+
+ // todo -- assuming allele list length in the single digits is bad. Fix me.
+ // Check for > 1 for haploid genotypes
+ boolean phased = GTValueArray[genotypeAlleleLocation].length() > 1 && GTValueArray[genotypeAlleleLocation].charAt(1) == '|';
+
+ // add it to the list
+ try {
+ genotypes.put(sampleName, new Genotype(sampleName,
+ parseGenotypeAlleles(GTValueArray[genotypeAlleleLocation], alleles, alleleMap),
+ GTQual,
+ genotypeFilters,
+ gtAttributes,
+ phased));
+ } catch (TribbleException e) {
+ throw new TribbleException.InternalCodecException(e.getMessage() + ", at position " + chr+":"+pos);
+ }
+ }
+
+ return genotypes;
+ }
+
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCodec.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCodec.java
new file mode 100755
index 000000000..0fb2940bb
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCodec.java
@@ -0,0 +1,188 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broad.tribble.TribbleException;
+import org.broad.tribble.readers.LineReader;
+import org.broad.tribble.util.ParsingUtils;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+import java.io.IOException;
+import java.util.*;
+
+
+/**
+ * a feature codec for the VCF 4 specification. Our aim is to read in the records and convert to VariantContext as
+ * quickly as possible, relying on VariantContext to do the validation of any contradictory (or malformed) record parameters.
+ */
+public class VCFCodec extends AbstractVCFCodec {
+
+ /**
+ * @param reader the line reader to take header lines from
+ * @return the number of header lines
+ */
+ public Object readHeader(LineReader reader) {
+ List headerStrings = new ArrayList();
+
+ String line;
+ try {
+ boolean foundHeaderVersion = false;
+ while ((line = reader.readLine()) != null) {
+ lineNo++;
+ if (line.startsWith(VCFHeader.METADATA_INDICATOR)) {
+ String[] lineFields = line.substring(2).split("=");
+ if (lineFields.length == 2 && VCFHeaderVersion.isFormatString(lineFields[0]) ) {
+ if ( !VCFHeaderVersion.isVersionString(lineFields[1]) )
+ throw new TribbleException.InvalidHeader(lineFields[1] + " is not a supported version");
+ foundHeaderVersion = true;
+ version = VCFHeaderVersion.toHeaderVersion(lineFields[1]);
+ if ( version == VCFHeaderVersion.VCF3_3 || version == VCFHeaderVersion.VCF3_2 )
+ throw new TribbleException.InvalidHeader("This codec is strictly for VCFv4; please use the VCF3 codec for " + lineFields[1]);
+ if ( version != VCFHeaderVersion.VCF4_0 && version != VCFHeaderVersion.VCF4_1 )
+ throw new TribbleException.InvalidHeader("This codec is strictly for VCFv4 and does not support " + lineFields[1]);
+ }
+ headerStrings.add(line);
+ }
+ else if (line.startsWith(VCFHeader.HEADER_INDICATOR)) {
+ if (!foundHeaderVersion) {
+ throw new TribbleException.InvalidHeader("We never saw a header line specifying VCF version");
+ }
+ return createHeader(headerStrings, line);
+ }
+ else {
+ throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
+ }
+
+ }
+ } catch (IOException e) {
+ throw new RuntimeException("IO Exception ", e);
+ }
+ throw new TribbleException.InvalidHeader("We never saw the required CHROM header line (starting with one #) for the input VCF file");
+ }
+
+
+ /**
+ * parse the filter string, first checking to see if we already have parsed it in a previous attempt
+ *
+ * @param filterString the string to parse
+ * @return a set of the filters applied or null if filters were not applied to the record (e.g. as per the missing value in a VCF)
+ */
+ protected Set parseFilters(String filterString) {
+
+ // null for unfiltered
+ if ( filterString.equals(VCFConstants.UNFILTERED) )
+ return null;
+
+ // empty set for passes filters
+ LinkedHashSet fFields = new LinkedHashSet();
+
+ if ( filterString.equals(VCFConstants.PASSES_FILTERS_v4) )
+ return fFields;
+ if ( filterString.equals(VCFConstants.PASSES_FILTERS_v3) )
+ generateException(VCFConstants.PASSES_FILTERS_v3 + " is an invalid filter name in vcf4");
+ if ( filterString.length() == 0 )
+ generateException("The VCF specification requires a valid filter status");
+
+ // do we have the filter string cached?
+ if ( filterHash.containsKey(filterString) )
+ return filterHash.get(filterString);
+
+ // otherwise we have to parse and cache the value
+ if ( filterString.indexOf(VCFConstants.FILTER_CODE_SEPARATOR) == -1 )
+ fFields.add(filterString);
+ else
+ fFields.addAll(Arrays.asList(filterString.split(VCFConstants.FILTER_CODE_SEPARATOR)));
+
+ filterHash.put(filterString, fFields);
+
+ return fFields;
+ }
+
+
+ /**
+ * create a genotype map
+ * @param str the string
+ * @param alleles the list of alleles
+ * @return a mapping of sample name to genotype object
+ */
+ public Map createGenotypeMap(String str, List alleles, String chr, int pos) {
+ if (genotypeParts == null)
+ genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
+
+ int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
+
+ Map genotypes = new LinkedHashMap(nParts);
+
+ // get the format keys
+ int nGTKeys = ParsingUtils.split(genotypeParts[0], genotypeKeyArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
+
+ // cycle through the sample names
+ Iterator sampleNameIterator = header.getGenotypeSamples().iterator();
+
+ // clear out our allele mapping
+ alleleMap.clear();
+
+ // cycle through the genotype strings
+ for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
+ int GTValueSplitSize = ParsingUtils.split(genotypeParts[genotypeOffset], GTValueArray, VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
+
+ double GTQual = VariantContext.NO_NEG_LOG_10PERROR;
+ Set genotypeFilters = null;
+ Map gtAttributes = null;
+ String sampleName = sampleNameIterator.next();
+
+ // check to see if the value list is longer than the key list, which is a problem
+ if (nGTKeys < GTValueSplitSize)
+ generateException("There are too many keys for the sample " + sampleName + ", keys = " + parts[8] + ", values = " + parts[genotypeOffset]);
+
+ int genotypeAlleleLocation = -1;
+ if (nGTKeys >= 1) {
+ gtAttributes = new HashMap(nGTKeys - 1);
+
+ for (int i = 0; i < nGTKeys; i++) {
+ final String gtKey = new String(genotypeKeyArray[i]);
+ boolean missing = i >= GTValueSplitSize;
+
+ // todo -- all of these on the fly parsing of the missing value should be static constants
+ if (gtKey.equals(VCFConstants.GENOTYPE_KEY)) {
+ if (i != 0)
+ generateException("Saw GT at position " + i + ", but it must be at the first position for genotypes");
+ genotypeAlleleLocation = i;
+ } else if (gtKey.equals(VCFConstants.GENOTYPE_QUALITY_KEY)) {
+ GTQual = missing ? parseQual(VCFConstants.MISSING_VALUE_v4) : parseQual(GTValueArray[i]);
+ } else if (gtKey.equals(VCFConstants.GENOTYPE_FILTER_KEY)) {
+ genotypeFilters = missing ? parseFilters(VCFConstants.MISSING_VALUE_v4) : parseFilters(getCachedString(GTValueArray[i]));
+ } else if ( missing ) {
+ gtAttributes.put(gtKey, VCFConstants.MISSING_VALUE_v4);
+ } else {
+ gtAttributes.put(gtKey, new String(GTValueArray[i]));
+ }
+ }
+ }
+
+ // check to make sure we found a gentoype field
+ // TODO -- This is no longer required in v4.1
+ if (genotypeAlleleLocation < 0) generateException("Unable to find required field GT for the record; we don't yet support a missing GT field");
+
+ // todo -- assuming allele list length in the single digits is bad. Fix me.
+ // Check for > 1 for haploid genotypes
+ boolean phased = GTValueArray[genotypeAlleleLocation].length() > 1 && GTValueArray[genotypeAlleleLocation].charAt(1) == '|';
+
+ // add it to the list
+ try {
+ genotypes.put(sampleName, new Genotype(sampleName,
+ parseGenotypeAlleles(GTValueArray[genotypeAlleleLocation], alleles, alleleMap),
+ GTQual,
+ genotypeFilters,
+ gtAttributes,
+ phased));
+ } catch (TribbleException e) {
+ throw new TribbleException.InternalCodecException(e.getMessage() + ", at position " + chr+":"+pos);
+ }
+ }
+
+ return genotypes;
+ }
+
+
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCompoundHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCompoundHeaderLine.java
new file mode 100755
index 000000000..a799161ad
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFCompoundHeaderLine.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * a base class for compound header lines, which include info lines and format lines (so far)
+ */
+public abstract class VCFCompoundHeaderLine extends VCFHeaderLine implements VCFNamedHeaderLine {
+ public enum SupportedHeaderLineType {
+ INFO(true), FORMAT(false);
+
+ public final boolean allowFlagValues;
+ SupportedHeaderLineType(boolean flagValues) {
+ allowFlagValues = flagValues;
+ }
+ }
+
+ // the field types
+ private String name;
+ private int count;
+ private String description;
+ private VCFHeaderLineType type;
+
+ // access methods
+ public String getName() { return name; }
+ public int getCount() { return count; }
+ public String getDescription() { return description; }
+ public VCFHeaderLineType getType() { return type; }
+
+ //
+ public void setNumberToUnbounded() { this.count = UNBOUNDED; }
+
+ // our type of line, i.e. format, info, etc
+ private final SupportedHeaderLineType lineType;
+
+ // line numerical values are allowed to be unbounded (or unknown), which is
+ // marked with a dot (.)
+ public static final int UNBOUNDED = -1; // the value we store internally for unbounded types
+
+ /**
+ * create a VCF format header line
+ *
+ * @param name the name for this header line
+ * @param count the count for this header line
+ * @param type the type for this header line
+ * @param description the description for this header line
+ */
+ protected VCFCompoundHeaderLine(String name, int count, VCFHeaderLineType type, String description, SupportedHeaderLineType lineType) {
+ super(lineType.toString(), "");
+ this.name = name;
+ this.count = count;
+ this.type = type;
+ this.description = description;
+ this.lineType = lineType;
+ validate();
+ }
+
+ /**
+ * create a VCF format header line
+ *
+ * @param line the header line
+ * @param version the VCF header version
+ *
+ */
+ protected VCFCompoundHeaderLine(String line, VCFHeaderVersion version, SupportedHeaderLineType lineType) {
+ super(lineType.toString(), "");
+ Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Number","Type","Description"));
+ name = mapping.get("ID");
+ count = (version == VCFHeaderVersion.VCF4_0 || version == VCFHeaderVersion.VCF4_1) ?
+ mapping.get("Number").equals(VCFConstants.UNBOUNDED_ENCODING_v4) ? UNBOUNDED : Integer.valueOf(mapping.get("Number")) :
+ mapping.get("Number").equals(VCFConstants.UNBOUNDED_ENCODING_v3) ? UNBOUNDED : Integer.valueOf(mapping.get("Number"));
+ type = VCFHeaderLineType.valueOf(mapping.get("Type"));
+ if (type == VCFHeaderLineType.Flag && !allowFlagValues())
+ throw new IllegalArgumentException("Flag is an unsupported type for this kind of field");
+
+ description = mapping.get("Description");
+ if ( description == null && ALLOW_UNBOUND_DESCRIPTIONS ) // handle the case where there's no description provided
+ description = UNBOUND_DESCRIPTION;
+
+ this.lineType = lineType;
+
+ validate();
+ }
+
+ private void validate() {
+ if ( name == null || type == null || description == null || lineType == null )
+ throw new IllegalArgumentException(String.format("Invalid VCFCompoundHeaderLine: key=%s name=%s type=%s desc=%s lineType=%s",
+ super.getKey(), name, type, description, lineType ));
+ }
+
+ /**
+ * make a string representation of this header line
+ * @return a string representation
+ */
+ protected String toStringEncoding() {
+ Map map = new LinkedHashMap();
+ map.put("ID", name);
+ map.put("Number", count == UNBOUNDED ? VCFConstants.UNBOUNDED_ENCODING_v4 : count);
+ map.put("Type", type);
+ map.put("Description", description);
+ return lineType.toString() + "=" + VCFHeaderLine.toStringEncoding(map);
+ }
+
+ /**
+ * returns true if we're equal to another compounder header line
+ * @param o a compound header line
+ * @return true if equal
+ */
+ public boolean equals(Object o) {
+ if ( !(o instanceof VCFCompoundHeaderLine) )
+ return false;
+ VCFCompoundHeaderLine other = (VCFCompoundHeaderLine)o;
+ return name.equals(other.name) &&
+ count == other.count &&
+ description.equals(other.description) &&
+ type == other.type &&
+ lineType == other.lineType;
+ }
+
+ public boolean equalsExcludingDescription(VCFCompoundHeaderLine other) {
+ return count == other.count &&
+ type == other.type &&
+ lineType == other.lineType &&
+ name.equals(other.name);
+ }
+
+ public boolean sameLineTypeAndName(VCFCompoundHeaderLine other) {
+ return lineType == other.lineType &&
+ name.equals(other.name);
+ }
+
+ /**
+ * do we allow flag (boolean) values? (i.e. booleans where you don't have specify the value, AQ means AQ=true)
+ * @return true if we do, false otherwise
+ */
+ abstract boolean allowFlagValues();
+
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFConstants.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFConstants.java
new file mode 100755
index 000000000..695c46c27
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFConstants.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import java.util.Locale;
+
+public final class VCFConstants {
+ public static final Locale VCF_LOCALE = Locale.US;
+
+ // reserved INFO/FORMAT field keys
+ public static final String ANCESTRAL_ALLELE_KEY = "AA";
+ public static final String ALLELE_COUNT_KEY = "AC";
+ public static final String ALLELE_FREQUENCY_KEY = "AF";
+ public static final String ALLELE_NUMBER_KEY = "AN";
+ public static final String RMS_BASE_QUALITY_KEY = "BQ";
+ public static final String CIGAR_KEY = "CIGAR";
+ public static final String DBSNP_KEY = "DB";
+ public static final String DEPTH_KEY = "DP";
+ public static final String DOWNSAMPLED_KEY = "DS";
+ public static final String EXPECTED_ALLELE_COUNT_KEY = "EC";
+ public static final String END_KEY = "END";
+ public static final String GENOTYPE_FILTER_KEY = "FT";
+ public static final String GENOTYPE_KEY = "GT";
+ @Deprecated
+ public static final String GENOTYPE_LIKELIHOODS_KEY = "GL"; // log10 scaled genotype likelihoods
+ public static final String GENOTYPE_POSTERIORS_KEY = "GP";
+ public static final String GENOTYPE_QUALITY_KEY = "GQ";
+ public static final String HAPMAP2_KEY = "H2";
+ public static final String HAPMAP3_KEY = "H3";
+ public static final String HAPLOTYPE_QUALITY_KEY = "HQ";
+ public static final String RMS_MAPPING_QUALITY_KEY = "MQ";
+ public static final String MAPPING_QUALITY_ZERO_KEY = "MQ0";
+ public static final String SAMPLE_NUMBER_KEY = "NS";
+ public static final String PHRED_GENOTYPE_LIKELIHOODS_KEY = "PL"; // phred-scaled genotype likelihoods
+ public static final String PHASE_QUALITY_KEY = "PQ";
+ public static final String PHASE_SET_KEY = "PS";
+ public static final String OLD_DEPTH_KEY = "RD";
+ public static final String STRAND_BIAS_KEY = "SB";
+ public static final String SOMATIC_KEY = "SOMATIC";
+ public static final String VALIDATED_KEY = "VALIDATED";
+ public static final String THOUSAND_GENOMES_KEY = "1000G";
+
+ // separators
+ public static final String FORMAT_FIELD_SEPARATOR = ":";
+ public static final String GENOTYPE_FIELD_SEPARATOR = ":";
+ public static final char GENOTYPE_FIELD_SEPARATOR_CHAR = ':';
+ public static final String FIELD_SEPARATOR = "\t";
+ public static final char FIELD_SEPARATOR_CHAR = '\t';
+ public static final String FILTER_CODE_SEPARATOR = ";";
+ public static final String INFO_FIELD_ARRAY_SEPARATOR = ",";
+ public static final String ID_FIELD_SEPARATOR = ";";
+ public static final String INFO_FIELD_SEPARATOR = ";";
+ public static final char INFO_FIELD_SEPARATOR_CHAR = ';';
+ public static final String UNPHASED = "/";
+ public static final String PHASED = "|";
+ public static final String PHASED_SWITCH_PROB_v3 = "\\";
+ public static final String PHASING_TOKENS = "/|\\";
+
+ // old indel alleles
+ public static final char DELETION_ALLELE_v3 = 'D';
+ public static final char INSERTION_ALLELE_v3 = 'I';
+
+ // missing/default values
+ public static final String UNFILTERED = ".";
+ public static final String PASSES_FILTERS_v3 = "0";
+ public static final String PASSES_FILTERS_v4 = "PASS";
+ public static final String EMPTY_ID_FIELD = ".";
+ public static final String EMPTY_INFO_FIELD = ".";
+ public static final String EMPTY_ALTERNATE_ALLELE_FIELD = ".";
+ public static final String MISSING_VALUE_v4 = ".";
+ public static final String MISSING_QUALITY_v3 = "-1";
+ public static final Double MISSING_QUALITY_v3_DOUBLE = Double.valueOf(MISSING_QUALITY_v3);
+
+ public static final String MISSING_GENOTYPE_QUALITY_v3 = "-1";
+ public static final String MISSING_HAPLOTYPE_QUALITY_v3 = "-1";
+ public static final String MISSING_DEPTH_v3 = "-1";
+ public static final String UNBOUNDED_ENCODING_v4 = ".";
+ public static final String UNBOUNDED_ENCODING_v3 = "-1";
+ public static final String EMPTY_ALLELE = ".";
+ public static final String EMPTY_GENOTYPE = "./.";
+ public static final double MAX_GENOTYPE_QUAL = 99.0;
+
+ public static final String DOUBLE_PRECISION_FORMAT_STRING = "%.2f";
+ public static final String DOUBLE_PRECISION_INT_SUFFIX = ".00";
+ public static final Double VCF_ENCODING_EPSILON = 0.00005; // when we consider fields equal(), used in the Qual compare
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFilterHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFilterHeaderLine.java
new file mode 100755
index 000000000..9176fc16e
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFilterHeaderLine.java
@@ -0,0 +1,70 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+
+/**
+ * @author ebanks
+ * A class representing a key=value entry for FILTER fields in the VCF header
+ */
+public class VCFFilterHeaderLine extends VCFHeaderLine implements VCFNamedHeaderLine {
+
+ private String name;
+ private String description;
+
+
+ /**
+ * create a VCF filter header line
+ *
+ * @param name the name for this header line
+ * @param description the description for this header line
+ */
+ public VCFFilterHeaderLine(String name, String description) {
+ super("FILTER", "");
+ this.name = name;
+ this.description = description;
+
+ if ( name == null || description == null )
+ throw new IllegalArgumentException(String.format("Invalid VCFCompoundHeaderLine: key=%s name=%s desc=%s", super.getKey(), name, description ));
+ }
+
+ /**
+ * create a VCF info header line
+ *
+ * @param line the header line
+ * @param version the vcf header version
+ */
+ protected VCFFilterHeaderLine(String line, VCFHeaderVersion version) {
+ super("FILTER", "");
+ Map mapping = VCFHeaderLineTranslator.parseLine(version,line, Arrays.asList("ID","Description"));
+ name = mapping.get("ID");
+ description = mapping.get("Description");
+ if ( description == null && ALLOW_UNBOUND_DESCRIPTIONS ) // handle the case where there's no description provided
+ description = UNBOUND_DESCRIPTION;
+ }
+
+ protected String toStringEncoding() {
+ Map map = new LinkedHashMap();
+ map.put("ID", name);
+ map.put("Description", description);
+ return "FILTER=" + VCFHeaderLine.toStringEncoding(map);
+ }
+
+ public boolean equals(Object o) {
+ if ( !(o instanceof VCFFilterHeaderLine) )
+ return false;
+ VCFFilterHeaderLine other = (VCFFilterHeaderLine)o;
+ return name.equals(other.name) &&
+ description.equals(other.description);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFormatHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFormatHeaderLine.java
new file mode 100755
index 000000000..352be3e97
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFFormatHeaderLine.java
@@ -0,0 +1,28 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+
+/**
+ * @author ebanks
+ *
+ * Class VCFFormatHeaderLine
+ *
+ * A class representing a key=value entry for genotype FORMAT fields in the VCF header
+ */
+public class VCFFormatHeaderLine extends VCFCompoundHeaderLine {
+
+ public VCFFormatHeaderLine(String name, int count, VCFHeaderLineType type, String description) {
+ super(name, count, type, description, SupportedHeaderLineType.FORMAT);
+ if (type == VCFHeaderLineType.Flag)
+ throw new IllegalArgumentException("Flag is an unsupported type for format fields");
+ }
+
+ protected VCFFormatHeaderLine(String line, VCFHeaderVersion version) {
+ super(line, version, SupportedHeaderLineType.FORMAT);
+ }
+
+ // format fields do not allow flag values (that wouldn't make much sense, how would you encode this in the genotype).
+ @Override
+ boolean allowFlagValues() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeader.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeader.java
new file mode 100755
index 000000000..eb01e5dca
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeader.java
@@ -0,0 +1,191 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+
+import org.broad.tribble.util.ParsingUtils;
+
+import java.util.*;
+
+
+/**
+ * @author aaron
+ *
+ * Class VCFHeader
+ *
+ * A class representing the VCF header
+ */
+public class VCFHeader {
+
+ // the mandatory header fields
+ public enum HEADER_FIELDS {
+ CHROM, POS, ID, REF, ALT, QUAL, FILTER, INFO
+ }
+
+ // the associated meta data
+ private final Set mMetaData;
+ private final Map mInfoMetaData = new HashMap();
+ private final Map mFormatMetaData = new HashMap();
+
+ // the list of auxillary tags
+ private final Set mGenotypeSampleNames = new LinkedHashSet();
+
+ // the character string that indicates meta data
+ public static final String METADATA_INDICATOR = "##";
+
+ // the header string indicator
+ public static final String HEADER_INDICATOR = "#";
+
+ /** do we have genotying data? */
+ private boolean hasGenotypingData = false;
+
+ // were the input samples sorted originally (or are we sorting them)?
+ private boolean samplesWereAlreadySorted = true;
+
+
+ /**
+ * create a VCF header, given a list of meta data and auxillary tags
+ *
+ * @param metaData the meta data associated with this header
+ */
+ public VCFHeader(Set metaData) {
+ mMetaData = new TreeSet(metaData);
+ loadVCFVersion();
+ loadMetaDataMaps();
+ }
+
+ /**
+ * create a VCF header, given a list of meta data and auxillary tags
+ *
+ * @param metaData the meta data associated with this header
+ * @param genotypeSampleNames the genotype format field, and the sample names
+ */
+ public VCFHeader(Set metaData, Set genotypeSampleNames) {
+ mMetaData = new TreeSet();
+ if ( metaData != null )
+ mMetaData.addAll(metaData);
+ for (String col : genotypeSampleNames) {
+ if (!col.equals("FORMAT"))
+ mGenotypeSampleNames.add(col);
+ }
+ if (genotypeSampleNames.size() > 0) hasGenotypingData = true;
+ loadVCFVersion();
+ loadMetaDataMaps();
+
+ samplesWereAlreadySorted = ParsingUtils.isSorted(genotypeSampleNames);
+ }
+
+ /**
+ * Adds a header line to the header metadata.
+ *
+ * @param headerLine Line to add to the existing metadata component.
+ */
+ public void addMetaDataLine(VCFHeaderLine headerLine) {
+ mMetaData.add(headerLine);
+ }
+
+ /**
+ * check our metadata for a VCF version tag, and throw an exception if the version is out of date
+ * or the version is not present
+ */
+ public void loadVCFVersion() {
+ List toRemove = new ArrayList();
+ for ( VCFHeaderLine line : mMetaData )
+ if ( VCFHeaderVersion.isFormatString(line.getKey())) {
+ toRemove.add(line);
+ }
+ // remove old header lines for now,
+ mMetaData.removeAll(toRemove);
+
+ }
+
+ /**
+ * load the format/info meta data maps (these are used for quick lookup by key name)
+ */
+ private void loadMetaDataMaps() {
+ for ( VCFHeaderLine line : mMetaData ) {
+ if ( line instanceof VCFInfoHeaderLine ) {
+ VCFInfoHeaderLine infoLine = (VCFInfoHeaderLine)line;
+ mInfoMetaData.put(infoLine.getName(), infoLine);
+ }
+ else if ( line instanceof VCFFormatHeaderLine ) {
+ VCFFormatHeaderLine formatLine = (VCFFormatHeaderLine)line;
+ mFormatMetaData.put(formatLine.getName(), formatLine);
+ }
+ }
+ }
+
+ /**
+ * get the header fields in order they're presented in the input file (which is now required to be
+ * the order presented in the spec).
+ *
+ * @return a set of the header fields, in order
+ */
+ public Set getHeaderFields() {
+ Set fields = new LinkedHashSet();
+ for (HEADER_FIELDS field : HEADER_FIELDS.values())
+ fields.add(field);
+ return fields;
+ }
+
+ /**
+ * get the meta data, associated with this header
+ *
+ * @return a set of the meta data
+ */
+ public Set getMetaData() {
+ Set lines = new LinkedHashSet();
+ lines.add(new VCFHeaderLine(VCFHeaderVersion.VCF4_0.getFormatString(), VCFHeaderVersion.VCF4_0.getVersionString()));
+ lines.addAll(mMetaData);
+ return Collections.unmodifiableSet(lines);
+ }
+
+ /**
+ * get the genotyping sample names
+ *
+ * @return a list of the genotype column names, which may be empty if hasGenotypingData() returns false
+ */
+ public Set getGenotypeSamples() {
+ return mGenotypeSampleNames;
+ }
+
+ /**
+ * do we have genotyping data?
+ *
+ * @return true if we have genotyping columns, false otherwise
+ */
+ public boolean hasGenotypingData() {
+ return hasGenotypingData;
+ }
+
+ /**
+ * were the input samples sorted originally?
+ *
+ * @return true if the input samples were sorted originally, false otherwise
+ */
+ public boolean samplesWereAlreadySorted() {
+ return samplesWereAlreadySorted;
+ }
+
+ /** @return the column count */
+ public int getColumnCount() {
+ return HEADER_FIELDS.values().length + ((hasGenotypingData) ? mGenotypeSampleNames.size() + 1 : 0);
+ }
+
+ /**
+ * @param key the header key name
+ * @return the meta data line, or null if there is none
+ */
+ public VCFInfoHeaderLine getInfoHeaderLine(String key) {
+ return mInfoMetaData.get(key);
+ }
+
+ /**
+ * @param key the header key name
+ * @return the meta data line, or null if there is none
+ */
+ public VCFFormatHeaderLine getFormatHeaderLine(String key) {
+ return mFormatMetaData.get(key);
+ }
+}
+
+
+
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLine.java
new file mode 100755
index 000000000..162c34d80
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLine.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2010.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broad.tribble.TribbleException;
+
+import java.util.Map;
+
+
+/**
+ * @author ebanks
+ *
+ * Class VCFHeaderLine
+ *
+ * A class representing a key=value entry in the VCF header
+ */
+public class VCFHeaderLine implements Comparable {
+ protected static boolean ALLOW_UNBOUND_DESCRIPTIONS = true;
+ protected static String UNBOUND_DESCRIPTION = "Not provided in original VCF header";
+
+ private String mKey = null;
+ private String mValue = null;
+
+
+ /**
+ * create a VCF header line
+ *
+ * @param key the key for this header line
+ * @param value the value for this header line
+ */
+ public VCFHeaderLine(String key, String value) {
+ if ( key == null )
+ throw new IllegalArgumentException("VCFHeaderLine: key cannot be null: key = " + key);
+ mKey = key;
+ mValue = value;
+ }
+
+ /**
+ * Get the key
+ *
+ * @return the key
+ */
+ public String getKey() {
+ return mKey;
+ }
+
+ /**
+ * Get the value
+ *
+ * @return the value
+ */
+ public String getValue() {
+ return mValue;
+ }
+
+ public String toString() {
+ return toStringEncoding();
+ }
+
+ /**
+ * Should be overloaded in sub classes to do subclass specific
+ *
+ * @return the string encoding
+ */
+ protected String toStringEncoding() {
+ return mKey + "=" + mValue;
+ }
+
+ public boolean equals(Object o) {
+ if ( !(o instanceof VCFHeaderLine) )
+ return false;
+ return mKey.equals(((VCFHeaderLine)o).getKey()) && mValue.equals(((VCFHeaderLine)o).getValue());
+ }
+
+ public int compareTo(Object other) {
+ return toString().compareTo(other.toString());
+ }
+
+ /**
+ * @param line the line
+ * @return true if the line is a VCF meta data line, or false if it is not
+ */
+ public static boolean isHeaderLine(String line) {
+ return line != null && line.length() > 0 && VCFHeader.HEADER_INDICATOR.equals(line.substring(0,1));
+ }
+
+ /**
+ * create a string of a mapping pair for the target VCF version
+ * @param keyValues a mapping of the key->value pairs to output
+ * @return a string, correctly formatted
+ */
+ public static String toStringEncoding(Map keyValues) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("<");
+ boolean start = true;
+ for (Map.Entry entry : keyValues.entrySet()) {
+ if (start) start = false;
+ else builder.append(",");
+
+ if ( entry.getValue() == null ) throw new TribbleException.InternalCodecException("Header problem: unbound value at " + entry + " from " + keyValues);
+
+ builder.append(entry.getKey());
+ builder.append("=");
+ builder.append(entry.getValue().toString().contains(",") ||
+ entry.getValue().toString().contains(" ") ||
+ entry.getKey().equals("Description") ? "\""+ entry.getValue() + "\"" : entry.getValue());
+ }
+ builder.append(">");
+ return builder.toString();
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineTranslator.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineTranslator.java
new file mode 100755
index 000000000..16f2a3d5a
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineTranslator.java
@@ -0,0 +1,124 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import java.util.*;
+
+/**
+ * A class for translating between vcf header versions
+ */
+public class VCFHeaderLineTranslator {
+ private static Map mapping;
+
+ static {
+ mapping = new HashMap();
+ mapping.put(VCFHeaderVersion.VCF4_0,new VCF4Parser());
+ mapping.put(VCFHeaderVersion.VCF4_1,new VCF4Parser());
+ mapping.put(VCFHeaderVersion.VCF3_3,new VCF3Parser());
+ mapping.put(VCFHeaderVersion.VCF3_2,new VCF3Parser());
+ }
+
+ public static Map parseLine(VCFHeaderVersion version, String valueLine, List expectedTagOrder) {
+ return mapping.get(version).parseLine(valueLine,expectedTagOrder);
+ }
+}
+
+
+interface VCFLineParser {
+ public Map parseLine(String valueLine, List expectedTagOrder);
+}
+
+
+/**
+ * a class that handles the to and from disk for VCF 4 lines
+ */
+class VCF4Parser implements VCFLineParser {
+ Set bracketed = new HashSet();
+
+ /**
+ * parse a VCF4 line
+ * @param valueLine the line
+ * @return a mapping of the tags parsed out
+ */
+ public Map parseLine(String valueLine, List expectedTagOrder) {
+ // our return map
+ Map ret = new LinkedHashMap();
+
+ // a builder to store up characters as we go
+ StringBuilder builder = new StringBuilder();
+
+ // store the key when we're parsing out the values
+ String key = "";
+
+ // where are we in the stream of characters?
+ int index = 0;
+
+ // are we inside a quotation? we don't special case ',' then
+ boolean inQuote = false;
+
+ // a little switch machine to parse out the tags. Regex ended up being really complicated and ugly [yes, but this machine is getting ugly now... MAD]
+ for (char c: valueLine.toCharArray()) {
+ if ( c == '\"' ) {
+ inQuote = ! inQuote;
+ } else if ( inQuote ) {
+ builder.append(c);
+ } else {
+ switch (c) {
+ case ('<') : if (index == 0) break; // if we see a open bracket at the beginning, ignore it
+ case ('>') : if (index == valueLine.length()-1) ret.put(key,builder.toString().trim()); break; // if we see a close bracket, and we're at the end, add an entry to our list
+ case ('=') : key = builder.toString().trim(); builder = new StringBuilder(); break; // at an equals, copy the key and reset the builder
+ case (',') : ret.put(key,builder.toString().trim()); builder = new StringBuilder(); break; // drop the current key value to the return map
+ default: builder.append(c); // otherwise simply append to the current string
+ }
+ }
+
+ index++;
+ }
+
+ // validate the tags against the expected list
+ index = 0;
+ if (ret.size() > expectedTagOrder.size()) throw new IllegalArgumentException("Unexpected tag count " + ret.size() + " in string " + expectedTagOrder.size());
+ for (String str : ret.keySet()) {
+ if (!expectedTagOrder.get(index).equals(str)) throw new IllegalArgumentException("Unexpected tag " + str + " in string " + valueLine);
+ index++;
+ }
+ return ret;
+ }
+}
+
+class VCF3Parser implements VCFLineParser {
+
+ public Map parseLine(String valueLine, List expectedTagOrder) {
+ // our return map
+ Map ret = new LinkedHashMap();
+
+ // a builder to store up characters as we go
+ StringBuilder builder = new StringBuilder();
+
+ // where are we in the stream of characters?
+ int index = 0;
+ // where in the expected tag order are we?
+ int tagIndex = 0;
+
+ // are we inside a quotation? we don't special case ',' then
+ boolean inQuote = false;
+
+ // a little switch machine to parse out the tags. Regex ended up being really complicated and ugly
+ for (char c: valueLine.toCharArray()) {
+ switch (c) {
+ case ('\"') : inQuote = !inQuote; break; // a quote means we ignore ',' in our strings, keep track of it
+ case (',') : if (!inQuote) { ret.put(expectedTagOrder.get(tagIndex++),builder.toString()); builder = new StringBuilder(); break; } // drop the current key value to the return map
+ default: builder.append(c); // otherwise simply append to the current string
+ }
+ index++;
+ }
+ ret.put(expectedTagOrder.get(tagIndex++),builder.toString());
+
+ // validate the tags against the expected list
+ index = 0;
+ if (tagIndex != expectedTagOrder.size()) throw new IllegalArgumentException("Unexpected tag count " + tagIndex + ", we expected " + expectedTagOrder.size());
+ for (String str : ret.keySet()){
+ if (!expectedTagOrder.get(index).equals(str)) throw new IllegalArgumentException("Unexpected tag " + str + " in string " + valueLine);
+ index++;
+ }
+ return ret;
+ }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineType.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineType.java
new file mode 100755
index 000000000..83e272415
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderLineType.java
@@ -0,0 +1,8 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+/**
+ * the type encodings we use for fields in VCF header lines
+ */
+public enum VCFHeaderLineType {
+ Integer, Float, String, Character, Flag;
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderVersion.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderVersion.java
new file mode 100755
index 000000000..c65ce17b9
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFHeaderVersion.java
@@ -0,0 +1,91 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broad.tribble.TribbleException;
+
+/**
+ * information that identifies each header version
+ */
+public enum VCFHeaderVersion {
+ VCF3_2("VCRv3.2","format"),
+ VCF3_3("VCFv3.3","fileformat"),
+ VCF4_0("VCFv4.0","fileformat"),
+ VCF4_1("VCFv4.1","fileformat");
+
+ private final String versionString;
+ private final String formatString;
+
+ /**
+ * create the enum, privately, using:
+ * @param vString the version string
+ * @param fString the format string
+ */
+ VCFHeaderVersion(String vString, String fString) {
+ this.versionString = vString;
+ this.formatString = fString;
+ }
+
+ /**
+ * get the header version
+ * @param version the version string
+ * @return a VCFHeaderVersion object
+ */
+ public static VCFHeaderVersion toHeaderVersion(String version) {
+ version = clean(version);
+ for (VCFHeaderVersion hv : VCFHeaderVersion.values())
+ if (hv.versionString.equals(version))
+ return hv;
+ return null;
+ }
+
+ /**
+ * are we a valid version string of some type
+ * @param version the version string
+ * @return true if we're valid of some type, false otherwise
+ */
+ public static boolean isVersionString(String version){
+ return toHeaderVersion(version) != null;
+ }
+
+ /**
+ * are we a valid format string for some type
+ * @param format the format string
+ * @return true if we're valid of some type, false otherwise
+ */
+ public static boolean isFormatString(String format){
+ format = clean(format);
+ for (VCFHeaderVersion hv : VCFHeaderVersion.values())
+ if (hv.formatString.equals(format))
+ return true;
+ return false;
+ }
+
+ public static VCFHeaderVersion getHeaderVersion(String versionLine) {
+ String[] lineFields = versionLine.split("=");
+ if ( lineFields.length != 2 || !isFormatString(lineFields[0].substring(2)) )
+ throw new TribbleException.InvalidHeader(versionLine + " is not a valid VCF version line");
+
+ if ( !isVersionString(lineFields[1]) )
+ throw new TribbleException.InvalidHeader(lineFields[1] + " is not a supported version");
+
+ return toHeaderVersion(lineFields[1]);
+ }
+
+ /**
+ * Utility function to clean up a VCF header string
+ *
+ * @param s string
+ * @return trimmed version of s
+ */
+ private static String clean(String s) {
+ return s.trim();
+ }
+
+
+ public String getVersionString() {
+ return versionString;
+ }
+
+ public String getFormatString() {
+ return formatString;
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFInfoHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFInfoHeaderLine.java
new file mode 100755
index 000000000..135a5c1a1
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFInfoHeaderLine.java
@@ -0,0 +1,25 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+
+/**
+ * @author ebanks
+ *
+ * Class VCFInfoHeaderLine
+ *
+ * A class representing a key=value entry for INFO fields in the VCF header
+ */
+public class VCFInfoHeaderLine extends VCFCompoundHeaderLine {
+ public VCFInfoHeaderLine(String name, int count, VCFHeaderLineType type, String description) {
+ super(name, count, type, description, SupportedHeaderLineType.INFO);
+ }
+
+ protected VCFInfoHeaderLine(String line, VCFHeaderVersion version) {
+ super(line, version, SupportedHeaderLineType.INFO);
+ }
+
+ // info fields allow flag values
+ @Override
+ boolean allowFlagValues() {
+ return true;
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFNamedHeaderLine.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFNamedHeaderLine.java
new file mode 100755
index 000000000..f78e936b2
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFNamedHeaderLine.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+/** an interface for named header lines **/
+public interface VCFNamedHeaderLine {
+ String getName();
+}
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFParser.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFParser.java
new file mode 100755
index 000000000..dac996494
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFParser.java
@@ -0,0 +1,23 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.Genotype;
+import java.util.*;
+
+
+/**
+ * All VCF codecs need to implement this interface so that we can perform lazy loading.
+ */
+public interface VCFParser {
+
+ /**
+ * create a genotype map
+ * @param str the string
+ * @param alleles the list of alleles
+ * @param chr chrom
+ * @param pos position
+ * @return a mapping of sample name to genotype object
+ */
+ public Map createGenotypeMap(String str, List alleles, String chr, int pos);
+
+}
diff --git a/java/src/org/broadinstitute/sting/utils/vcf/VCFUtils.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFUtils.java
similarity index 97%
rename from java/src/org/broadinstitute/sting/utils/vcf/VCFUtils.java
rename to java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFUtils.java
index 08de5bf56..e919d5c25 100755
--- a/java/src/org/broadinstitute/sting/utils/vcf/VCFUtils.java
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFUtils.java
@@ -23,13 +23,11 @@
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-package org.broadinstitute.sting.utils.vcf;
+package org.broadinstitute.sting.utils.codecs.vcf;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broad.tribble.vcf.*;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.datasources.rmd.ReferenceOrderedDataSource;
-import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.apache.log4j.Logger;
import java.util.*;
diff --git a/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFWriter.java b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFWriter.java
new file mode 100755
index 000000000..0d23fe455
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/codecs/vcf/VCFWriter.java
@@ -0,0 +1,18 @@
+package org.broadinstitute.sting.utils.codecs.vcf;
+
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+
+/**
+ * this class writes VCF files
+ */
+public interface VCFWriter {
+
+ public void writeHeader(VCFHeader header);
+
+ /**
+ * attempt to close the VCF file
+ */
+ public void close();
+
+ public void add(VariantContext vc, byte refBase);
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
index 3336eb34f..0be4bec91 100755
--- a/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
+++ b/java/src/org/broadinstitute/sting/utils/exceptions/UserException.java
@@ -28,8 +28,8 @@ import net.sf.samtools.SAMFileHeader;
import net.sf.samtools.SAMRecord;
import net.sf.samtools.SAMSequenceDictionary;
import net.sf.samtools.SAMSequenceRecord;
-import org.broad.tribble.util.variantcontext.VariantContext;
-import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.GenomeLoc;
import java.io.File;
diff --git a/java/src/org/broadinstitute/sting/utils/genotype/Haplotype.java b/java/src/org/broadinstitute/sting/utils/genotype/Haplotype.java
index e22adc4a6..cb6557408 100755
--- a/java/src/org/broadinstitute/sting/utils/genotype/Haplotype.java
+++ b/java/src/org/broadinstitute/sting/utils/genotype/Haplotype.java
@@ -24,8 +24,8 @@
package org.broadinstitute.sting.utils.genotype;
-import org.broad.tribble.util.variantcontext.Allele;
-import org.broad.tribble.util.variantcontext.VariantContext;
+import org.broadinstitute.sting.utils.variantcontext.Allele;
+import org.broadinstitute.sting.utils.variantcontext.VariantContext;
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
import org.broadinstitute.sting.utils.GenomeLoc;
import org.broadinstitute.sting.utils.GenomeLocParser;
diff --git a/java/src/org/broadinstitute/sting/utils/variantcontext/Allele.java b/java/src/org/broadinstitute/sting/utils/variantcontext/Allele.java
new file mode 100755
index 000000000..a9ba46159
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/variantcontext/Allele.java
@@ -0,0 +1,456 @@
+package org.broadinstitute.sting.utils.variantcontext;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Immutable representation of an allele
+ *
+ * Types of alleles:
+ *
+ * Ref: a t C g a // C is the reference base
+ *
+ * : a t G g a // C base is a G in some individuals
+ *
+ * : a t - g a // C base is deleted w.r.t. the reference
+ *
+ * : a t CAg a // A base is inserted w.r.t. the reference sequence
+ *
+ * In these cases, where are the alleles?
+ *
+ * SNP polymorphism of C/G -> { C , G } -> C is the reference allele
+ * 1 base deletion of C -> { C , - } -> C is the reference allele
+ * 1 base insertion of A -> { - ; A } -> Null is the reference allele
+ *
+ * Suppose I see a the following in the population:
+ *
+ * Ref: a t C g a // C is the reference base
+ * : a t G g a // C base is a G in some individuals
+ * : a t - g a // C base is deleted w.r.t. the reference
+ *
+ * How do I represent this? There are three segregating alleles:
+ *
+ * { C , G , - }
+ *
+ * Now suppose I have this more complex example:
+ *
+ * Ref: a t C g a // C is the reference base
+ * : a t - g a
+ * : a t - - a
+ * : a t CAg a
+ *
+ * There are actually four segregating alleles:
+ *
+ * { C g , - g, - -, and CAg } over bases 2-4
+ *
+ * However, the molecular equivalence explicitly listed above is usually discarded, so the actual
+ * segregating alleles are:
+ *
+ * { C g, g, -, C a g }
+ *
+ * Critically, it should be possible to apply an allele to a reference sequence to create the
+ * correct haplotype sequence:
+ *
+ * Allele + reference => haplotype
+ *
+ * For convenience, we are going to create Alleles where the GenomeLoc of the allele is stored outside of the
+ * Allele object itself. So there's an idea of an A/C polymorphism independent of it's surrounding context.
+ *
+ * Given list of alleles it's possible to determine the "type" of the variation
+ *
+ * A / C @ loc => SNP with
+ * - / A => INDEL
+ *
+ * If you know where allele is the reference, you can determine whether the variant is an insertion or deletion.
+ *
+ * Alelle also supports is concept of a NO_CALL allele. This Allele represents a haplotype that couldn't be
+ * determined. This is usually represented by a '.' allele.
+ *
+ * Note that Alleles store all bases as bytes, in **UPPER CASE**. So 'atc' == 'ATC' from the perspective of an
+ * Allele.
+
+ * @author ebanks, depristo
+ */
+public class Allele implements Comparable {
+ private static final byte[] EMPTY_ALLELE_BASES = new byte[0];
+
+ private boolean isRef = false;
+ private boolean isNull = false;
+ private boolean isNoCall = false;
+ private boolean isSymbolic = false;
+
+ private byte[] bases = null;
+
+ public final static String NULL_ALLELE_STRING = "-";
+ public final static String NO_CALL_STRING = ".";
+ /** A generic static NO_CALL allele for use */
+
+ // no public way to create an allele
+ private Allele(byte[] bases, boolean isRef) {
+ // standardize our representation of null allele and bases
+ if ( wouldBeNullAllele(bases) ) {
+ bases = EMPTY_ALLELE_BASES;
+ isNull = true;
+ } else if ( wouldBeNoCallAllele(bases) ) {
+ bases = EMPTY_ALLELE_BASES;
+ isNoCall = true;
+ if ( isRef ) throw new IllegalArgumentException("Cannot tag a NoCall allele as the reference allele");
+ } else if ( wouldBeSymbolicAllele(bases) ) {
+ isSymbolic = true;
+ if ( isRef ) throw new IllegalArgumentException("Cannot tag a symbolic allele as the reference allele");
+ }
+// else
+// bases = new String(bases).toUpperCase().getBytes(); // todo -- slow performance
+
+ this.isRef = isRef;
+ this.bases = bases;
+
+ if ( ! acceptableAlleleBases(bases) )
+ throw new IllegalArgumentException("Unexpected base in allele bases " + new String(bases));
+ }
+
+ private Allele(String bases, boolean isRef) {
+ this(bases.getBytes(), isRef);
+ }
+
+
+ private final static Allele REF_A = new Allele("A", true);
+ private final static Allele ALT_A = new Allele("A", false);
+ private final static Allele REF_C = new Allele("C", true);
+ private final static Allele ALT_C = new Allele("C", false);
+ private final static Allele REF_G = new Allele("G", true);
+ private final static Allele ALT_G = new Allele("G", false);
+ private final static Allele REF_T = new Allele("T", true);
+ private final static Allele ALT_T = new Allele("T", false);
+ private final static Allele REF_N = new Allele("N", true);
+ private final static Allele ALT_N = new Allele("N", false);
+ private final static Allele REF_NULL = new Allele(NULL_ALLELE_STRING, true);
+ private final static Allele ALT_NULL = new Allele(NULL_ALLELE_STRING, false);
+ public final static Allele NO_CALL = new Allele(NO_CALL_STRING, false);
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // creation routines
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ /**
+ * Create a new Allele that includes bases and if tagged as the reference allele if isRef == true. If bases
+ * == '-', a Null allele is created. If bases == '.', a no call Allele is created.
+ *
+ * @param bases the DNA sequence of this variation, '-', of '.'
+ * @param isRef should we make this a reference allele?
+ * @throws IllegalArgumentException if bases contains illegal characters or is otherwise malformated
+ */
+ public static Allele create(byte[] bases, boolean isRef) {
+ if ( bases == null )
+ throw new IllegalArgumentException("create: the Allele base string cannot be null; use new Allele() or new Allele(\"\") to create a Null allele");
+
+ if ( bases.length == 1 ) {
+ // optimization to return a static constant Allele for each single base object
+ switch (bases[0]) {
+ case '.':
+ if ( isRef ) throw new IllegalArgumentException("Cannot tag a NoCall allele as the reference allele");
+ return NO_CALL;
+ case '-': return isRef ? REF_NULL : ALT_NULL;
+ case 'A': case 'a' : return isRef ? REF_A : ALT_A;
+ case 'C': case 'c' : return isRef ? REF_C : ALT_C;
+ case 'G': case 'g' : return isRef ? REF_G : ALT_G;
+ case 'T': case 't' : return isRef ? REF_T : ALT_T;
+ case 'N': case 'n' : return isRef ? REF_N : ALT_N;
+ default: throw new IllegalArgumentException("Illegal base: " + (char)bases[0]);
+ }
+ } else {
+ return new Allele(bases, isRef);
+ }
+ }
+
+ public static Allele create(byte base, boolean isRef) {
+// public Allele(byte base, boolean isRef) {
+ return create( new byte[]{ base }, isRef);
+ }
+
+ public static Allele create(byte base) {
+ return create( base, false );
+ }
+
+ public static Allele extend(Allele left, byte[] right) {
+ if (left.isSymbolic())
+ throw new IllegalArgumentException("Cannot extend a symbolic allele");
+ byte[] bases = null;
+ if ( left.length() == 0 )
+ bases = right;
+ else {
+ bases = new byte[left.length() + right.length];
+ System.arraycopy(left.getBases(), 0, bases, 0, left.length());
+ System.arraycopy(right, 0, bases, left.length(), right.length);
+ }
+
+ return create(bases, left.isReference());
+ }
+
+ /**
+ * @param bases bases representing an allele
+ * @return true if the bases represent the null allele
+ */
+ public static boolean wouldBeNullAllele(byte[] bases) {
+ return (bases.length == 1 && bases[0] == '-') || bases.length == 0;
+ }
+
+ /**
+ * @param bases bases representing an allele
+ * @return true if the bases represent the NO_CALL allele
+ */
+ public static boolean wouldBeNoCallAllele(byte[] bases) {
+ return bases.length == 1 && bases[0] == '.';
+ }
+
+ /**
+ * @param bases bases representing an allele
+ * @return true if the bases represent a symbolic allele
+ */
+ public static boolean wouldBeSymbolicAllele(byte[] bases) {
+ return bases.length > 2 && bases[0] == '<' && bases[bases.length-1] == '>';
+ }
+
+ /**
+ * @param bases bases representing an allele
+ * @return true if the bases represent the well formatted allele
+ */
+ public static boolean acceptableAlleleBases(String bases) {
+ return acceptableAlleleBases(bases.getBytes());
+ }
+
+ /**
+ * @param bases bases representing an allele
+ * @return true if the bases represent the well formatted allele
+ */
+ public static boolean acceptableAlleleBases(byte[] bases) {
+ if ( wouldBeNullAllele(bases) || wouldBeNoCallAllele(bases) || wouldBeSymbolicAllele(bases) )
+ return true;
+
+ for ( int i = 0; i < bases.length; i++ ) {
+ switch (bases[i]) {
+ case 'A': case 'C': case 'G': case 'T': case 'N' : case 'a': case 'c': case 'g': case 't': case 'n' :
+ break;
+ default:
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * @see Allele(byte[], boolean)
+ *
+ * @param bases bases representing an allele
+ * @param isRef is this the reference allele?
+ */
+ public static Allele create(String bases, boolean isRef) {
+ //public Allele(String bases, boolean isRef) {
+ return create(bases.getBytes(), isRef);
+ }
+
+
+ /**
+ * Creates a non-Ref allele. @see Allele(byte[], boolean) for full information
+ *
+ * @param bases bases representing an allele
+ */
+ public static Allele create(String bases) {
+ return create(bases, false);
+ }
+
+ /**
+ * Creates a non-Ref allele. @see Allele(byte[], boolean) for full information
+ *
+ * @param bases bases representing an allele
+ */
+ public static Allele create(byte[] bases) {
+ return create(bases, false);
+ //this(bases, false);
+ }
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // accessor routines
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ //Returns true if this is the null allele
+ public boolean isNull() { return isNull; }
+ // Returns true if this is not the null allele
+ public boolean isNonNull() { return ! isNull(); }
+
+ // Returns true if this is the NO_CALL allele
+ public boolean isNoCall() { return isNoCall; }
+ // Returns true if this is not the NO_CALL allele
+ public boolean isCalled() { return ! isNoCall(); }
+
+ // Returns true if this Allele is the reference allele
+ public boolean isReference() { return isRef; }
+ // Returns true if this Allele is not the reference allele
+ public boolean isNonReference() { return ! isReference(); }
+
+ // Returns true if this Allele is symbolic (i.e. no well-defined base sequence)
+ public boolean isSymbolic() { return isSymbolic; }
+
+ // Returns a nice string representation of this object
+ public String toString() {
+ return (isNull() ? NULL_ALLELE_STRING : ( isNoCall() ? NO_CALL_STRING : getDisplayString() )) + (isReference() ? "*" : "");
+ }
+
+ /**
+ * Return the DNA bases segregating in this allele. Note this isn't reference polarized,
+ * so the Null allele is represented by a vector of length 0
+ *
+ * @return the segregating bases
+ */
+ public byte[] getBases() { return isSymbolic ? EMPTY_ALLELE_BASES : bases; }
+
+ /**
+ * Return the DNA bases segregating in this allele in String format.
+ * This is useful, because toString() adds a '*' to reference alleles and getBases() returns garbage when you call toString() on it.
+ *
+ * @return the segregating bases
+ */
+ public String getBaseString() { return new String(getBases()); }
+
+ /**
+ * Return the printed representation of this allele.
+ * Same as getBaseString(), except for symbolic alleles.
+ * For symbolic alleles, the base string is empty while the display string contains .
+ *
+ * @return the allele string representation
+ */
+ public String getDisplayString() { return new String(bases); }
+
+ /**
+ * @param other the other allele
+ *
+ * @return true if these alleles are equal
+ */
+ public boolean equals(Object other) {
+ return ( ! (other instanceof Allele) ? false : equals((Allele)other, false) );
+ }
+
+ /**
+ * @return hash code
+ */
+ public int hashCode() {
+ int hash = 1;
+ for (int i = 0; i < bases.length; i++)
+ hash += (i+1) * bases[i];
+ return hash;
+ }
+
+ /**
+ * Returns true if this and other are equal. If ignoreRefState is true, then doesn't require both alleles has the
+ * same ref tag
+ *
+ * @param other allele to compare to
+ * @param ignoreRefState if true, ignore ref state in comparison
+ * @return true if this and other are equal
+ */
+ public boolean equals(Allele other, boolean ignoreRefState) {
+ return this == other || (isRef == other.isRef || ignoreRefState) && isNull == other.isNull && isNoCall == other.isNoCall && (bases == other.bases || Arrays.equals(bases, other.bases));
+ }
+
+ /**
+ * @param test bases to test against
+ *
+ * @return true if this Alelle contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
+ */
+ public boolean basesMatch(byte[] test) { return !isSymbolic && (bases == test || Arrays.equals(bases, test)); }
+
+ /**
+ * @param test bases to test against
+ *
+ * @return true if this Alelle contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
+ */
+ public boolean basesMatch(String test) { return basesMatch(test.toUpperCase().getBytes()); }
+
+ /**
+ * @param test allele to test against
+ *
+ * @return true if this Alelle contains the same bases as test, regardless of its reference status; handles Null and NO_CALL alleles
+ */
+ public boolean basesMatch(Allele test) { return basesMatch(test.getBases()); }
+
+ /**
+ * @return the length of this allele. Null and NO_CALL alleles have 0 length.
+ */
+ public int length() {
+ return isSymbolic ? 0 : bases.length;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // useful static functions
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ public static Allele getMatchingAllele(Collection allAlleles, String alleleBases) {
+ return getMatchingAllele(allAlleles, alleleBases.getBytes());
+ }
+
+ public static Allele getMatchingAllele(Collection allAlleles, byte[] alleleBases) {
+ for ( Allele a : allAlleles ) {
+ if ( a.basesMatch(alleleBases) ) {
+ return a;
+ }
+ }
+
+ if ( wouldBeNoCallAllele(alleleBases) )
+ return NO_CALL;
+ else
+ return null; // couldn't find anything
+ }
+
+ public static List resolveAlleles(List possibleAlleles, List alleleStrings) {
+ List myAlleles = new ArrayList(alleleStrings.size());
+
+ for ( String alleleString : alleleStrings ) {
+ Allele allele = getMatchingAllele(possibleAlleles, alleleString);
+
+ if ( allele == null ) {
+ if ( Allele.wouldBeNoCallAllele(alleleString.getBytes()) ) {
+ allele = create(alleleString);
+ } else {
+ throw new IllegalArgumentException("Allele " + alleleString + " not present in the list of alleles " + possibleAlleles);
+ }
+ }
+
+ myAlleles.add(allele);
+ }
+
+ return myAlleles;
+ }
+
+ public int compareTo(Allele other) {
+ if ( isReference() && other.isNonReference() )
+ return -1;
+ else if ( isNonReference() && other.isReference() )
+ return 1;
+ else
+ return getBaseString().compareTo(other.getBaseString()); // todo -- potential performance issue
+ }
+
+ public static boolean oneIsPrefixOfOther(Allele a1, Allele a2) {
+ if ( a1.isNull() || a2.isNull() )
+ return true;
+
+ if ( a2.length() >= a1.length() )
+ return firstIsPrefixOfSecond(a1, a2);
+ else
+ return firstIsPrefixOfSecond(a2, a1);
+ }
+
+ private static boolean firstIsPrefixOfSecond(Allele a1, Allele a2) {
+ String a1String = a1.getBaseString();
+ return a2.getBaseString().substring(0, a1String.length()).equals(a1String);
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/variantcontext/Genotype.java b/java/src/org/broadinstitute/sting/utils/variantcontext/Genotype.java
new file mode 100755
index 000000000..3a87f1196
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/variantcontext/Genotype.java
@@ -0,0 +1,279 @@
+package org.broadinstitute.sting.utils.variantcontext;
+
+
+import org.broad.tribble.util.ParsingUtils;
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+
+import java.util.*;
+
+/**
+ * This class encompasses all the basic information about a genotype. It is immutable.
+ *
+ * @author Mark DePristo
+ */
+public class Genotype {
+
+ public final static String PHASED_ALLELE_SEPARATOR = "|";
+ public final static String UNPHASED_ALLELE_SEPARATOR = "/";
+
+ protected InferredGeneticContext commonInfo;
+ public final static double NO_NEG_LOG_10PERROR = InferredGeneticContext.NO_NEG_LOG_10PERROR;
+ protected List alleles = null; // new ArrayList();
+
+ protected boolean isPhased = false;
+ private boolean filtersWereAppliedToContext;
+
+ public Genotype(String sampleName, List alleles, double negLog10PError, Set filters, Map attributes, boolean isPhased) {
+ this.alleles = Collections.unmodifiableList(alleles);
+ commonInfo = new InferredGeneticContext(sampleName, negLog10PError, filters, attributes);
+ filtersWereAppliedToContext = filters != null;
+ this.isPhased = isPhased;
+ validate();
+ }
+
+ public Genotype(String sampleName, List alleles, double negLog10PError) {
+ this(sampleName, alleles, negLog10PError, null, null, false);
+ }
+
+ public Genotype(String sampleName, List alleles) {
+ this(sampleName, alleles, NO_NEG_LOG_10PERROR, null, null, false);
+ }
+
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // Partial-cloning routines (because Genotype is immutable).
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ public static Genotype modifyName(Genotype g, String name) {
+ return new Genotype(name, g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
+ }
+
+ public static Genotype modifyAttributes(Genotype g, Map attributes) {
+ return new Genotype(g.getSampleName(), g.getAlleles(), g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, attributes, g.isPhased());
+ }
+
+ public static Genotype modifyAlleles(Genotype g, List alleles) {
+ return new Genotype(g.getSampleName(), alleles, g.getNegLog10PError(), g.filtersWereApplied() ? g.getFilters() : null, g.getAttributes(), g.isPhased());
+ }
+
+ /**
+ * @return the alleles for this genotype
+ */
+ public List getAlleles() {
+ return alleles;
+ }
+
+ public List getAlleles(Allele allele) {
+ List al = new ArrayList();
+ for ( Allele a : alleles )
+ if ( a.equals(allele) )
+ al.add(a);
+
+ return Collections.unmodifiableList(al);
+ }
+
+ public Allele getAllele(int i) {
+ return alleles.get(i);
+ }
+
+ public boolean isPhased() { return isPhased; }
+
+ /**
+ * @return the ploidy of this genotype
+ */
+ public int getPloidy() { return alleles.size(); }
+
+ public enum Type {
+ NO_CALL,
+ HOM_REF,
+ HET,
+ HOM_VAR
+ }
+
+ public Type getType() {
+ Allele firstAllele = alleles.get(0);
+
+ if ( firstAllele.isNoCall() ) {
+ return Type.NO_CALL;
+ }
+
+ for (Allele a : alleles) {
+ if ( ! firstAllele.equals(a) )
+ return Type.HET;
+ }
+ return firstAllele.isReference() ? Type.HOM_REF : Type.HOM_VAR;
+ }
+
+ /**
+ * @return true if all observed alleles are the same (regardless of whether they are ref or alt)
+ */
+ public boolean isHom() { return isHomRef() || isHomVar(); }
+ public boolean isHomRef() { return getType() == Type.HOM_REF; }
+ public boolean isHomVar() { return getType() == Type.HOM_VAR; }
+
+ /**
+ * @return true if we're het (observed alleles differ)
+ */
+ public boolean isHet() { return getType() == Type.HET; }
+
+ /**
+ * @return true if this genotype is not actually a genotype but a "no call" (e.g. './.' in VCF)
+ */
+ public boolean isNoCall() { return getType() == Type.NO_CALL; }
+ public boolean isCalled() { return getType() != Type.NO_CALL; }
+
+ //
+ // Useful methods for getting genotype likelihoods for a genotype object, if present
+ //
+ public boolean hasLikelihoods() {
+ return (hasAttribute(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY) && !getAttribute(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY).equals(VCFConstants.MISSING_VALUE_v4)) ||
+ (hasAttribute(VCFConstants.GENOTYPE_LIKELIHOODS_KEY) && !getAttribute(VCFConstants.GENOTYPE_LIKELIHOODS_KEY).equals(VCFConstants.MISSING_VALUE_v4));
+ }
+
+ public GenotypeLikelihoods getLikelihoods() {
+ GenotypeLikelihoods x = getLikelihoods(VCFConstants.PHRED_GENOTYPE_LIKELIHOODS_KEY, true);
+ if ( x != null )
+ return x;
+ else {
+ x = getLikelihoods(VCFConstants.GENOTYPE_LIKELIHOODS_KEY, false);
+ if ( x != null ) return x;
+ else
+ throw new IllegalStateException("BUG: genotype likelihood field in " + this.getSampleName() + " sample are not either a string or a genotype likelihood class!");
+ }
+ }
+
+ private GenotypeLikelihoods getLikelihoods(String key, boolean asPL) {
+ Object x = getAttribute(key);
+ if ( x instanceof String ) {
+ if ( asPL )
+ return GenotypeLikelihoods.fromPLField((String)x);
+ else
+ return GenotypeLikelihoods.fromGLField((String)x);
+ }
+ else if ( x instanceof GenotypeLikelihoods ) return (GenotypeLikelihoods)x;
+ else return null;
+ }
+
+ public void validate() {
+ if ( alleles == null ) throw new IllegalArgumentException("BUG: alleles cannot be null in setAlleles");
+ if ( alleles.size() == 0) throw new IllegalArgumentException("BUG: alleles cannot be of size 0 in setAlleles");
+
+ int nNoCalls = 0;
+ for ( Allele allele : alleles ) {
+ if ( allele == null )
+ throw new IllegalArgumentException("BUG: allele cannot be null in Genotype");
+ nNoCalls += allele.isNoCall() ? 1 : 0;
+ }
+ if ( nNoCalls > 0 && nNoCalls != alleles.size() )
+ throw new IllegalArgumentException("BUG: alleles include some No Calls and some Calls, an illegal state " + this);
+ }
+
+ public String getGenotypeString() {
+ return getGenotypeString(true);
+ }
+
+ public String getGenotypeString(boolean ignoreRefState) {
+ // Notes:
+ // 1. Make sure to use the appropriate separator depending on whether the genotype is phased
+ // 2. If ignoreRefState is true, then we want just the bases of the Alleles (ignoring the '*' indicating a ref Allele)
+ // 3. So that everything is deterministic with regards to integration tests, we sort Alleles (when the genotype isn't phased, of course)
+ return ParsingUtils.join(isPhased() ? PHASED_ALLELE_SEPARATOR : UNPHASED_ALLELE_SEPARATOR,
+ ignoreRefState ? getAlleleStrings() : (isPhased() ? getAlleles() : ParsingUtils.sortList(getAlleles())));
+ }
+
+ private List getAlleleStrings() {
+ List al = new ArrayList();
+ for ( Allele a : alleles )
+ al.add(a.getBaseString());
+
+ return al;
+ }
+
+ public String toString() {
+ int Q = (int)Math.round(getPhredScaledQual());
+ return String.format("[%s %s Q%s %s]", getSampleName(), getGenotypeString(false),
+ Q == -10 ? "." : String.format("%2d",Q), sortedString(getAttributes()));
+ }
+
+ public String toBriefString() {
+ return String.format("%s:Q%.2f", getGenotypeString(false), getPhredScaledQual());
+ }
+
+ public boolean sameGenotype(Genotype other) {
+ return sameGenotype(other, true);
+ }
+
+ public boolean sameGenotype(Genotype other, boolean ignorePhase) {
+ if (getPloidy() != other.getPloidy())
+ return false; // gotta have the same number of allele to be equal
+
+ // By default, compare the elements in the lists of alleles, element-by-element
+ Collection thisAlleles = this.getAlleles();
+ Collection otherAlleles = other.getAlleles();
+
+ if (ignorePhase) { // do not care about order, only identity of Alleles
+ thisAlleles = new TreeSet(thisAlleles); //implemented Allele.compareTo()
+ otherAlleles = new TreeSet(otherAlleles);
+ }
+
+ return thisAlleles.equals(otherAlleles);
+ }
+
+ /**
+ * a utility method for generating sorted strings from a map key set.
+ * @param c the map
+ * @param the key type
+ * @param the value type
+ * @return a sting, enclosed in {}, with comma seperated key value pairs in order of the keys
+ */
+ public static , V> String sortedString(Map c) {
+ List t = new ArrayList(c.keySet());
+ Collections.sort(t);
+
+ List pairs = new ArrayList();
+ for (T k : t) {
+ pairs.add(k + "=" + c.get(k));
+ }
+
+ return "{" + ParsingUtils.join(", ", pairs.toArray(new String[pairs.size()])) + "}";
+ }
+
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // get routines to access context info fields
+ //
+ // ---------------------------------------------------------------------------------------------------------
+ public String getSampleName() { return commonInfo.getName(); }
+ public Set getFilters() { return commonInfo.getFilters(); }
+ public boolean isFiltered() { return commonInfo.isFiltered(); }
+ public boolean isNotFiltered() { return commonInfo.isNotFiltered(); }
+ public boolean filtersWereApplied() { return filtersWereAppliedToContext; }
+ public boolean hasNegLog10PError() { return commonInfo.hasNegLog10PError(); }
+ public double getNegLog10PError() { return commonInfo.getNegLog10PError(); }
+ public double getPhredScaledQual() { return commonInfo.getPhredScaledQual(); }
+
+ public Map getAttributes() { return commonInfo.getAttributes(); }
+ public boolean hasAttribute(String key) { return commonInfo.hasAttribute(key); }
+ public Object getAttribute(String key) { return commonInfo.getAttribute(key); }
+
+ public Object getAttribute(String key, Object defaultValue) {
+ return commonInfo.getAttribute(key, defaultValue);
+ }
+
+ public String getAttributeAsString(String key) { return commonInfo.getAttributeAsString(key); }
+ public String getAttributeAsString(String key, String defaultValue) { return commonInfo.getAttributeAsString(key, defaultValue); }
+ public int getAttributeAsInt(String key) { return commonInfo.getAttributeAsInt(key); }
+ public int getAttributeAsInt(String key, int defaultValue) { return commonInfo.getAttributeAsInt(key, defaultValue); }
+ public double getAttributeAsDouble(String key) { return commonInfo.getAttributeAsDouble(key); }
+ public double getAttributeAsDouble(String key, double defaultValue) { return commonInfo.getAttributeAsDouble(key, defaultValue); }
+ public boolean getAttributeAsBoolean(String key) { return commonInfo.getAttributeAsBoolean(key); }
+ public boolean getAttributeAsBoolean(String key, boolean defaultValue) { return commonInfo.getAttributeAsBoolean(key, defaultValue); }
+
+ public Integer getAttributeAsIntegerNoException(String key) { return commonInfo.getAttributeAsIntegerNoException(key); }
+ public Double getAttributeAsDoubleNoException(String key) { return commonInfo.getAttributeAsDoubleNoException(key); }
+ public String getAttributeAsStringNoException(String key) { return commonInfo.getAttributeAsStringNoException(key); }
+ public Boolean getAttributeAsBooleanNoException(String key) { return commonInfo.getAttributeAsBooleanNoException(key); }
+}
\ No newline at end of file
diff --git a/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java
new file mode 100755
index 000000000..3feaf5e1c
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/variantcontext/GenotypeLikelihoods.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2010, The Broad Institute
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package org.broadinstitute.sting.utils.variantcontext;
+
+import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants;
+import org.broad.tribble.TribbleException;
+
+public class GenotypeLikelihoods {
+ public static final boolean CAP_PLS = false;
+ public static final int PL_CAP = 255;
+
+ //
+ // There are two objects here because we are lazy in creating both representations
+ // for this object: a vector of log10 Probs and the PL phred-scaled string. Supports
+ // having one set during initializating, and dynamic creation of the other, if needed
+ //
+ private double[] log10Likelihoods = null;
+ private String likelihoodsAsString_PLs = null;
+
+ public final static GenotypeLikelihoods fromPLField(String PLs) {
+ return new GenotypeLikelihoods(PLs);
+ }
+
+ public final static GenotypeLikelihoods fromGLField(String GLs) {
+ return new GenotypeLikelihoods(parseDeprecatedGLString(GLs));
+ }
+
+ public final static GenotypeLikelihoods fromLog10Likelihoods(double[] log10Likelihoods) {
+ return new GenotypeLikelihoods(log10Likelihoods);
+ }
+
+ //
+ // You must use the factory methods now
+ //
+ protected GenotypeLikelihoods(String asString) {
+ likelihoodsAsString_PLs = asString;
+ }
+
+ protected GenotypeLikelihoods(double[] asVector) {
+ log10Likelihoods = asVector;
+ }
+
+ /**
+ * Returns the genotypes likelihoods in negative log10 vector format. pr{AA} = x, this
+ * vector returns math.log10(x) for each of the genotypes. Can return null if the
+ * genotype likelihoods are "missing".
+ *
+ * @return
+ */
+ public double[] getAsVector() {
+ // assumes one of the likelihoods vector or the string isn't null
+ if ( log10Likelihoods == null ) {
+ // make sure we create the GL string if it doesn't already exist
+ log10Likelihoods = parsePLsIntoLikelihoods(likelihoodsAsString_PLs);
+ }
+
+ return log10Likelihoods;
+ }
+
+ public String toString() {
+ return getAsString();
+ }
+
+ public String getAsString() {
+ if ( likelihoodsAsString_PLs == null ) {
+ // todo -- should we accept null log10Likelihoods and set PLs as MISSING?
+ if ( log10Likelihoods == null )
+ throw new TribbleException("BUG: Attempted to get likelihoods as strings and neither the vector nor the string is set!");
+ likelihoodsAsString_PLs = convertLikelihoodsToPLString(log10Likelihoods);
+ }
+
+ return likelihoodsAsString_PLs;
+ }
+
+ private final static double[] parsePLsIntoLikelihoods(String likelihoodsAsString_PLs) {
+ if ( !likelihoodsAsString_PLs.equals(VCFConstants.MISSING_VALUE_v4) ) {
+ String[] strings = likelihoodsAsString_PLs.split(",");
+ double[] likelihoodsAsVector = new double[strings.length];
+ for ( int i = 0; i < strings.length; i++ ) {
+ likelihoodsAsVector[i] = Integer.parseInt(strings[i]) / -10.0;
+ }
+ return likelihoodsAsVector;
+ } else
+ return null;
+ }
+
+ /**
+ * Back-compatibility function to read old style GL formatted genotype likelihoods in VCF format
+ * @param GLString
+ * @return
+ */
+ private final static double[] parseDeprecatedGLString(String GLString) {
+ if ( !GLString.equals(VCFConstants.MISSING_VALUE_v4) ) {
+ String[] strings = GLString.split(",");
+ double[] likelihoodsAsVector = new double[strings.length];
+ for ( int i = 0; i < strings.length; i++ ) {
+ likelihoodsAsVector[i] = Double.parseDouble(strings[i]);
+ }
+ return likelihoodsAsVector;
+ }
+
+ return null;
+ }
+
+ private final static String convertLikelihoodsToPLString(double[] GLs) {
+ if ( GLs == null )
+ return VCFConstants.MISSING_VALUE_v4;
+
+ StringBuilder s = new StringBuilder();
+
+ double adjust = Double.NEGATIVE_INFINITY;
+ for ( double l : GLs ) adjust = Math.max(adjust, l);
+
+ boolean first = true;
+ for ( double l : GLs ) {
+ if ( ! first )
+ s.append(",");
+ else
+ first = false;
+
+ long PL = Math.round(-10 * (l - adjust));
+ if ( CAP_PLS )
+ PL = Math.min(PL, PL_CAP);
+ s.append(Long.toString(PL));
+ }
+
+ return s.toString();
+ }
+}
diff --git a/java/src/org/broadinstitute/sting/utils/variantcontext/InferredGeneticContext.java b/java/src/org/broadinstitute/sting/utils/variantcontext/InferredGeneticContext.java
new file mode 100755
index 000000000..3d162adb0
--- /dev/null
+++ b/java/src/org/broadinstitute/sting/utils/variantcontext/InferredGeneticContext.java
@@ -0,0 +1,230 @@
+package org.broadinstitute.sting.utils.variantcontext;
+
+
+import java.util.*;
+
+
+/**
+ * Common utility routines for VariantContext and Genotype
+ *
+ * @author depristo
+ */
+public final class InferredGeneticContext {
+ public static final double NO_NEG_LOG_10PERROR = -1.0;
+
+ private static Set NO_FILTERS = Collections.unmodifiableSet(new HashSet());
+ private static Map NO_ATTRIBUTES = Collections.unmodifiableMap(new HashMap());
+
+ private double negLog10PError = NO_NEG_LOG_10PERROR;
+ private String name = null;
+ private Set filters = NO_FILTERS;
+ private Map attributes = NO_ATTRIBUTES;
+
+// public InferredGeneticContext(String name) {
+// this.name = name;
+// }
+//
+// public InferredGeneticContext(String name, double negLog10PError) {
+// this(name);
+// setNegLog10PError(negLog10PError);
+// }
+
+ public InferredGeneticContext(String name, double negLog10PError, Set filters, Map attributes) {
+ this.name = name;
+ setNegLog10PError(negLog10PError);
+ if ( filters != null )
+ setFilters(filters);
+ if ( attributes != null )
+ setAttributes(attributes);
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Sets the name
+ *
+ * @param name the name associated with this information
+ */
+ public void setName(String name) {
+ if ( name == null ) throw new IllegalArgumentException("Name cannot be null " + this);
+ this.name = name;
+ }
+
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // Filter
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ public Set getFilters() {
+ return Collections.unmodifiableSet(filters);
+ }
+
+ public boolean isFiltered() {
+ return filters.size() > 0;
+ }
+
+ public boolean isNotFiltered() {
+ return ! isFiltered();
+ }
+
+ public void addFilter(String filter) {
+ if ( filters == NO_FILTERS ) // immutable -> mutable
+ filters = new HashSet(filters);
+
+ if ( filter == null ) throw new IllegalArgumentException("BUG: Attempting to add null filter " + this);
+ if ( getFilters().contains(filter) ) throw new IllegalArgumentException("BUG: Attempting to add duplicate filter " + filter + " at " + this);
+ filters.add(filter);
+ }
+
+ public void addFilters(Collection filters) {
+ if ( filters == null ) throw new IllegalArgumentException("BUG: Attempting to add null filters at" + this);
+ for ( String f : filters )
+ addFilter(f);
+ }
+
+ public void clearFilters() {
+ filters = new HashSet();
+ }
+
+ public void setFilters(Collection filters) {
+ clearFilters();
+ addFilters(filters);
+ }
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // Working with log error rates
+ //
+ // ---------------------------------------------------------------------------------------------------------
+
+ public boolean hasNegLog10PError() {
+ return getNegLog10PError() != NO_NEG_LOG_10PERROR;
+ }
+
+ /**
+ * @return the -1 * log10-based error estimate
+ */
+ public double getNegLog10PError() { return negLog10PError; }
+ public double getPhredScaledQual() { return getNegLog10PError() * 10; }
+
+ public void setNegLog10PError(double negLog10PError) {
+ if ( negLog10PError < 0 && negLog10PError != NO_NEG_LOG_10PERROR ) throw new IllegalArgumentException("BUG: negLog10PError cannot be < than 0 : " + negLog10PError);
+ if ( Double.isInfinite(negLog10PError) ) throw new IllegalArgumentException("BUG: negLog10PError should not be Infinity");
+ if ( Double.isNaN(negLog10PError) ) throw new IllegalArgumentException("BUG: negLog10PError should not be NaN");
+
+ this.negLog10PError = negLog10PError;
+ }
+
+ // ---------------------------------------------------------------------------------------------------------
+ //
+ // Working with attributes
+ //
+ // ---------------------------------------------------------------------------------------------------------
+ public void clearAttributes() {
+ attributes = new HashMap();
+ }
+
+ /**
+ * @return the attribute map
+ */
+ public Map getAttributes() {
+ return Collections.unmodifiableMap(attributes);
+ }
+
+ // todo -- define common attributes as enum
+
+ public void setAttributes(Map map) {
+ clearAttributes();
+ putAttributes(map);
+ }
+
+ public void putAttribute(String key, Object value) {
+ putAttribute(key, value, false);
+ }
+
+ public void putAttribute(String key, Object value, boolean allowOverwrites) {
+ if ( ! allowOverwrites && hasAttribute(key) )
+ throw new IllegalStateException("Attempting to overwrite key->value binding: key = " + key + " this = " + this);
+
+ if ( attributes == NO_ATTRIBUTES ) // immutable -> mutable
+ attributes = new HashMap();
+
+ attributes.put(key, value);
+ }
+
+ public void removeAttribute(String key) {
+ if ( attributes == NO_ATTRIBUTES ) // immutable -> mutable
+ attributes = new HashMap();
+ attributes.remove(key);
+ }
+
+ public void putAttributes(Map map) {
+ if ( map != null ) {
+ // for efficiency, we can skip the validation if the map is empty
+ if ( attributes.size() == 0 ) {
+ if ( attributes == NO_ATTRIBUTES ) // immutable -> mutable
+ attributes = new HashMap();
+ attributes.putAll(map);
+ } else {
+ for ( Map.Entry elt : map.entrySet() ) {
+ putAttribute(elt.getKey(), elt.getValue(), false);
+ }
+ }
+ }
+ }
+
+ public boolean hasAttribute(String key) {
+ return attributes.containsKey(key);
+ }
+
+ public int getNumAttributes() {
+ return attributes.size();
+ }
+
+ /**
+ * @param key the attribute key
+ *
+ * @return the attribute value for the given key (or null if not set)
+ */
+ public Object getAttribute(String key) {
+ return attributes.get(key);
+ }
+
+ public Object getAttribute(String key, Object defaultValue) {
+ if ( hasAttribute(key) )
+ return attributes.get(key);
+ else
+ return defaultValue;
+ }
+
+// public AttributedObject getAttributes(Collection