private static bool CheckIfUsed(List <CalledAllele> usedAlleles, CalledAllele originalCall) { foreach (var allele in usedAlleles) { if (originalCall.IsSameAllele(allele)) { return(true); } } return(false); }
public static void CheckVariantsMatch(CalledAllele baseline, CalledAllele test) { Assert.True(test.IsSameAllele(baseline)); Assert.Equal(baseline.Genotype, test.Genotype); }
public static VariantComparisonCase GetComparisonCase(CalledAllele VariantA, CalledAllele VariantB) { //if we have two or more different alternates, it should have already have been split up, upstream, //into two or more entries to be processed ie, (alt, null) and (alt' ,nul). //So if we have a (VariantB == null) or (VariantA == null) situation, we know its TwoDifferentAlternates; if ((VariantB == null) || (VariantA == null)) { return(VariantComparisonCase.CanNotCombine); } //sanity checking - these input should never be allowed. if (VariantA.Chromosome != VariantB.Chromosome) { throw new InvalidDataException("Check input variants to var compare algs."); } if (VariantA.ReferencePosition != VariantB.ReferencePosition) { throw new InvalidDataException("Check input variants to var compare algs."); } //now several reasonable cases remain. we are only accepting the following cases as "possible to combine" // // . + . -> . (treat as twos refs) // ref + . -> ref (treat as twos refs) // alt + . -> alt (treat as one ref, one alt) // Ref + ref -> ref // alt + alt -> alt (0/1 or 1/1) // ref + alt -> alt (filtered) //this case below, is not allowed. // alt + alt' -> alt/alt' (filtered -> should not come into this algorithm) // intead this will go through the algorithm twice, as one (alt + null) and another (null + alt') //the no-calls GT will be preverved by the CombineGT algorthm. bool RefA = (VariantA.Type == Pisces.Domain.Types.AlleleCategory.Reference); bool RefB = (VariantB.Type == Pisces.Domain.Types.AlleleCategory.Reference); if (RefA && RefB) { return(VariantComparisonCase.AgreedOnReference); } if ((RefA && !RefB) || (!RefA && RefB)) { return(VariantComparisonCase.OneReferenceOneAlternate); } if (VariantA.IsSameAllele(VariantB)) { return(VariantComparisonCase.AgreedOnAlternate); } else { //we could have different variants *or* different references (ie, in the case of a deletion) // (this should not happen - these should never be submitted for comparison to this alg.) throw new InvalidDataException("Check input variants to var compare algs."); } }