if ( allVariantsWithinExtendedRegion.isEmpty() ) // no variants,
return Result.noVariation(emitReferenceConfidence,originalRegion,snpPadding, usableExtension);
final List<VariantContext> withinActiveRegion = new LinkedList<>();
final GenomeLoc originalRegionRange = originalRegion.getLocation();
boolean foundNonSnp = false;
GenomeLoc variantSpan = null;
for ( final VariantContext vc : allVariantsWithinExtendedRegion ) {
final GenomeLoc vcLoc = locParser.createGenomeLoc(vc);
if ( originalRegionRange.overlapsP(vcLoc) ) {
foundNonSnp = foundNonSnp || ! vc.isSNP();
variantSpan = variantSpan == null ? vcLoc : variantSpan.endpointSpan(vcLoc);
withinActiveRegion.add(vc);
}
}
final int padding = foundNonSnp ? indelPadding : snpPadding;
// we don't actually have anything in the region after skipping out variants that don't overlap
// the region's full location
if ( variantSpan == null )
return Result.noVariation(emitReferenceConfidence,originalRegion,padding, usableExtension);
if ( dontTrimActiveRegions)
return Result.noTrimming(emitReferenceConfidence,originalRegion, padding, usableExtension, withinActiveRegion);
final GenomeLoc maximumSpan = locParser.createPaddedGenomeLoc(originalRegionRange, usableExtension);
final GenomeLoc idealSpan = locParser.createPaddedGenomeLoc(variantSpan, padding);
final GenomeLoc finalSpan = maximumSpan.intersect(idealSpan).union(variantSpan);
// Make double sure that, if we are emitting GVCF we won't call non-variable positions beyond the target active region span.
// In regular call we don't do so so we don't care and we want to maintain behavior, so the conditional.
final GenomeLoc callableSpan = emitReferenceConfidence ? variantSpan.intersect(originalRegionRange) : variantSpan;
final Pair<GenomeLoc,GenomeLoc> nonVariantRegions = nonVariantTargetRegions(originalRegion, callableSpan);
if ( debug ) {
logger.info("events : " + withinActiveRegion);