private static Genotype CalculateDiploidGenotype(IEnumerable <CalledAllele> alleles, int minDepthToGenotype, DiploidThresholdingParameters snvThresholdingParameters, DiploidThresholdingParameters indelThresholdingParameters, out List <CalledAllele> allelesToPrune) { allelesToPrune = new List <CalledAllele>(); 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 parameters = snvThresholdingParameters; bool refCall = orderedVariants.Count == 0 || (orderedVariants[0].Frequency < snvThresholdingParameters.MinorVF); //do we apply SNP threshholds or indel thresholds? parameters = SelectParameters(indelThresholdingParameters, orderedVariants, parameters, refCall); var preliminaryGenotype = GetPreliminaryGenotype(orderedVariants, parameters, refCall); var finalGTForLoci = GenotypeCalculatorUtilities.ConvertSimpleGenotypeToComplexGenotype(alleles, orderedVariants, referenceFrequency, refExists, depthIssue, refCall, parameters.MinorVF, parameters.SumVFforMultiAllelicSite, preliminaryGenotype); allelesToPrune = GenotypeCalculatorUtilities.GetAllelesToPruneBasedOnGTCall(finalGTForLoci, orderedVariants, allelesToPrune); return(finalGTForLoci); }
private Genotype CalculateHaploidGenotype(IEnumerable <CalledAllele> alleles, int minDepthToGenotype, out List <CalledAllele> allelesToPrune) { allelesToPrune = new List <CalledAllele>(); var singleGTForLoci = Genotype.HemizygousNoCall; var orderedVariants = GenotypeCalculatorUtilities.FilterAndOrderAllelesByFrequency(alleles, allelesToPrune, _minorVF); var referenceFrequency = GenotypeCalculatorUtilities.GetReferenceFrequency(alleles, _minorVF); var refExists = (referenceFrequency >= _minorVF); var depthIssue = GenotypeCalculatorUtilities.CheckForDepthIssue(alleles, minDepthToGenotype); bool refCall = ((orderedVariants.Count == 0) || (orderedVariants[0].Frequency < _minorVF)); if (!depthIssue && refCall && refExists && referenceFrequency > _majorVF) { singleGTForLoci = Genotype.HemizygousRef; } if (!depthIssue && !refCall && !refExists && orderedVariants[0].Frequency > _majorVF) { singleGTForLoci = Genotype.HemizygousAlt; } //if (!diploidModelFail) allelesToPrune = GenotypeCalculatorUtilities.GetAllelesToPruneBasedOnGTCall(singleGTForLoci, orderedVariants, allelesToPrune); return(singleGTForLoci); }