Ejemplo n.º 1
0
        /// <summary>
        /// Refine layout in the delta alignments.
        /// </summary>
        public void RefineLayout()
        {
            TimeSpan  timeSpan     = new TimeSpan();
            Stopwatch runAlgorithm = new Stopwatch();

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

            using (var input = File.OpenRead(FilePath[1]))
            {
                queryParser = new FastASequencePositionParser(input, true);
                queryParser.CacheSequencesForRandomAccess();
            }
            runAlgorithm.Stop();

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

            inputFileinfo   = new FileInfo(this.FilePath[0]);
            inputFileLength = inputFileinfo.Length;
            runAlgorithm.Restart();
            using (var input = File.OpenRead(FilePath[0]))
                using (DeltaAlignmentCollection deltaCollection = new DeltaAlignmentCollection(input, queryParser))
                {
                    runAlgorithm.Stop();

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

                    runAlgorithm.Restart();
                    IEnumerable <DeltaAlignment> result = LayoutRefiner.RefineLayout(deltaCollection);
                    DeltaAlignmentSorter         sorter = new DeltaAlignmentSorter();
                    WriteDelta(result, sorter, UnsortedLayoutRefinmentOutputFilename);
                    runAlgorithm.Stop();
                    timeSpan = timeSpan.Add(runAlgorithm.Elapsed);

                    runAlgorithm.Restart();
                    WriteSortedDelta(sorter, UnsortedLayoutRefinmentOutputFilename, queryParser, this.OutputFile);
                    runAlgorithm.Stop();
                }

            if (this.Verbose)
            {
                Output.WriteLine(OutputLevel.Verbose);
                Output.WriteLine(OutputLevel.Verbose, "Compute time: {0}", timeSpan);
                Output.WriteLine(OutputLevel.Verbose, "Write time: {0}", runAlgorithm.Elapsed);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Refine layout in the delta alignments.
        /// </summary>
        public void RefineLayout()
        {
            TimeSpan  timeSpan        = new TimeSpan();
            Stopwatch runAlgorithm    = new Stopwatch();
            FileInfo  inputFileinfo   = new FileInfo(this.FilePath);
            long      inputFileLength = inputFileinfo.Length;

            inputFileinfo = null;

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

            runAlgorithm.Stop();

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

            runAlgorithm.Restart();
            LayoutRefiner.RefineLayout(deltas);
            runAlgorithm.Stop();
            timeSpan = timeSpan.Add(runAlgorithm.Elapsed);

            runAlgorithm.Restart();
            this.WriteDelta(deltas);
            runAlgorithm.Stop();


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