public static IGenotypeCalculator CreateGenotypeCalculator(PloidyModel ploidyModel, float minimumFrequencyFilter, int minEmitDepth, DiploidThresholdingParameters snvParameters, DiploidThresholdingParameters indelParameters, int minGQscore, int maxGQscore, float targetLODVariantFrequency, float minimumEmitFrequency = 0, string refName = null, bool?isMale = null) { if (ploidyModel == PloidyModel.Somatic || refName == "chrM") { return(new SomaticGenotypeCalculator(minimumFrequencyFilter, minEmitDepth, minGQscore, maxGQscore, minimumEmitFrequency, targetLODVariantFrequency)); } if (isMale == null) { return(new DiploidGenotypeCalculator(snvParameters, indelParameters, minEmitDepth, minGQscore, maxGQscore)); } if (isMale.Value && (refName == "chrY" || refName == "chrX")) { return(new HaploidGenotyeCalculator(minEmitDepth, minGQscore, maxGQscore, snvParameters.MinorVF, snvParameters.MajorVF)); } if (!isMale.Value && refName == "chrY") { Common.IO.Utility.Logger.WriteWarningToLog("chrY exists in Female samples"); return(new HaploidGenotyeCalculator(minEmitDepth, minGQscore, maxGQscore, snvParameters.MinorVF, snvParameters.MajorVF)); } return(new DiploidGenotypeCalculator(snvParameters, snvParameters, minEmitDepth, minGQscore, maxGQscore)); }
public DiploidGenotypeCalculator(DiploidThresholdingParameters parameters, int minCalledVariantDepth, int minGQscore, int maxGQscore) { _diploidThresholdingParameters = parameters; MinGQScore = minGQscore; MaxGQScore = maxGQscore; MinDepthToGenotype = minCalledVariantDepth; }
public DiploidGenotypeCalculator(DiploidThresholdingParameters snvParameters, DiploidThresholdingParameters indelParameters, int minCalledVariantDepth, int minGQscore, int maxGQscore) { _diploidSnvThresholdingParameters = snvParameters; _diploidIndelThresholdingParameters = indelParameters; MinGQScore = minGQscore; MaxGQScore = maxGQscore; MinDepthToGenotype = minCalledVariantDepth; MinVarFrequency = _diploidSnvThresholdingParameters.MinorVF; }
public DiploidGenotypeCalculator() { var defaultParams = new VariantCallingParameters(); _diploidSnvThresholdingParameters = defaultParams.DiploidSNVThresholdingParameters; _diploidIndelThresholdingParameters = defaultParams.DiploidINDELThresholdingParameters; MinGQScore = defaultParams.MinimumGenotypeQScore; MaxGQScore = defaultParams.MaximumGenotypeQScore; MinDepthToGenotype = defaultParams.MinimumCoverage; MinVarFrequency = _diploidSnvThresholdingParameters.MinorVF; }
private static Genotype CalculateDiploidGenotype(IEnumerable <CalledAllele> alleles, int minDepthToGenotype, DiploidThresholdingParameters snvThresholdingParameters, DiploidThresholdingParameters indelThresholdingParameters, out List <CalledAllele> allelesToPrune) { allelesToPrune = new List <CalledAllele>(); var singleGTForLoci = Genotype.RefLikeNoCall; var orderedVariants = GenotypeCalculatorUtilities.FilterAndOrderAllelesByFrequency(alleles, allelesToPrune, snvThresholdingParameters.MinorVF); var referenceFrequency = GenotypeCalculatorUtilities.GetReferenceFrequency(alleles, snvThresholdingParameters.MinorVF); var refExists = (referenceFrequency >= snvThresholdingParameters.MinorVF); var depthIssue = GenotypeCalculatorUtilities.CheckForDepthIssue(alleles, minDepthToGenotype); var diploidModelFail = false; // as in {30%,30%,30%} not {49%,49%,2%},ie, diploid model FAIL. bool refCall = ((orderedVariants.Count == 0) || (orderedVariants[0].Frequency < snvThresholdingParameters.MinorVF)); var parameters = snvThresholdingParameters; //do we apply SNP threshholds or indel thresholds? if (!refCall) { var dominantVariant = orderedVariants.Last(); if (dominantVariant.Type != AlleleCategory.Snv) { parameters = indelThresholdingParameters; } } if (depthIssue) { if (refCall) { singleGTForLoci = Genotype.RefLikeNoCall; } else { singleGTForLoci = Genotype.AltLikeNoCall; } } else { //obvious reference call if (refCall) { if (!refExists) { singleGTForLoci = Genotype.RefLikeNoCall; //there might have been an upstream deletion } else { var firstAllele = alleles.First(); //we see too much of something else (unknown) for a clean ref call. if ((firstAllele.Type == AlleleCategory.Reference) && ((1 - firstAllele.Frequency) > parameters.MinorVF)) { singleGTForLoci = Genotype.RefAndNoCall; } else { singleGTForLoci = Genotype.HomozygousRef; // being explicit for readability } } }//else, types of alt calls... else if ((orderedVariants[0].Frequency >= parameters.MinorVF) && (orderedVariants[0].Frequency <= parameters.MajorVF)) { if (orderedVariants.Count == 1) { if (refExists) { singleGTForLoci = Genotype.HeterozygousAltRef; } else { singleGTForLoci = Genotype.AltAndNoCall; } } else { //is this 0/1, 1/2, or 0/1/2 or 1/2/3/... diploidModelFail = CheckForTriAllelicIssue(refExists, referenceFrequency, orderedVariants, parameters.SumVFforMultiAllelicSite); if (diploidModelFail) { SetMultiAllelicFilter(alleles); if (refExists) { singleGTForLoci = Genotype.AltLikeNoCall; } else { singleGTForLoci = Genotype.Alt12LikeNoCall; } } else if (refExists) { singleGTForLoci = Genotype.HeterozygousAltRef; } else { singleGTForLoci = Genotype.HeterozygousAlt1Alt2; } } } else if (orderedVariants[0].Frequency > parameters.MajorVF) { singleGTForLoci = Genotype.HomozygousAlt; } } //if (!diploidModelFail) allelesToPrune = GenotypeCalculatorUtilities.GetAllelesToPruneBasedOnGTCall(singleGTForLoci, orderedVariants, allelesToPrune); //tjd + //incase of DiploidModelFail, we *used* to show all alleles we detected, but then we were worried about down stream processors. //So now we will will prune in this case, too. // we still will flag this DiploidModelFail site as a no call. But no longer report everything we found //tjd - return(singleGTForLoci); }
public static IGenotypeCalculator CreateGenotypeCalculator(PloidyModel ploidyModel, float minCalledVariantFreq, int minCalledVariantDepth, DiploidThresholdingParameters parameters, int minGQscore, int maxGQscore) { return((ploidyModel == PloidyModel.Somatic) ? (IGenotypeCalculator) new SomaticGenotypeCalculator(minCalledVariantFreq, minCalledVariantDepth, minGQscore, maxGQscore) : new DiploidGenotypeCalculator(parameters, minCalledVariantDepth, minGQscore, maxGQscore)); }