public static void DeserializeCanvasData(string inputFile, Dictionary<string, BitArray> possibleAlignments,
Dictionary<string, HitArray> observedAlignments, Dictionary<string, Int16[]> fragmentLengths,
Object semaphore, CanvasCoverageMode coverageMode)
{
IntermediateData data = null;
using (FileStream stream = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.Read))
{
Stopwatch watch = new Stopwatch();
watch.Start();
data = ProtoBuf.Serializer.Deserialize<IntermediateData>(stream);
watch.Stop();
Console.WriteLine("File: {0}", inputFile);
Console.WriteLine("Time elapsed: {0}", watch.Elapsed);
}
Dictionary<string, BitArray> tempPossibleAlignments;
Dictionary<string, HitArray> tempObservedAlignments;
Dictionary<string, Int16[]> tempFragmentLengths;
data.GetData(out tempPossibleAlignments, out tempObservedAlignments, out tempFragmentLengths);
lock (semaphore)
{
foreach (KeyValuePair<string, BitArray> kvp in tempPossibleAlignments)
{
possibleAlignments.Add(kvp.Key, kvp.Value);
}
foreach (KeyValuePair<string, HitArray> kvp in tempObservedAlignments)
{
observedAlignments.Add(kvp.Key, kvp.Value);
}
if (coverageMode == CanvasCoverageMode.GCContentWeighted)
{
foreach (KeyValuePair<string, Int16[]> kvp in tempFragmentLengths)
{
fragmentLengths.Add(kvp.Key, kvp.Value);
}
}
}
}