/// <summary> /// Writes out a grouping of ISequenceRange objects to a specified /// file location. /// </summary> /// <param name="rangeGroup">The range grouping to be formatted.</param> /// <param name="fileName">The file where the formatted data is to be written.</param> public void Format(SequenceRangeGrouping rangeGroup, string fileName) { if (rangeGroup == null) { throw new ArgumentNullException("rangeGroup"); } Format(rangeGroup.Flatten(), fileName); }
public void ValidateFlatten() { // Get values from xml. string expectedRangeIDs = Utility._xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.IDNode); string expectedStartIndex = Utility._xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.StartNode); string expectedEndIndex = Utility._xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.EndNode); string expectedSequenceRangeCount = Utility._xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.SequenceRangeCountNode); string actualRangeStarts = string.Empty; string actualRangeEnds = string.Empty; string actualRangeIDs = string.Empty; string[] rangeIDs = expectedRangeIDs.Split(','); string[] rangeStarts = expectedStartIndex.Split(','); string[] rangeEnds = expectedEndIndex.Split(','); SequenceRangeGrouping seqRangeGrouping = new SequenceRangeGrouping(); List <ISequenceRange> rangeList = null; // Create a SequenceRange and add to SequenceRangeList. for (int i = 0; i < rangeIDs.Length; i++) { SequenceRange seqRange = new SequenceRange(rangeIDs[i], long.Parse(rangeStarts[i]), long.Parse(rangeEnds[i])); seqRangeGrouping.Add(seqRange); } //Convert SequenceRangeGroup to SequenceRangeList. rangeList = seqRangeGrouping.Flatten(); // Validate created SequenceRanges. foreach (ISequenceRange seqRange in rangeList) { actualRangeIDs = string.Concat(actualRangeIDs, seqRange.ID.ToString(), ","); actualRangeStarts = string.Concat(actualRangeStarts, seqRange.Start.ToString(), ","); actualRangeEnds = string.Concat(actualRangeEnds, seqRange.End.ToString(), ","); } Assert.AreEqual(expectedSequenceRangeCount, rangeList.Count.ToString()); Assert.AreEqual(expectedRangeIDs, actualRangeIDs.Substring(0, actualRangeIDs.Length - 1)); Assert.AreEqual(expectedStartIndex, actualRangeStarts.Substring(0, actualRangeStarts.Length - 1)); Assert.AreEqual(expectedEndIndex, actualRangeEnds.Substring(0, actualRangeEnds.Length - 1)); Console.WriteLine( "SequenceRange BVT : Successfully validated the SequenceStart,SequenceID and SequenceEnd."); }
/// <summary> /// Writes out a grouping of ISequenceRange objects to a specified /// text writer. /// </summary> /// <param name="rangeGroup">The range grouping to be formatted.</param> /// <param name="writer">The writer stream where the formatted data is to be written.</param> public void Format(SequenceRangeGrouping rangeGroup, TextWriter writer) { if (rangeGroup == null) { throw new ArgumentNullException("rangeGroup"); } if (writer == null) { throw new ArgumentNullException("writer"); } Format(rangeGroup.Flatten(), writer); }
/// <summary> /// Writes out a grouping of ISequenceRange objects to a specified /// stream. /// </summary> /// <param name="stream">The stream where the formatted data is to be written, it will be closed at the end.</param> /// <param name="rangeGroup">The range grouping to be formatted.</param> public void Format(Stream stream, SequenceRangeGrouping rangeGroup) { if (stream == null) { throw new ArgumentNullException("stream"); } if (rangeGroup == null) { throw new ArgumentNullException("rangeGroup"); } this.Format(stream, rangeGroup.Flatten()); }
public void ValidateFlatten() { // Get values from xml. string expectedRangeIDs = utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.IDNode); string expectedStartIndex = utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.StartNode); string expectedEndIndex = utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.EndNode); string expectedSequenceRangeCount = utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.SequenceRangeCountNode); string[] rangeIDs = expectedRangeIDs.Split(','); string[] rangeStarts = expectedStartIndex.Split(','); string[] rangeEnds = expectedEndIndex.Split(','); SequenceRangeGrouping seqRangeGrouping = new SequenceRangeGrouping(); List <ISequenceRange> rangeList = null; // Create a SequenceRange and add to SequenceRangeList. for (int i = 0; i < rangeIDs.Length; i++) { SequenceRange seqRange = new SequenceRange(rangeIDs[i], long.Parse(rangeStarts[i], (IFormatProvider)null), long.Parse(rangeEnds[i], (IFormatProvider)null)); seqRangeGrouping.Add(seqRange); } //Convert SequenceRangeGroup to SequenceRangeList. rangeList = seqRangeGrouping.Flatten(); int j = 0; // Validate created SequenceRanges. foreach (ISequenceRange seqRange in rangeList) { Assert.AreEqual(rangeStarts[j], seqRange.Start.ToString((IFormatProvider)null)); Assert.AreEqual(rangeEnds[j], seqRange.End.ToString((IFormatProvider)null)); Assert.AreEqual(rangeIDs[j], seqRange.ID.ToString((IFormatProvider)null)); j++; } Assert.AreEqual(expectedSequenceRangeCount, rangeList.Count.ToString((IFormatProvider)null)); Console.WriteLine( "SequenceRange BVT : Successfully validated the SequenceStart,SequenceID and SequenceEnd."); }
public void ValidateFlatten() { // Get values from xml. string expectedRangeIDs = this.utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.IDNode); string expectedStartIndex = this.utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.StartNode); string expectedEndIndex = this.utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.EndNode); string expectedSequenceRangeCount = this.utilityObj.xmlUtil.GetTextValue( Constants.SmallSizeBedNodeName, Constants.SequenceRangeCountNode); string[] rangeIDs = expectedRangeIDs.Split(','); string[] rangeStarts = expectedStartIndex.Split(','); string[] rangeEnds = expectedEndIndex.Split(','); var seqRangeGrouping = new SequenceRangeGrouping(); List<ISequenceRange> rangeList = null; // Create a SequenceRange and add to SequenceRangeList. for (int i = 0; i < rangeIDs.Length; i++) { var seqRange = new SequenceRange(rangeIDs[i], long.Parse(rangeStarts[i], null), long.Parse(rangeEnds[i], null)); seqRangeGrouping.Add(seqRange); } //Convert SequenceRangeGroup to SequenceRangeList. rangeList = seqRangeGrouping.Flatten(); int j = 0; // Validate created SequenceRanges. foreach (ISequenceRange seqRange in rangeList) { Assert.AreEqual(rangeStarts[j], seqRange.Start.ToString((IFormatProvider) null)); Assert.AreEqual(rangeEnds[j], seqRange.End.ToString((IFormatProvider) null)); Assert.AreEqual(rangeIDs[j], seqRange.ID.ToString(null)); j++; } Assert.AreEqual(expectedSequenceRangeCount, rangeList.Count.ToString((IFormatProvider) null)); ApplicationLog.WriteLine("SequenceRange BVT : Successfully validated the SequenceStart,SequenceID and SequenceEnd."); }
/// <summary> /// Writes out a grouping of ISequenceRange objects to a specified /// text writer. /// </summary> public void Format(SequenceRangeGrouping rangeGroup, TextWriter writer) { Format(rangeGroup.Flatten(), writer); }
/// <summary> /// Writes out a grouping of ISequenceRange objects to a specified /// file location. /// </summary> public void Format(SequenceRangeGrouping rangeGroup, string fileName) { Format(rangeGroup.Flatten(), fileName); }