コード例 #1
0
 private static CalledAllele UpdateGenotype(CalledAllele allele, SimplifiedDiploidGenotype category)
 {
     if (category == SimplifiedDiploidGenotype.HomozygousRef)
     {
         allele.Genotype = Genotype.HomozygousRef;
     }
     else if (category == SimplifiedDiploidGenotype.HeterozygousAltRef)
     {
         if (allele.IsRefType)
         {
             allele.Genotype = Genotype.HomozygousRef;
         }
         else if (VariantReader.GetVariantType(allele) == VariantType.Snv)
         {
             allele.Genotype = Genotype.HeterozygousAltRef;
         }
         else if (VariantReader.GetVariantType(allele) == VariantType.Indel)
         {
             allele.Genotype = Genotype.HeterozygousAltRef;
         }
     }
     else if (category == SimplifiedDiploidGenotype.HomozygousAlt)
     {
         if (allele.IsRefType)
         {
             allele.Genotype = Genotype.HomozygousRef;
         }
         else if (VariantReader.GetVariantType(allele) == VariantType.Snv)
         {
             allele.Genotype = Genotype.HomozygousAlt;
         }
         else if (VariantReader.GetVariantType(allele) == VariantType.Indel)
         {
             allele.Genotype = Genotype.HomozygousAlt;
         }
     }
     return(allele);
 }
コード例 #2
0
 public static int GenotypeCategoryToInt(SimplifiedDiploidGenotype genotype)
 {
     return((int)genotype);
 }
コード例 #3
0
        public static Genotype ConvertSimpleGenotypeToComplexGenotype(IEnumerable <CalledAllele> alleles,
                                                                      List <CalledAllele> orderedVariants, double referenceFrequency, bool refExists, bool depthIssue, bool refCall,
                                                                      float minVarFrequency, float sumVFforMultiAllelicSite, SimplifiedDiploidGenotype preliminaryGenotype)
        {
            if (depthIssue)
            {
                if (refCall)
                {
                    return(Genotype.RefLikeNoCall);
                }
                else
                {
                    return(Genotype.AltLikeNoCall);
                }
            }
            else
            {
                switch (preliminaryGenotype)
                {
                case SimplifiedDiploidGenotype.HomozygousRef:    //obvious reference call
                    if (!refExists)
                    {
                        return(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) > minVarFrequency))
                        {
                            return(Genotype.RefAndNoCall);
                        }
                        else
                        {
                            return(Genotype.HomozygousRef);     // being explicit for readability
                        }
                    }


                case SimplifiedDiploidGenotype.HeterozygousAltRef:    //else, types of alt calls...

                    if (orderedVariants.Count == 1)
                    {
                        if (refExists)
                        {
                            return(Genotype.HeterozygousAltRef);
                        }
                        else
                        {
                            return(Genotype.AltAndNoCall);
                        }
                    }
                    else
                    {
                        //is this 0/1, 1/2, or 0/1/2 or 1/2/3/...
                        bool diploidModelFail = CheckForTriAllelicIssue(refExists, referenceFrequency, orderedVariants, sumVFforMultiAllelicSite);
                        if (diploidModelFail)
                        {
                            SetMultiAllelicFilter(alleles);

                            if (refExists)
                            {
                                return(Genotype.AltLikeNoCall);
                            }
                            else
                            {
                                return(Genotype.Alt12LikeNoCall);
                            }
                        }
                    }

                    if (refExists)
                    {
                        return(Genotype.HeterozygousAltRef);
                    }
                    else
                    {
                        return(Genotype.HeterozygousAlt1Alt2);
                    }


                default:
                case SimplifiedDiploidGenotype.HomozygousAlt:
                    return(Genotype.HomozygousAlt);
                }
            }
        }