Source:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); final boolean requiresIndex = this.TARGET_INTERVALS != null || this.THREAD_COUNT > 1; final VCFFileReader variantReader = new VCFFileReader(INPUT, requiresIndex); final SAMSequenceDictionary sequenceDictionary; if (SEQUENCE_DICTIONARY != null) { sequenceDictionary = SAMFileReader.getSequenceDictionary(SEQUENCE_DICTIONARY); } else { sequenceDictionary = variantReader.getFileHeader().getSequenceDictionary(); } CloserUtil.close(variantReader); log.info("Loading dbSNP file ..."); final DbSnpBitSetUtil.DbSnpBitSets dbsnp = DbSnpBitSetUtil.createSnpAndIndelBitSets(DBSNP, sequenceDictionary); log.info("Starting iteration of variants."); final VariantProcessor.Builder<CallingMetricAccumulator, CallingMetricAccumulator.Result> builder = VariantProcessor.Builder .generatingAccumulatorsBy(() -> { if (GVCF_INPUT) { return new GvcfMetricAccumulator(dbsnp); } else { return new CallingMetricAccumulator(dbsnp); } }) .combiningResultsBy(CallingMetricAccumulator.Result::merge) .withInput(INPUT) .multithreadingBy(THREAD_COUNT); if (TARGET_INTERVALS != null) { builder.limitingProcessedRegionsTo(IntervalList.fromFile(TARGET_INTERVALS).uniqued()); } final CallingMetricAccumulator.Result result = builder.build().process(); final MetricsFile<CollectVariantCallingMetrics.VariantCallingDetailMetrics, Integer> detail = getMetricsFile(); final MetricsFile<CollectVariantCallingMetrics.VariantCallingSummaryMetrics, Integer> summary = getMetricsFile(); summary.addMetric(result.summary); result.details.forEach(detail::addMetric); final String outputPrefix = OUTPUT.getAbsolutePath() + "."; detail.write(new File(outputPrefix + CollectVariantCallingMetrics.VariantCallingDetailMetrics.getFileExtension())); summary.write(new File(outputPrefix + CollectVariantCallingMetrics.VariantCallingSummaryMetrics.getFileExtension())); return 0; }

Target:
protected int doWork() { IOUtil.assertFileIsReadable(INPUT); final boolean requiresIndex = this.TARGET_INTERVALS != null || this.THREAD_COUNT > 1; final VCFFileReader variantReader = new VCFFileReader(INPUT, requiresIndex); final VCFHeader vcfHeader = variantReader.getFileHeader(); CloserUtil.close(variantReader); final SAMSequenceDictionary sequenceDictionary = SAMSequenceDictionaryExtractor.extractDictionary(SEQUENCE_DICTIONARY == null ? INPUT : SEQUENCE_DICTIONARY); log.info("Loading dbSNP file ..."); final DbSnpBitSetUtil.DbSnpBitSets dbsnp = DbSnpBitSetUtil.createSnpAndIndelBitSets(DBSNP, sequenceDictionary); log.info("Starting iteration of variants."); final VariantProcessor.Builder<CallingMetricAccumulator, CallingMetricAccumulator.Result> builder = VariantProcessor.Builder .generatingAccumulatorsBy(() -> { CallingMetricAccumulator accumulator = GVCF_INPUT ? new GvcfMetricAccumulator(dbsnp) : new CallingMetricAccumulator(dbsnp); accumulator.setup(vcfHeader); return accumulator; }) .combiningResultsBy(CallingMetricAccumulator.Result::merge) .withInput(INPUT) .multithreadingBy(THREAD_COUNT); if (TARGET_INTERVALS != null) { builder.limitingProcessedRegionsTo(IntervalList.fromFile(TARGET_INTERVALS).uniqued()); } final CallingMetricAccumulator.Result result = builder.build().process(); final MetricsFile<CollectVariantCallingMetrics.VariantCallingDetailMetrics, Integer> detail = getMetricsFile(); final MetricsFile<CollectVariantCallingMetrics.VariantCallingSummaryMetrics, Integer> summary = getMetricsFile(); summary.addMetric(result.summary); result.details.forEach(detail::addMetric); final String outputPrefix = OUTPUT.getAbsolutePath() + "."; detail.write(new File(outputPrefix + CollectVariantCallingMetrics.VariantCallingDetailMetrics.getFileExtension())); summary.write(new File(outputPrefix + CollectVariantCallingMetrics.VariantCallingSummaryMetrics.getFileExtension())); return 0; }