private void ReadBEDInput()
{
try
{
Dictionary<string, List<uint>> startByChr = new Dictionary<string, List<uint>>(),
endByChr = new Dictionary<string, List<uint>>();
Dictionary<string, List<double>> scoreByChr = new Dictionary<string, List<double>>();
// Create an instance of StreamReader to read from a file.
// The using statement also closes the StreamReader.
using (GzipReader reader = new GzipReader(this.InputBinPath))
{
string line;
string[] tokens;
while ((line = reader.ReadLine()) != null)
{
tokens = line.Split('\t');
string chr = tokens[Segmentation.idxChr].Trim();
if (!startByChr.ContainsKey(chr))
{
startByChr.Add(chr, new List<uint>());
endByChr.Add(chr, new List<uint>());
scoreByChr.Add(chr, new List<double>());
}
startByChr[chr].Add(Convert.ToUInt32(tokens[Segmentation.idxStart].Trim()));
endByChr[chr].Add(Convert.ToUInt32(tokens[Segmentation.idxEnd].Trim()));
scoreByChr[chr].Add(Convert.ToDouble(tokens[this.idxScore].Trim()));
}
foreach (string chr in startByChr.Keys)
{
this.StartByChr[chr] = startByChr[chr].ToArray();
this.EndByChr[chr] = endByChr[chr].ToArray();
this.ScoreByChr[chr] = scoreByChr[chr].ToArray();
}
}
}
catch (Exception e)
{
Console.Error.WriteLine("File {0} could not be read:", this.InputBinPath);
Console.Error.WriteLine(e.Message);
Environment.Exit(1);
}
}