CanvasClean.CanvasClean.DebugPrintCountsByGC C# (CSharp) Method

DebugPrintCountsByGC() static private method

Debugging option - save off a table of counts by GC bin.
static private DebugPrintCountsByGC ( List bins, string filePath ) : void
bins List
filePath string
return void
        static void DebugPrintCountsByGC(List<GenomicBin> bins, string filePath)
        {
            int[][] HistogramByGC = new int[EnrichmentUtilities.numberOfGCbins][];
            for (int GC = 0; GC < HistogramByGC.Length; GC++) HistogramByGC[GC] = new int[1024];
            foreach (GenomicBin bin in bins)
            {
                if (bin.Count < 0 || bin.Count >= 1024) continue;
                HistogramByGC[bin.GC][(int)bin.Count]++;
            }
            using (StreamWriter writer = new StreamWriter(filePath))
            {
                // Header line:
                writer.Write("#Bin\\GC");
                for (int GC = 0; GC < HistogramByGC.Length; GC++)
                    writer.Write("GC{0}\t", GC);
                writer.WriteLine();
                // Body:
                for (int count = 0; count < 1024; count++)
                {
                    writer.Write("{0}\t", count);
                    for (int GC = 0; GC < HistogramByGC.Length; GC++)
                        writer.Write("{0}\t", HistogramByGC[GC][count]);
                    writer.WriteLine();
                }
            }
            Console.WriteLine("Wrote counts-by-GC histogram to {0}", filePath);
        }