/// <inheritdoc /> public void AddTarget(IMutableWittyerSimpleVariant variant) { _baseResult.AddTarget(variant); switch (variant) { case IMutableWittyerBnd bnd: BpInsTrees.GetOrAdd(variant.VariantType, _ => GenomeIntervalTree <IMutableWittyerBnd> .Create()).Add(bnd); break; case IMutableWittyerVariant cast: VariantTrees.GetOrAdd(variant.VariantType, _ => GenomeIntervalTree <IMutableWittyerVariant> .Create()).Add(cast); break; default: throw new ArgumentOutOfRangeException( $"Unexepected Variant found that was neither {nameof(IWittyerBnd)} nor {nameof(IWittyerVariant)}!"); } }
public void AddTarget(IMutableWittyerSimpleVariant variant) { switch (variant) { case IMutableWittyerBnd bnd: _bndPairs.GetOrAdd(bnd.VariantType, _ => new List <IMutableWittyerBnd>()).Add(bnd); break; case IMutableWittyerVariant cast: _variants.GetOrAdd(cast.VariantType, _ => new List <IMutableWittyerVariant>()).Add(cast); break; default: throw new InvalidCastException( $"Variant found to not be {nameof(IWittyerBnd)} nor {nameof(IWittyerVariant)}!"); } AddContig(variant); Interlocked.Add(ref _numEntries, variant.VariantType == WittyerType.TranslocationBreakend || variant.VariantType == WittyerType.IntraChromosomeBreakend ? 2 : 1); }
internal static void Finalize([NotNull] IMutableWittyerSimpleVariant variant, [NotNull] List <OverlapAnnotation> annotations, WitDecision falseDecision, EvaluationMode mode, bool?isIncluded) { annotations.Sort(); WittyerSampleInternal unwrappedSample; switch (variant.Sample) { case WittyerSampleInternal simple: unwrappedSample = simple; break; case WittyerCopyNumberSample cnSample: unwrappedSample = cnSample.BaseSample; break; case WittyerGenotypedSample gtSample: unwrappedSample = gtSample.BaseSample; break; case WittyerGenotypedCopyNumberSample gtCnSample: unwrappedSample = gtCnSample.BaseSample.BaseSample; break; default: throw new InvalidDataException( "Not sure how we get here, you must have created some non-existed wittyer sample type, check with developer!"); } // expected results: // isIncluded == null means no bedRegion, so everything is normal. // isIncluded != null means bedRegion, so if false, override the results as such: // Wit = NotAssessed. // Why[0] if Unset = OutsideBedRegion unwrappedSample.What = ImmutableList <MatchEnum> .Empty; unwrappedSample.Why = ImmutableList <FailedReason> .Empty; var isTp = false; for (var i = 0; i < variant.OverlapInfo.Count; i++) { var what = variant.OverlapInfo[i].What; unwrappedSample.What = unwrappedSample.What.Add(what); isTp = isTp || what == MatchEnum.AlleleAndGenotypeMatch || (mode == EvaluationMode.SimpleCounting || mode == EvaluationMode.CrossTypeAndSimpleCounting) && what == MatchEnum.AlleleMatch; var why = variant.OverlapInfo[i].Why; if (why == FailedReason.Unset) { why = i == 0 && isIncluded == false ? FailedReason.OutsideBedRegion : what == MatchEnum.Unmatched ? FailedReason.NoOverlap : FailedReason.Other; } unwrappedSample.Why = unwrappedSample.Why.Add(why); } if (unwrappedSample.What.Count == 0) { unwrappedSample.What = EmptyWhat; } if (unwrappedSample.Why.Count == 0) { unwrappedSample.Why = isIncluded == false ? EmptyOutsideBedWhy : isTp ? EmptyTrueWhy : EmptyFalseWhy; } unwrappedSample.Wit = isIncluded == null || isIncluded.Value ? isTp ? WitDecision.TruePositive : falseDecision : WitDecision.NotAssessed; }