Ejemplo n.º 1
0
        public static SampleStats Create([NotNull] SampleMetrics benchmarkResults)
        {
            var overallStats = benchmarkResults.OverallStats.Select(kvp => BasicJsonStats.Create(kvp.Key,
                                                                                                 kvp.Value.TruthStats.TrueCount, kvp.Value.TruthStats.FalseCount, kvp.Value.QueryStats.TrueCount,
                                                                                                 kvp.Value.QueryStats.FalseCount)).ToReadOnlyList();

            var detailedStats = benchmarkResults.DetailedStats.Select(kvp => kvp.Value).OrderBy(b => b.Category.Name)
                                .Select(SvTypeJsonStats.Create).ToReadOnlyList();

            return(new SampleStats(benchmarkResults.SamplePair, overallStats, detailedStats));
        }
Ejemplo n.º 2
0
        public static SvTypeJsonStats Create([NotNull] IBenchmarkMetrics <WittyerType> benchmarkMetrics)
        {
            if (benchmarkMetrics.Category == WittyerType.TranslocationBreakend)
            {
                var stats      = benchmarkMetrics.BinnedStats[0];
                var eventStats = stats.Stats[StatsType.Event];
                return(new SvTypeJsonStats(benchmarkMetrics.Category.Name,
                                           new[]
                {     // overall stats are same as bin stats since no bins
                    BasicJsonStats.Create(StatsType.Event,
                                          eventStats.TruthStats.TrueCount,
                                          eventStats.TruthStats.FalseCount,
                                          eventStats.QueryStats.TrueCount,
                                          eventStats.QueryStats.FalseCount)
                },
                                           new[]
                {
                    BinJsonStats.Create(stats,
                                        WittyerConstants.Json.InfiniteBin, benchmarkMetrics.Category)
                }));
            }

            var binJsonStatsList = new List <BinJsonStats>();

            for (var i = 0; i < benchmarkMetrics.BinnedStats.Count; i++)
            {
                var perBinStatsObject = benchmarkMetrics.BinnedStats[i];
                if (perBinStatsObject.IgnoreForStatsCalculations)
                {
                    continue;
                }

                // Get the string representation of the next bin start, which will be infinity
                // if this is the last bin.
                var nextBinString = i != benchmarkMetrics.BinnedStats.Count - 1
                    ? benchmarkMetrics.BinnedStats[i + 1].Bin.ToString()
                    : WittyerConstants.Json.InfiniteBin;
                binJsonStatsList.Add(BinJsonStats.Create(perBinStatsObject, nextBinString, benchmarkMetrics.Category));
            }

            var overallStats = benchmarkMetrics.OverallStats
                               .Select(s => BasicJsonStats.Create(s.Key, s.Value.TruthStats.TrueCount,
                                                                  s.Value.TruthStats.FalseCount, s.Value.QueryStats.TrueCount, s.Value.QueryStats.FalseCount))
                               .ToReadOnlyList();

            return(new SvTypeJsonStats(benchmarkMetrics.Category.Name, overallStats, binJsonStatsList));
        }
Ejemplo n.º 3
0
        public static BinJsonStats Create([NotNull] IPerBinStats binnedStats, string nextBin, WittyerType variantType)
        {
            var result          = new List <BasicJsonStats>();
            var eventStats      = binnedStats.Stats[StatsType.Event];
            var eventBasicStats = BasicJsonStats.Create(StatsType.Event, eventStats.TruthStats.TrueCount,
                                                        eventStats.TruthStats.FalseCount, eventStats.QueryStats.TrueCount,
                                                        eventStats.QueryStats.FalseCount);

            result.Add(eventBasicStats);

            if (!binnedStats.Stats.TryGetValue(StatsType.Base, out var beb))
            {
                return(new BinJsonStats(GenerateBinString(binnedStats.Bin, nextBin, variantType), result));
            }

            var baseBasicStats = BasicJsonStats.Create(StatsType.Base, beb.TruthStats.TrueCount,
                                                       beb.TruthStats.FalseCount, beb.QueryStats.TrueCount, beb.QueryStats.FalseCount);

            result.Add(baseBasicStats);

            return(new BinJsonStats(GenerateBinString(binnedStats.Bin, nextBin, variantType), result));
        }