diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/annotator/AnnotatorInputTableCodec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/annotator/AnnotatorInputTableCodec.java index 3b9cb25ee..a50679052 100755 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/annotator/AnnotatorInputTableCodec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/annotator/AnnotatorInputTableCodec.java @@ -69,6 +69,11 @@ public class AnnotatorInputTableCodec implements FeatureCodec HeaderType getHeader(Class clazz) throws ClassCastException { + return null; // TODO: do we want the header to be a concrete type? + } + /** * Parses the line into an AnnotatorInputTableFeature object. diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/sampileup/SAMPileupCodec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/sampileup/SAMPileupCodec.java index 5efc5e632..f239f9dcc 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/sampileup/SAMPileupCodec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/sampileup/SAMPileupCodec.java @@ -71,6 +71,11 @@ public class SAMPileupCodec implements FeatureCodec { return SAMPileupFeature.class; } + @Override + public HeaderType getHeader(Class clazz) throws ClassCastException { + return null; // we don't have a header + } + public SAMPileupFeature decode(String line) { // 0 1 2 3 4 5 6 7 //* chrX 466 T Y 170 170 88 32 ... (piles of read bases and quals follow) diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/samread/SAMReadCodec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/samread/SAMReadCodec.java index 7542dd86c..893f8a85e 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/samread/SAMReadCodec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/samread/SAMReadCodec.java @@ -61,6 +61,11 @@ public class SAMReadCodec implements FeatureCodec { return SAMReadFeature.class; } + @Override + public HeaderType getHeader(Class clazz) throws ClassCastException { + return null; // we haven't stored the header + } + /** * Decode a single line in a SAM text file. * @param line line to decode. diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java index 49b07f21b..5267fb074 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/features/vcf4/VCF4Codec.java @@ -280,4 +280,9 @@ public class VCF4Codec implements FeatureCodec { public Class getFeatureType() { return VariantContext.class; } + + @Override + public Object getHeader(Class clazz) throws ClassCastException { + return null; // TODO: fix this Aaron + } } diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrack.java b/java/src/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrack.java index fb54417d2..c4c59933f 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrack.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrack.java @@ -84,18 +84,6 @@ public abstract class RMDTrack { */ public abstract CloseableIterator getIterator(); - /** - * helper function for determining if we are the same track based on name and codec type - * - * @param name the name to match - * @param type the type to match - * - * @return true on a match, false if the name or type is different - */ - public boolean matchesNameAndType(String name, Type type) { - return (name.equals(this.name) && (type.getClass().isAssignableFrom(this.type.getClass()))); - } - /** * helper function for determining if we are the same track based on name and record type * @@ -121,4 +109,15 @@ public abstract class RMDTrack { public SAMSequenceDictionary getSequenceDictionary() { return null; // default, others can override this } + + /** + * ask for the header, supplying the expected type. Overridden in track types + * @param clazz the class of the expected type + * @param the expected type + * @return a object of type HeaderType + * @throws ClassCastException if the class provided doesn't match our header type + */ + public HeaderType getHeader(Class clazz) throws ClassCastException { + return null; + } } \ No newline at end of file diff --git a/java/src/org/broadinstitute/sting/gatk/refdata/tracks/TribbleTrack.java b/java/src/org/broadinstitute/sting/gatk/refdata/tracks/TribbleTrack.java index ccdcf10f7..18472eca6 100644 --- a/java/src/org/broadinstitute/sting/gatk/refdata/tracks/TribbleTrack.java +++ b/java/src/org/broadinstitute/sting/gatk/refdata/tracks/TribbleTrack.java @@ -130,4 +130,15 @@ public class TribbleTrack extends RMDTrack implements QueryableTrack { public SAMSequenceDictionary getSequenceDictionary() { return dictionary; } + + /** + * ask for the header, supplying the expected type. Overridden in track types + * @param clazz the class of the expected type + * @param the expected type + * @return a object of type HeaderType + * @throws ClassCastException if the class provided doesn't match our header type + */ + public HeaderType getHeader(Class clazz) throws ClassCastException { + return (HeaderType) (reader).getHeader(clazz); + } } 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 59cbe1349..ac50c458f 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrator.java @@ -92,6 +92,9 @@ public class VariantRecalibrator extends RodWalker hInfo = new HashSet(); - hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); - hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "The original variant quality score")); - hInfo.add(new VCFHeaderLine("source", "VariantOptimizer")); - vcfWriter = new VCFWriter( new File(OUTPUT_PREFIX + ".vcf") ); final TreeSet samples = new TreeSet(); final List dataSources = this.getToolkit().getRodDataSources(); - for( final ReferenceOrderedDataSource source : dataSources ) { - final RMDTrack rod = source.getReferenceOrderedData(); - if( rod.getRecordType().equals(VCFRecord.class) ) { - final VCFReader reader = new VCFReader(rod.getFile()); - final Set vcfSamples = reader.getHeader().getGenotypeSamples(); - samples.addAll(vcfSamples); - reader.close(); + + if (AARONS_SUPER_AWESOME_SWITCH) { + hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); + hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "The original variant quality score")); + hInfo.add(new VCFHeaderLine("source", "VariantOptimizer")); + samples.addAll(SampleUtils.getUniqueSamplesFromRods(getToolkit())); + + } else { + hInfo.addAll(VCFUtils.getHeaderFields(getToolkit())); + hInfo.add(new VCFInfoHeaderLine("OQ", 1, VCFInfoHeaderLine.INFO_TYPE.Float, "The original variant quality score")); + hInfo.add(new VCFHeaderLine("source", "VariantOptimizer")); + for( final ReferenceOrderedDataSource source : dataSources ) { + final RMDTrack rod = source.getReferenceOrderedData(); + if( rod.getRecordType().equals(VCFRecord.class) ) { + final VCFReader reader = new VCFReader(rod.getFile()); + final Set vcfSamples = reader.getHeader().getGenotypeSamples(); + samples.addAll(vcfSamples); + reader.close(); + } } } + vcfWriter = new VCFWriter( new File(OUTPUT_PREFIX + ".vcf") ); final VCFHeader vcfHeader = new VCFHeader(hInfo, samples); vcfWriter.writeHeader(vcfHeader); diff --git a/java/src/org/broadinstitute/sting/utils/SampleUtils.java b/java/src/org/broadinstitute/sting/utils/SampleUtils.java index 87a5b19b5..0247e827b 100755 --- a/java/src/org/broadinstitute/sting/utils/SampleUtils.java +++ b/java/src/org/broadinstitute/sting/utils/SampleUtils.java @@ -27,13 +27,12 @@ package org.broadinstitute.sting.utils; import net.sf.samtools.SAMFileHeader; import net.sf.samtools.SAMReadGroupRecord; -import org.broad.tribble.vcf.VCFCodec; +import org.broad.tribble.vcf.VCFHeader; import org.broad.tribble.vcf.VCFRecord; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.gatk.datasources.simpleDataSources.ReferenceOrderedDataSource; import org.broadinstitute.sting.gatk.refdata.tracks.RMDTrack; import org.broadinstitute.sting.utils.collections.Pair; -import org.broadinstitute.sting.utils.genotype.vcf.VCFReader; import java.util.*; @@ -80,11 +79,8 @@ public class SampleUtils { List dataSources = toolkit.getRodDataSources(); for ( ReferenceOrderedDataSource source : dataSources ) { RMDTrack rod = source.getReferenceOrderedData(); - if ( rod.getRecordType().equals(VCFRecord.class) ) { - VCFReader reader = new VCFReader(rod.getFile()); - samples.addAll(reader.getHeader().getGenotypeSamples()); - reader.close(); - } + if ( rod.getRecordType().equals(VCFRecord.class) ) + samples.addAll(rod.getHeader(VCFHeader.class).getGenotypeSamples()); } return samples; @@ -110,11 +106,9 @@ public class SampleUtils { for ( ReferenceOrderedDataSource source : dataSources ) { RMDTrack rod = source.getReferenceOrderedData(); if ( rod.getRecordType().equals(VCFRecord.class) ) { - VCFReader reader = new VCFReader(rod.getFile()); - Set vcfSamples = reader.getHeader().getGenotypeSamples(); + Set vcfSamples = rod.getHeader(VCFHeader.class).getGenotypeSamples(); for ( String sample : vcfSamples ) addUniqueSample(samples, sampleOverlapMap, rodNamesToSampleNames, sample, rod.getName()); - reader.close(); } } } diff --git a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFReader.java b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFReader.java index 34180f66b..6dfd757cc 100644 --- a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFReader.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFReader.java @@ -69,7 +69,7 @@ public class VCFReader implements Iterator, Iterable { } catch (IOException e) { throw new StingException("Unable to read VCF File from " + vcfFile, e); } - mHeader = codec.getHeader(); + mHeader = codec.getHeader(VCFHeader.class); } /** diff --git a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java index 4f7ff2951..9064de4e5 100755 --- a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java @@ -74,9 +74,7 @@ public class VCFUtils { for ( ReferenceOrderedDataSource source : dataSources ) { RMDTrack rod = source.getReferenceOrderedData(); if ( rod.getRecordType().equals(VCFRecord.class) ) { - VCFReader reader = new VCFReader(rod.getFile()); - fields.addAll(reader.getHeader().getMetaData()); - reader.close(); + fields.addAll(rod.getHeader(VCFHeader.class).getMetaData()); } } diff --git a/settings/repository/org.broad/tribble-99.jar b/settings/repository/org.broad/tribble-100.jar similarity index 89% rename from settings/repository/org.broad/tribble-99.jar rename to settings/repository/org.broad/tribble-100.jar index 47066f7e1..bd8864848 100644 Binary files a/settings/repository/org.broad/tribble-99.jar and b/settings/repository/org.broad/tribble-100.jar differ diff --git a/settings/repository/org.broad/tribble-100.xml b/settings/repository/org.broad/tribble-100.xml new file mode 100644 index 000000000..eaf39336a --- /dev/null +++ b/settings/repository/org.broad/tribble-100.xml @@ -0,0 +1,3 @@ + + + diff --git a/settings/repository/org.broad/tribble-99.xml b/settings/repository/org.broad/tribble-99.xml deleted file mode 100644 index 1f3e1b70c..000000000 --- a/settings/repository/org.broad/tribble-99.xml +++ /dev/null @@ -1,3 +0,0 @@ - - -