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); }
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)); }
public static IncludeBedFile CreateFromBedReader([NotNull] BedReader bedReader) => TypeCache <string, IncludeBedFile> .GetOrAdd(bedReader.FileSource.GetCompleteRealPath().FullName, () => new IncludeBedFile(CreateGenomeIntervalTree(bedReader), new Lazy <FileInfo>(() => bedReader.FileSource)));
public static IncludeBedFile CreateFromBedFile([NotNull] FileInfo bedFile) => CreateFromBedReader(BedReader.Create(bedFile));
public static IncludeBedFile CreateFromBedFile([NotNull] FileInfo bedFile) => bedFile.ExistsNow() ? CreateFromBedReader(BedReader.Create(bedFile)) : TypeCache <string, IncludeBedFile> .GetOrAdd(bedFile.FullName, () => CreateFromBedReader(BedReader.Create(bedFile)));