Beispiel #1
0
        /// <summary>
        /// Method which will export a parsed BED file
        /// </summary>
        /// <param name="e">Event Arguments</param>
        private void DoExportRangeSequence(InputSequenceRangeSelectionEventArg e)
        {
            Stream sequenceWriter = null;
            //todo: Below line used hard coded BEDFormatter, have to get it from args later on
            ISequenceRangeFormatter formatter = new BedFormatter();
            var saveDialog = new SaveFileDialog { Filter = "BED Files|*.BED" };

            try
            {
                if (e.Sequences[0].GroupIDs.Any())
                {
                    if (saveDialog.ShowDialog() == DialogResult.OK)
                    {
                        // Get a textwriter to the file which will append text to it.
                        sequenceWriter = File.OpenWrite(saveDialog.FileName);
                        formatter.Format(sequenceWriter, e.Sequences[0]);
                    }
                }
                else
                {
                    MessageBox.Show(
                        Resources.EMPTY_SEQUENCE_RANGE,
                        Resources.CAPTION,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Resources.CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                if (sequenceWriter != null)
                {
                    sequenceWriter.Close();
                }
            }
        }
Beispiel #2
0
        public void SubtractTest()
        {
            var direc = System.IO.Path.Combine ("TestUtils", "BED", "Subtract");
            string refSeqRangefile = System.IO.Path.Combine (direc, "Subtract_ref.BED");
            string querySeqRangefile = System.IO.Path.Combine (direc, "Subtract_query.BED");
            string resultfilepath = "tmp_mergeresult.bed";
            BedParser parser = new BedParser();
            BedFormatter formatter = new BedFormatter();
            SequenceRangeGrouping result = null;
            bool resultvalue = false;

            SequenceRangeGrouping refSeqRange = parser.ParseRangeGrouping(refSeqRangefile);
            SequenceRangeGrouping querySeqRange = parser.ParseRangeGrouping(querySeqRangefile);

            string expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap1.BED");
            result = refSeqRange.Subtract(querySeqRange, 1, SubtractOutputType.IntervalsWithNoOverlap);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap0.BED");
            result = refSeqRange.Subtract(querySeqRange, 0, SubtractOutputType.IntervalsWithNoOverlap);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap1.BED");
            result = refSeqRange.Subtract(querySeqRange, 1, SubtractOutputType.IntervalsWithNoOverlap, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap0.BED");
            result = refSeqRange.Subtract(querySeqRange, 0, SubtractOutputType.IntervalsWithNoOverlap, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);


            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap1.BED");
            result = refSeqRange.Subtract(querySeqRange, 1, SubtractOutputType.IntervalsWithNoOverlap, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap0.BED");
            result = refSeqRange.Subtract(querySeqRange, 0, SubtractOutputType.IntervalsWithNoOverlap, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap0_NOnOverlappingPieces.BED");
            result = refSeqRange.Subtract(querySeqRange, 0, SubtractOutputType.NonOverlappingPiecesOfIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = System.IO.Path.Combine (direc, "Result_Subtract_minoverlap1_NOnOverlappingPieces.BED");
            result = refSeqRange.Subtract(querySeqRange, 1, SubtractOutputType.NonOverlappingPiecesOfIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);
        }
Beispiel #3
0
        public void IntersectOperationTest()
        {
            string resultfilepath = "tmp_mergeresult.bed";
            string expectedresultpath = string.Empty;
            BedParser parser = new BedParser();
            BedFormatter formatter = new BedFormatter();

            SequenceRangeGrouping result = null;
            bool resultvalue = false;
            resultfilepath = "tmp_mergeresult.bed";
            string direc = Path.Combine("TestUtils", "BED", "Intersect");

            string reffile =  Path.Combine(direc, @"Intersect_ref.BED");
            string queryFile = Path.Combine(direc, "Intersect_query.BED");
            SequenceRangeGrouping refSeqRange = parser.ParseRangeGrouping(reffile);
            SequenceRangeGrouping querySeqRange = parser.ParseRangeGrouping(queryFile);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap1_OverLappingBases.BED");
            result = refSeqRange.Intersect(querySeqRange, 1, IntersectOutputType.OverlappingPiecesOfIntervals);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap1.BED");
            result = refSeqRange.Intersect(querySeqRange, 1, IntersectOutputType.OverlappingIntervals);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap0_OverLappingBases.BED");
            result = refSeqRange.Intersect(querySeqRange, 0, IntersectOutputType.OverlappingPiecesOfIntervals);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap0.BED");
            result = refSeqRange.Intersect(querySeqRange, 0, IntersectOutputType.OverlappingIntervals);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap1_OverLappingBases.BED");
            result = refSeqRange.Intersect(querySeqRange, 1, IntersectOutputType.OverlappingPiecesOfIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap1.BED");
            result = refSeqRange.Intersect(querySeqRange, 1, IntersectOutputType.OverlappingIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap0_OverLappingBases.BED");
            result = refSeqRange.Intersect(querySeqRange, 0, IntersectOutputType.OverlappingPiecesOfIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);


            expectedresultpath = Path.Combine(direc, "Result_Intersect_MinOverlap0.BED");
            result = refSeqRange.Intersect(querySeqRange, 0, IntersectOutputType.OverlappingIntervals, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);
            File.Delete(resultfilepath);
        }
Beispiel #4
0
        public void MergeOperationTest()
        {
            string direc = Path.Combine ("TestUtils", "BED", "Merge");
            string filepath = Path.Combine(direc, "Merge_single.BED");
            string resultfilepath = "tmp_mergeresult.bed";
            string expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            BedParser parser = new BedParser();
            BedFormatter formatter = new BedFormatter();
            SequenceRangeGrouping seqGrouping = null;
            SequenceRangeGrouping result = null;
            bool resultvalue = false;
            resultfilepath = "tmp_mergeresult.bed";
            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            seqGrouping = parser.ParseRangeGrouping(filepath);

            result = seqGrouping.MergeOverlaps();
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            result = seqGrouping.MergeOverlaps(0, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            result = seqGrouping.MergeOverlaps(0, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            result = seqGrouping.MergeOverlaps(0);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            result = seqGrouping.MergeOverlaps(0, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength0.BED");
            result = seqGrouping.MergeOverlaps(0, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength1.BED");
            result = seqGrouping.MergeOverlaps(1);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);


            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength-1.BED");
            result = seqGrouping.MergeOverlaps(-1);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);


            expectedresultpath = Path.Combine(direc, "Result_Merge_Single_MinLength-3.BED");
            result = seqGrouping.MergeOverlaps(-3);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, seqGrouping, null, false);
            Assert.IsTrue(resultvalue);

            string firstFile = Path.Combine(direc, "Merge_twofiles_1.BED");
            string secondFile = Path.Combine(direc, "Merge_twofiles_2.BED");
            SequenceRangeGrouping refSeqRange = parser.ParseRangeGrouping(firstFile);
            SequenceRangeGrouping querySeqRange = parser.ParseRangeGrouping(secondFile);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength0.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            result = refSeqRange.MergeOverlaps(querySeqRange, 0, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            result = refSeqRange.MergeOverlaps(querySeqRange, 0, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            result = refSeqRange.MergeOverlaps(querySeqRange, 0);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            result = refSeqRange.MergeOverlaps(querySeqRange, 0, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            result = refSeqRange.MergeOverlaps(querySeqRange, 0, false);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, false);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength1.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange, 1, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength-1.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange, -1, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength-3.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange, -3, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength2.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange, 2, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);

            expectedresultpath = Path.Combine(direc, "Result_Merge_Two_MinLength6.BED");
            result = refSeqRange.MergeOverlaps(querySeqRange, 6, true);
            formatter.Format(result, resultfilepath);
            resultvalue = CompareBEDOutput(resultfilepath, expectedresultpath);
            Assert.IsTrue(resultvalue);
            resultvalue = ValidateParentSeqRange(result, refSeqRange, querySeqRange, true);
            Assert.IsTrue(resultvalue);
            File.Delete(resultfilepath);
        }
Beispiel #5
0
        /// <summary>
        ///     Formats the Range/RangeGroup for different test cases based
        ///     on Additional parameter
        /// </summary>
        /// <param name="nodeName">Xml Node name</param>
        /// <param name="addParam">Additional parameter</param>
        private void FormatterGeneralTestCases(string nodeName,
                                               AdditionalParameters addParam)
        {
            IList<ISequenceRange> rangeList = new List<ISequenceRange>();
            var rangeGroup = new SequenceRangeGrouping();

            // Gets the file name.
            string filePath = utilityObj.xmlUtil.GetTextValue(
                nodeName, Constants.FilePathNode);

            // Condition to check if Parse() happens before Format()
            switch (addParam)
            {
                case AdditionalParameters.ParseRangeGroup:
                case AdditionalParameters.ParseRangeGroupTextWriter:
                    var initialParserGroupObj = new BedParser();
                    rangeGroup =
                        initialParserGroupObj.ParseRangeGrouping(filePath);
                    break;
                case AdditionalParameters.ParseRange:
                case AdditionalParameters.ParseRangeTextWriter:
                    var initialParserObj = new BedParser();
                    rangeList = initialParserObj.ParseRange(filePath);
                    break;
                default:
                    // Gets all the expected values from xml.
                    string expectedID = utilityObj.xmlUtil.GetTextValue(
                        nodeName, Constants.IDNode);
                    string expectedStart = utilityObj.xmlUtil.GetTextValue(
                        nodeName, Constants.StartNode);
                    string expectedEnd = utilityObj.xmlUtil.GetTextValue(
                        nodeName, Constants.EndNode);

                    string[] expectedIDs = expectedID.Split(',');
                    string[] expectedStarts = expectedStart.Split(',');
                    string[] expectedEnds = expectedEnd.Split(',');

                    // Gets the Range Group or Range based on the additional parameter
                    switch (addParam)
                    {
                        case AdditionalParameters.RangeGroupTextWriter:
                        case AdditionalParameters.RangeGroupFileName:
                            for (int i = 0; i < expectedIDs.Length; i++)
                            {
                                var rangeObj1 =
                                    new SequenceRange(expectedIDs[i],
                                                      long.Parse(expectedStarts[i], null),
                                                      long.Parse(expectedEnds[i], null));
                                rangeGroup.Add(rangeObj1);
                            }
                            break;
                        default:
                            for (int i = 0; i < expectedIDs.Length; i++)
                            {
                                var rangeObj2 =
                                    new SequenceRange(expectedIDs[i],
                                                      long.Parse(expectedStarts[i], null),
                                                      long.Parse(expectedEnds[i], null));
                                rangeList.Add(rangeObj2);
                            }
                            break;
                    }
                    break;
            }

            var formatterObj = new BedFormatter();

            // Gets the Range list/Range Group based on the parameters.
            switch (addParam)
            {
                case AdditionalParameters.RangeFileName:
                case AdditionalParameters.ParseRange:
                    formatterObj.Format(rangeList, Constants.BedTempFileName);
                    break;
                case AdditionalParameters.RangeTextWriter:
                case AdditionalParameters.ParseRangeTextWriter:
                    using (var txtWriter = File.Create(Constants.BedTempFileName))
                    {
                        formatterObj.Format(txtWriter, rangeList);
                    }
                    break;
                case AdditionalParameters.RangeGroupFileName:
                case AdditionalParameters.ParseRangeGroup:
                    formatterObj.Format(rangeGroup, Constants.BedTempFileName);
                    break;
                case AdditionalParameters.RangeGroupTextWriter:
                case AdditionalParameters.ParseRangeGroupTextWriter:
                    using (var txtWriter = File.Create(Constants.BedTempFileName))
                    {
                        formatterObj.Format(txtWriter, rangeGroup);
                    }
                    break;
                default:
                    break;
            }

            // Reparse to validate the results
            var parserObj = new BedParser();
            IList<ISequenceRange> newRangeList =
                parserObj.ParseRange(Constants.BedTempFileName);

            // Validation of all the properties.
            for (int i = 0; i < rangeList.Count; i++)
            {
                Assert.AreEqual(rangeList[0].ID, newRangeList[0].ID);
                Assert.AreEqual(rangeList[0].Start, newRangeList[0].Start);
                Assert.AreEqual(rangeList[0].End, newRangeList[0].End);
            }

            ApplicationLog.WriteLine(
                "Bed Formatter P1: Successfully validated the ID, Start and End Ranges");

            // Cleanup the file.
            if (File.Exists(Constants.BedTempFileName))
                File.Delete(Constants.BedTempFileName);
        }