/** * Compute full calls at a given locus. Entry point for engine calls from the UnifiedGenotyper. * * <p>If allSamples != null, then the output variantCallContext is guarenteed to contain a * genotype for every sample in allSamples. If it's null there's no such guarentee. Providing this * argument is critical when the resulting calls will be written to a VCF file. * * @param tracker the meta data tracker * @param refContext the reference base * @param rawContext contextual information around the locus * @param allSamples set of all sample names that we might call (i.e., those in the VCF header) * @return the VariantCallContext object */ public List<VariantCallContext> calculateLikelihoodsAndGenotypes( final RefMetaDataTracker tracker, final ReferenceContext refContext, final AlignmentContext rawContext, final Set<String> allSamples) { final List<VariantCallContext> results = new ArrayList<VariantCallContext>(2); final List<GenotypeLikelihoodsCalculationModel.Model> models = getGLModelsToUse(tracker, refContext, rawContext); final Map<String, org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap> perReadAlleleLikelihoodMap = new HashMap< String, org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap>(); if (models.isEmpty()) { results.add( UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ? generateEmptyContext(tracker, refContext, null, rawContext) : null); } else { for (final GenotypeLikelihoodsCalculationModel.Model model : models) { perReadAlleleLikelihoodMap.clear(); final Map<String, AlignmentContext> stratifiedContexts = getFilteredAndStratifiedContexts(UAC, refContext, rawContext, model); if (stratifiedContexts == null) { results.add( UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE .GENOTYPE_GIVEN_ALLELES ? generateEmptyContext(tracker, refContext, null, rawContext) : null); } else { final VariantContext vc = calculateLikelihoods( tracker, refContext, stratifiedContexts, AlignmentContextUtils.ReadOrientation.COMPLETE, null, true, model, perReadAlleleLikelihoodMap); if (vc != null) results.add( calculateGenotypes( tracker, refContext, rawContext, stratifiedContexts, vc, model, true, perReadAlleleLikelihoodMap)); } } } return results; }