Esempio n. 1
0
        public void SkippedBinsAreIgnoredInStats()
        {
            var outputDirectory = Path.GetRandomFileName().ToDirectoryInfo();
            var alternatingBins = ImmutableList <(uint size, bool skip)> .Empty
                                  .Add((1, true))
                                  .Add((100000, false))
                                  .Add((200000, true))
                                  .Add((300000, false));

            var inputSpecs = InputSpec.GenerateDefaultInputSpecs(true)
                             .Select(i => InputSpec.Create(i.VariantType, alternatingBins,
                                                           1, 1, i.ExcludedFilters, i.IncludedFilters, i.IncludedRegions))
                             .ToDictionary(i => i.VariantType, i => i);
            var wittyerSettings = WittyerSettings.Create(outputDirectory, TinyTruth, TinyQuery,
                                                         ImmutableList <ISamplePair> .Empty, EvaluationMode.SimpleCounting,
                                                         inputSpecs);

            var(_, query, truth) = MainLauncher.GenerateResults(wittyerSettings).EnumerateSuccesses().First();
            var results = MainLauncher.GenerateSampleMetrics(truth, query, false, inputSpecs);

            Assert.Equal(1U, results.OverallStats[StatsType.Event].QueryStats.TrueCount);
            Assert.Equal(1U, results.OverallStats[StatsType.Event].QueryStats.FalseCount);
            Assert.Equal(0.5, results.EventLevelRecallOverall.First(typeRecallTuple => typeRecallTuple.type == WittyerType.CopyNumberGain).recall);

            var numberOfBinsReportedOn = results.EventLevelRecallPerBin.First().perBinRecall.Count();

            Assert.Equal(2, numberOfBinsReportedOn);
        }
Esempio n. 2
0
        public void CrossType_Works()
        {
            var outputDirectory = Path.GetRandomFileName().ToDirectoryInfo();
            var inputSpecs      = InputSpec.GenerateDefaultInputSpecs(false).Select(i => InputSpec.Create(i.VariantType, i.BinSizes,
                                                                                                          10000, i.PercentDistance, i.ExcludedFilters, i.IncludedFilters, i.IncludedRegions))
                                  .ToDictionary(i => i.VariantType, i => i);
            var wittyerSettings = WittyerSettings.Create(outputDirectory, TinyTruth, TinyQuery,
                                                         ImmutableList <ISamplePair> .Empty, EvaluationMode.CrossTypeAndSimpleCounting,
                                                         inputSpecs);

            var(_, query, truth) = MainLauncher.GenerateResults(wittyerSettings).EnumerateSuccesses().First();
            var results = MainLauncher.GenerateSampleMetrics(truth, query, false, inputSpecs);

            Assert.Equal(4U, results.OverallStats[StatsType.Event].QueryStats.TrueCount);
        }
Esempio n. 3
0
        public void Bed_Counts_Bases_Of_FP_Events()
        {
            var outputDirectory = Path.GetRandomFileName().ToDirectoryInfo();
            var inputSpecs      = InputSpec.GenerateDefaultInputSpecs(false).Select(i => InputSpec.Create(i.VariantType, i.BinSizes,
                                                                                                          10000, i.PercentDistance, i.ExcludedFilters, i.IncludedFilters, IncludeBedFile.CreateFromBedFile(Bed)))
                                  .ToDictionary(i => i.VariantType, i => i);
            var wittyerSettings = WittyerSettings.Create(outputDirectory, Truth, Query,
                                                         ImmutableList <ISamplePair> .Empty, EvaluationMode.CrossTypeAndSimpleCounting,
                                                         inputSpecs);

            var(_, query, truth) = MainLauncher.GenerateResults(wittyerSettings).EnumerateSuccesses().First();
            var results = MainLauncher.GenerateSampleMetrics(truth, query, false, inputSpecs);

            // should be end of bed - start of query + 1 = 149835000 - 145395620 + 1 = 4439381
            MultiAssert.Equal(4439381U, results.OverallStats[StatsType.Base].QueryStats.TrueCount);
            MultiAssert.Equal(4439381U, results.OverallStats[StatsType.Base].TruthStats.TrueCount);
            MultiAssert.Equal(0U, results.OverallStats[StatsType.Event].QueryStats.TrueCount);
            MultiAssert.Equal(0U, results.OverallStats[StatsType.Event].TruthStats.TrueCount);
            MultiAssert.AssertAll();
        }
Esempio n. 4
0
        public void CrossType_ComplexBed_Works()
        {
            var outputDirectory = Path.GetRandomFileName().ToDirectoryInfo();
            var inputSpecs      = InputSpec.CreateSpecsFromString(
                File.ReadAllText(Config.FullName), IncludeBedFile.CreateFromBedFile(Bed))
                                  ?.ToDictionary(i => i.VariantType, i => i)
                                  ?? new Dictionary <WittyerType, InputSpec>();
            var wittyerSettings = WittyerSettings.Create(outputDirectory, Truth, Query,
                                                         ImmutableList <ISamplePair> .Empty, EvaluationMode.CrossTypeAndSimpleCounting,
                                                         inputSpecs);

            var(_, query, truth) = MainLauncher.GenerateResults(wittyerSettings)
                                   .EnumerateSuccesses().First();
            var results = MainLauncher
                          .GenerateSampleMetrics(truth, query, false, inputSpecs);
            var baseStats = results.DetailedStats[WittyerType.Deletion].OverallStats[StatsType.Base];

            MultiAssert.Equal(206678U, baseStats.QueryStats.TrueCount);
            MultiAssert.Equal(206678U, baseStats.TruthStats.TrueCount);
            MultiAssert.AssertAll();
        }