CanvasCommon.CopyNumberOracle.LoadKnownCNBed C# (CSharp) Method

LoadKnownCNBed() protected method

Load known CN data from a .bed file. File lines have fields: chromosome, start, end, chromcountA, chromcountB So, copy number is the sum of the last 2 fields, major chromosome count is the max of the last 2 fields.
protected LoadKnownCNBed ( string oracleBedPath ) : void
oracleBedPath string
return void
        protected void LoadKnownCNBed(string oracleBedPath)
        {
            bool stripChr = false;
            int count = 0;
            this.KnownCN = new Dictionary<string, List<CNInterval>>();
            using (StreamReader reader = new StreamReader(oracleBedPath))
            {
                while (true)
                {
                    string fileLine = reader.ReadLine();
                    if (fileLine == null) break;
                    if (fileLine.Length == 0 || fileLine[0] == '#') continue;
                    string[] bits = fileLine.Split('\t');
                    string chromosome = bits[0];
                    if (stripChr) chromosome = chromosome.Replace("chr", "");
                    if (!KnownCN.ContainsKey(chromosome)) KnownCN[chromosome] = new List<CNInterval>();
                    CNInterval interval = new CNInterval();
                    interval.Start = int.Parse(bits[1]);
                    interval.End = int.Parse(bits[2]);
                    interval.CN = int.Parse(bits[3]) + int.Parse(bits[4]);
                    if (bits.Length > 5)
                        interval.Heterogeneity = double.Parse(bits[5]);
                    else
                        interval.Heterogeneity = -1.0;
                    KnownCN[chromosome].Add(interval);
                    count++;
                }
            }
            Console.WriteLine(">>>Loaded {0} known-CN intervals", count);
        }