Example #1
0
        public void OverlapWorks_DupDel([NotNull] string truthVar, [NotNull] string queryVar, string type, bool isTp)
        {
            const string sampleName = "blah";
            var          vcfVariantParserSettings = VcfVariantParserSettings.Create(new List <string> {
                sampleName
            });
            var        baseVariant   = VcfVariant.TryParse(truthVar, vcfVariantParserSettings).GetOrThrow();
            const bool isCrossTypeOn = true;
            var        wittyerType   = WittyerType.Parse(type);
            var        inputSpecs    = InputSpec.GenerateCustomInputSpecs(!isCrossTypeOn, new[] { wittyerType }, percentDistance: PercentDistance).ToDictionary(s => s.VariantType, s => s);

            var bndSet    = new Dictionary <IGeneralBnd, IVcfVariant>();
            var errorList = new List <string>();
            var truthV    = (IMutableWittyerSimpleVariant)WittyerVcfReader.CreateVariant(baseVariant, baseVariant.Samples.First().Value, true, sampleName,
                                                                                         inputSpecs, bndSet, errorList, isCrossTypeOn);

            baseVariant = VcfVariant.TryParse(queryVar, vcfVariantParserSettings).GetOrThrow();
            var queryV = (IMutableWittyerVariant)WittyerVcfReader.CreateVariant(baseVariant, baseVariant.Samples.First().Value, false, sampleName,
                                                                                inputSpecs, bndSet, errorList, isCrossTypeOn);
            var tree = TruthForest.Create(sampleName, VcfHeader.CreateBuilder(VcfVersion.FourPointOne).Build());

            tree.AddTarget(truthV);
            OverlappingUtils.DoOverlapping(tree.VariantTrees, queryV, OverlappingUtils.IsVariantAlleleMatch, isCrossTypeOn, true);
            queryV.Finalize(WitDecision.FalsePositive, EvaluationMode.CrossTypeAndSimpleCounting, null);
            truthV.Finalize(WitDecision.FalseNegative, EvaluationMode.CrossTypeAndSimpleCounting, null);
            Assert.Equal(isTp ? WitDecision.TruePositive : WitDecision.FalsePositive, queryV.Sample.Wit);
            Assert.Equal(isTp ? WitDecision.TruePositive : WitDecision.FalseNegative, truthV.Sample.Wit);
        }
        public static void WittyerVariantReaderWorks()
        {
            var vcfSettings =
                VcfVariantParserSettings.Create(ImmutableList.Create("proband", "father"), GenomeAssembly.Grch37);
            var ref1 = VcfVariant.TryParse(RefSiteUndeterminedGt, vcfSettings).GetOrThrowDebug();

            WittyerVcfReader.CreateVariant(ref1, ref1.Samples.First().Value, false, "proband",
                                           new Dictionary <WittyerType, InputSpec>
            {
                {
                    WittyerType.CopyNumberReference,
                    InputSpec.GenerateCustomInputSpecs(false, new[] { WittyerType.CopyNumberReference }, percentDistance: 0.05).First()
                }
            }, new Dictionary <IGeneralBnd, IVcfVariant>(), new List <string>(), true);
        }