diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java index 2a004aaca..66bf562d7 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java @@ -153,9 +153,12 @@ public class CombineReferenceCalculationVariants extends RodWalker vcfRods = GATKVCFUtils.getVCFHeadersFromRods(getToolkit()); - final Set samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE); final Set headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true); headerLines.addAll(Arrays.asList(ChromosomeCountConstants.descriptions)); + if ( dbsnp != null && dbsnp.dbsnp.isBound() ) + VCFStandardHeaderLines.addStandardInfoLines(headerLines, true, VCFConstants.DBSNP_KEY); + + final Set samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE); final VCFHeader vcfHeader = new VCFHeader(headerLines, samples); vcfWriter.writeHeader(vcfHeader); @@ -204,7 +207,7 @@ public class CombineReferenceCalculationVariants extends RodWalker trackSequences = new TreeSet(); for (SAMSequenceRecord dictionaryEntry : trackDict.getSequences()) diff --git a/public/gatk-framework/src/main/java/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrackBuilder.java b/public/gatk-framework/src/main/java/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrackBuilder.java index 4c50cfaae..a587a3984 100644 --- a/public/gatk-framework/src/main/java/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrackBuilder.java +++ b/public/gatk-framework/src/main/java/org/broadinstitute/sting/gatk/refdata/tracks/RMDTrackBuilder.java @@ -34,6 +34,7 @@ import org.broad.tribble.TribbleException; import org.broad.tribble.index.Index; import org.broad.tribble.index.IndexFactory; import org.broad.tribble.util.LittleEndianOutputStream; +import org.broad.tribble.util.TabixUtils; import org.broadinstitute.sting.commandline.Tags; import org.broadinstitute.sting.gatk.GenomeAnalysisEngine; import org.broadinstitute.sting.gatk.arguments.ValidationExclusion; @@ -169,9 +170,11 @@ public class RMDTrackBuilder { // extends PluginManager { */ private Pair createTabixIndexedFeatureSource(FeatureManager.FeatureDescriptor descriptor, String name, File inputFile) { // we might not know the index type, try loading with the default reader constructor - logger.info("Attempting to blindly load " + inputFile + " as a tabix indexed file"); + logger.debug("Attempting to load " + inputFile + " as a tabix indexed file without validating it"); try { - return new Pair(AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), createCodec(descriptor, name)),null); + final File indexFile = new File(inputFile.getAbsoluteFile() + TabixUtils.STANDARD_INDEX_EXTENSION); + final SAMSequenceDictionary dict = TabixUtils.getSequenceDictionary(indexFile); + return new Pair<>(AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), createCodec(descriptor, name)), dict); } catch (TribbleException e) { throw new UserException(e.getMessage(), e); } @@ -318,7 +321,7 @@ public class RMDTrackBuilder { // extends PluginManager { * @return an Index, or null if we're unable to load */ protected Index loadFromDisk( final File inputFile, final File indexFile ) { - logger.info("Loading Tribble index from disk for file " + inputFile); + logger.debug("Loading Tribble index from disk for file " + inputFile); Index index = IndexFactory.loadIndex(indexFile.getAbsolutePath()); // check if the file is up-to date (filestamp and version check) @@ -384,7 +387,7 @@ public class RMDTrackBuilder { // extends PluginManager { */ protected Index createIndexInMemory(File inputFile, FeatureCodec codec) { // this can take a while, let them know what we're doing - logger.info("Creating Tribble index in memory for file " + inputFile); + logger.debug("Creating Tribble index in memory for file " + inputFile); Index idx = IndexFactory.createDynamicIndex(inputFile, codec, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME); validateAndUpdateIndexSequenceDictionary(inputFile, idx, dict); return idx; diff --git a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java index e8ce80d07..e1ed63bc0 100644 --- a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java +++ b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java @@ -1045,8 +1045,9 @@ public class GATKVariantContextUtils { * @return new VariantContext representing the merge of all VCs or null if it not relevant */ public static VariantContext referenceConfidenceMerge(final List VCs, final GenomeLoc loc, final Byte refBase) { - - if ( VCs == null || VCs.size() == 0 ) throw new IllegalArgumentException("VCs cannot be null or empty"); + // this can happen if e.g. you are using a dbSNP file that spans a region with no gVCFs + if ( VCs == null || VCs.size() == 0 ) + return null; // establish the baseline info (sometimes from the first VC) final VariantContext first = VCs.get(0); @@ -1536,6 +1537,8 @@ public class GATKVariantContextUtils { final List remappedAlleles, final List targetAlleles) { for ( final Genotype g : VC.getGenotypes() ) { + if ( !g.hasPL() ) + throw new UserException("cannot merge genotypes from samples without PLs; sample " + g.getSampleName() + " does not have likelihoods at position " + VC.getChr() + ":" + VC.getStart()); // only add if the name is new final String name = g.getSampleName();