Esempio n. 1
0
        public void ParsingDoesntThrowException(string bedFileName)
        {
            var bedFile = Path.Combine(BedsFolder, bedFileName).ToFileInfo();

            Assert.Equal(bedFile.FullName, IncludeBedFile.CreateFromBedFile(bedFile).BedFile.FullName);
            var bedReader = BedReader.Create(bedFile);
            var source    = bedReader.Select(b => (b.Contig, b.Start, b.Stop)).ToList();
            var actual    = BedReader.Create(IncludeBedFile
                                             .CreateFromContigIntervals(bedReader, Path.GetTempFileName().ToFileInfo()).BedFile)
                            .Select(b => (b.Contig, b.Start, b.Stop)).ToList();

            // if source and count is equal, then the sequence should equal.
            Assert.Equal(source.Count == actual.Count, source.SequenceEqual(actual));
        }
Esempio n. 2
0
        public void CrossType_Bases_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,
                                                                IncludeBedFile.CreateFromBedFile(TinyBed)))
                                  .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);

            MultiAssert.Equal(4U, results.OverallStats[StatsType.Event].QueryStats.TrueCount);
            MultiAssert.Equal(1451995U, results.OverallStats[StatsType.Base].QueryStats.TrueCount);
            MultiAssert.Equal(1451995U, results.OverallStats[StatsType.Base].TruthStats.TrueCount);
            MultiAssert.AssertAll();
        }
Esempio n. 3
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();
        }