// private method called by both UnifiedGenotyper and UGCalcLikelihoods entry points into the // engine private VariantContext calculateLikelihoods( final RefMetaDataTracker tracker, final ReferenceContext refContext, final Map<String, AlignmentContext> stratifiedContexts, final AlignmentContextUtils.ReadOrientation type, final List<Allele> alternateAllelesToUse, final boolean useBAQedPileup, final GenotypeLikelihoodsCalculationModel.Model model, final Map<String, org.broadinstitute.sting.utils.genotyper.PerReadAlleleLikelihoodMap> perReadAlleleLikelihoodMap) { // initialize the data for this thread if that hasn't been done yet if (glcm.get() == null) { glcm.set(getGenotypeLikelihoodsCalculationObject(logger, UAC)); } return glcm.get() .get(model.name().toUpperCase()) .getLikelihoods( tracker, refContext, stratifiedContexts, type, alternateAllelesToUse, useBAQedPileup && BAQEnabledOnCMDLine, genomeLocParser, perReadAlleleLikelihoodMap); }
private Map<String, AlignmentContext> getFilteredAndStratifiedContexts( UnifiedArgumentCollection UAC, ReferenceContext refContext, AlignmentContext rawContext, final GenotypeLikelihoodsCalculationModel.Model model) { if (!BaseUtils.isRegularBase(refContext.getBase())) return null; Map<String, AlignmentContext> stratifiedContexts = null; if (model.name().contains("INDEL")) { final ReadBackedPileup pileup = rawContext.getBasePileup().getMappingFilteredPileup(UAC.MIN_BASE_QUALTY_SCORE); // don't call when there is no coverage if (pileup.getNumberOfElements() == 0 && UAC.OutputMode != OUTPUT_MODE.EMIT_ALL_SITES) return null; // stratify the AlignmentContext and cut by sample stratifiedContexts = AlignmentContextUtils.splitContextBySampleName(pileup); } else if (model.name().contains("SNP")) { // stratify the AlignmentContext and cut by sample stratifiedContexts = AlignmentContextUtils.splitContextBySampleName(rawContext.getBasePileup()); if (!(UAC.OutputMode == OUTPUT_MODE.EMIT_ALL_SITES && UAC.GenotypingMode != GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES)) { int numDeletions = 0; for (final PileupElement p : rawContext.getBasePileup()) { if (p.isDeletion()) numDeletions++; } if (((double) numDeletions) / ((double) rawContext.getBasePileup().getNumberOfElements()) > UAC.MAX_DELETION_FRACTION) { return null; } } } return stratifiedContexts; }
protected double getTheta(final GenotypeLikelihoodsCalculationModel.Model model) { if (model.name().contains("SNP")) return HUMAN_SNP_HETEROZYGOSITY; if (model.name().contains("INDEL")) return HUMAN_INDEL_HETEROZYGOSITY; else throw new IllegalArgumentException("Unexpected GenotypeCalculationModel " + model); }
protected double[] getAlleleFrequencyPriors( final GenotypeLikelihoodsCalculationModel.Model model) { if (model.name().toUpperCase().contains("SNP")) return log10AlleleFrequencyPriorsSNPs; else if (model.name().toUpperCase().contains("INDEL")) return log10AlleleFrequencyPriorsIndels; else throw new IllegalArgumentException("Unexpected GenotypeCalculationModel " + model); }