/// <summary> /// Remap GenomicBin from genome coordiantes into CanvasBin coordiantes /// </summary> public static List <SampleGenomicBin> RemapCommonRegions(List <SampleGenomicBin> commonRegions, uint[] startByChr, uint[] endByChr) { var length = startByChr.Length; var index = 0; List <SampleGenomicBin> commonRegionsRemapped = new List <SampleGenomicBin>(); foreach (SampleGenomicBin commonRegion in commonRegions) { if (index > length) { break; } var startSegment = RemapIndex(startByChr, endByChr, commonRegion.Start, length, ref index); var endSegment = RemapIndex(startByChr, endByChr, commonRegion.Stop, length, ref index); if (startSegment.HasValue && endSegment.HasValue) { SampleGenomicBin interval = new SampleGenomicBin(); interval.Start = startSegment.Value; interval.Stop = endSegment.Value; commonRegionsRemapped.Add(interval); } } return(commonRegionsRemapped); }
public void TestBins() { SampleGenomicBin bin = new SampleGenomicBin("chr1", 12345, 678910, 20, 100); Assert.Equal(666565, bin.Size); }
private static BedGraphEntry GetBedGraphEntry(SampleGenomicBin bin, double normalizationFactor) { var normalizedCoverage = (decimal)(bin.Count * normalizationFactor); return(new BedGraphEntry(bin.GenomicBin.Chromosome, bin.GenomicBin.Interval, normalizedCoverage)); }