Ejemplo n.º 1
0
        private static Dictionary <string, List <BedEntry> > ReadCommonRegions(string commonCNVsbedPath)
        {
            Dictionary <string, List <BedEntry> > commonRegions;

            using (var reader = new BedReader(new GzipOrTextReader(commonCNVsbedPath)))
            {
                var commonTmpRegions = reader.LoadAllEntries();
                commonRegions = Utilities.SortAndOverlapCheck(commonTmpRegions, commonCNVsbedPath);
            }
            return(commonRegions);
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
 public static IncludeBedFile CreateFromBedReader([NotNull] BedReader bedReader)
 => TypeCache <string, IncludeBedFile> .GetOrAdd(bedReader.FileSource.GetCompleteRealPath().FullName, () =>
                                                 new IncludeBedFile(CreateGenomeIntervalTree(bedReader),
                                                                    new Lazy <FileInfo>(() => bedReader.FileSource)));
Ejemplo n.º 4
0
 public static IncludeBedFile CreateFromBedFile([NotNull] FileInfo bedFile)
 => CreateFromBedReader(BedReader.Create(bedFile));
Ejemplo n.º 5
0
 public static IncludeBedFile CreateFromBedFile([NotNull] FileInfo bedFile)
 => bedFile.ExistsNow()
         ? CreateFromBedReader(BedReader.Create(bedFile))
         : TypeCache <string, IncludeBedFile> .GetOrAdd(bedFile.FullName,
                                                        () => CreateFromBedReader(BedReader.Create(bedFile)));