/// <summary>
        /// Resolve ambiguity in the delta alignments.
        /// </summary>
        public void ResolveAmbiguity()
        {
            TimeSpan  repeatResolutionSpan = new TimeSpan();
            Stopwatch runRepeatResolution  = new Stopwatch();

            runRepeatResolution.Restart();
            FileInfo inputFileinfo   = new FileInfo(this.FilePath[1]);
            long     inputFileLength = inputFileinfo.Length;

            runRepeatResolution.Stop();

            if (this.Verbose)
            {
                Console.Error.WriteLine();
                Console.Error.WriteLine("  Processed Query FastA file: {0}", Path.GetFullPath(this.FilePath[1]));
                Console.Error.WriteLine("            Read/Processing time: {0}", runRepeatResolution.Elapsed);
                Console.Error.WriteLine("            File Size           : {0}", inputFileLength);
            }

            inputFileinfo   = new FileInfo(this.FilePath[0]);
            inputFileLength = inputFileinfo.Length;

            runRepeatResolution.Restart();
            DeltaAlignmentSorter sorter = null;

            using (var alignmentStream = File.OpenRead(this.FilePath[0]))
                using (var readStream = File.OpenRead(this.FilePath[1]))
                    using (DeltaAlignmentCollection deltaCollection = new DeltaAlignmentCollection(alignmentStream, readStream))
                    {
                        runRepeatResolution.Stop();

                        if (this.Verbose)
                        {
                            Console.Error.WriteLine();
                            Console.Error.WriteLine("  Processed DeltaAlignment file: {0}", Path.GetFullPath(this.FilePath[0]));
                            Console.Error.WriteLine("            Read/Processing time: {0}", runRepeatResolution.Elapsed);
                            Console.Error.WriteLine("            File Size           : {0}", inputFileLength);
                        }

                        runRepeatResolution.Restart();
                        IEnumerable <DeltaAlignment> outputDeltas = RepeatResolver.ResolveAmbiguity(deltaCollection);
                        sorter = new DeltaAlignmentSorter();
                        WriteUnsortedDelta(outputDeltas, sorter);
                    }

            runRepeatResolution.Stop();
            repeatResolutionSpan = repeatResolutionSpan.Add(runRepeatResolution.Elapsed);
            runRepeatResolution.Restart();
            this.WriteDelta(sorter);
            runRepeatResolution.Stop();

            if (this.Verbose)
            {
                Console.Error.WriteLine("  Compute time: {0}", repeatResolutionSpan);
                Console.Error.WriteLine("  Write() time: {0}", runRepeatResolution.Elapsed);
            }
        }
Example #2
0
        /// <summary>
        /// Resolve ambuiguity in the delta alignments.
        /// </summary>
        public void ResolveAmbiguity()
        {
            TimeSpan  repeatResolutionSpan = new TimeSpan();
            Stopwatch runRepeatResolution  = new Stopwatch();
            FileInfo  inputFileinfo        = new FileInfo(this.FilePath);
            long      inputFileLength      = inputFileinfo.Length;

            inputFileinfo = null;

            runRepeatResolution.Restart();
            DeltaAlignmentParser parser = new DeltaAlignmentParser(this.FilePath);
            IList <IEnumerable <DeltaAlignment> > deltas = parser.Parse();

            runRepeatResolution.Stop();

            if (this.Verbose)
            {
                Console.WriteLine();
                Console.WriteLine("  Processed DeltaAlignment file: {0}", Path.GetFullPath(this.FilePath));
                Console.WriteLine("            Read/Processing time: {0}", runRepeatResolution.Elapsed);
                Console.WriteLine("            File Size           : {0}", inputFileLength);
            }

            runRepeatResolution.Restart();
            List <DeltaAlignment> outputDeltas        = RepeatResolver.ResolveAmbiguity(deltas);
            List <DeltaAlignment> orderedOutputDeltas = outputDeltas.OrderBy(a => a.FirstSequenceStart).ToList();

            runRepeatResolution.Stop();
            repeatResolutionSpan = repeatResolutionSpan.Add(runRepeatResolution.Elapsed);

            runRepeatResolution.Restart();
            this.WriteDelta(orderedOutputDeltas);
            runRepeatResolution.Stop();


            if (this.Verbose)
            {
                Console.WriteLine("  Compute time: {0}", repeatResolutionSpan);
                Console.WriteLine("  Write() time: {0}", runRepeatResolution.Elapsed);
            }
        }