public void TestGffForManyFiles() { // parser and formatter will be used for all files in input dir GffFormatter formatter = new GffFormatter(); // iterate through the files in input dir, parsing and formatting each; write results // to log file DirectoryInfo inputDirInfo = new DirectoryInfo(_gffDataPath); foreach (FileInfo fileInfo in inputDirInfo.GetFiles("*.gff")) { ApplicationLog.WriteLine("Parsing file {0}...{1}", fileInfo.FullName, Environment.NewLine); ISequenceParser parser = new GffParser(); foreach (ISequence sequence in parser.Parse(fileInfo.FullName)) { // don't do anything with it; just make sure it doesn't crash formatter.FormatString(sequence); } ApplicationLog.WriteLine("Parse completed successfully." + Environment.NewLine); } }
public void GffProperties() { GffParser parser = new GffParser(); Assert.AreEqual(parser.Name, Resource.GFF_NAME); Assert.AreEqual(parser.Description, Resource.GFFPARSER_DESCRIPTION); Assert.AreEqual(parser.SupportedFileTypes, Resource.GFF_FILEEXTENSION); GffFormatter formatter = new GffFormatter(); Assert.AreEqual(formatter.Name, Resource.GFF_NAME); Assert.AreEqual(formatter.Description, Resource.GFFFORMATTER_DESCRIPTION); Assert.AreEqual(formatter.SupportedFileTypes, Resource.GFF_FILEEXTENSION); }
public void TestGffWhenParsingOne() { // parse GffParser parser = new GffParser(); ISequence seq = parser.Parse(_singleSeqGffFilename).FirstOrDefault(); // test the non-metadata properties Assert.AreEqual(Alphabets.DNA, seq.Alphabet); Assert.AreEqual("NC_001133.7", seq.ID); // just test the formatting; if that's good, the parsing was good GffFormatter formatter = new GffFormatter(); string actual = formatter.FormatString(seq); Assert.AreEqual(_singleSeqGffFileExpectedOutput.Replace("\r\n", Environment.NewLine), actual); }
public void TestGffWhenParsingMultiple() { // parse ISequenceParser parser = new GffParser(); IEnumerable<ISequence> seqList = parser.Parse(_multipleSeqGffFilename).ToList(); // test the file-scope metadata that is tricky to parse, and will not be tested // implicitly by testing the formatting foreach (ISequence seq in seqList) { var item = seq.Metadata["SOURCE-VERSION"] as MetadataListItem<string>; if (item != null) { Assert.AreEqual("NCBI", item.SubItems["source"]); Assert.AreEqual("C++", item.SubItems["version"]); } Assert.AreEqual(DateTime.Parse("2009-10-27", null), seq.Metadata["date"]); } // just test the formatting; if that's good, the parsing was good new GffFormatter() .Format(seqList, TempGFFFileName); string actual; using (StreamReader reader = new StreamReader(TempGFFFileName)) { actual = reader.ReadToEnd(); } File.Delete(TempGFFFileName); Assert.AreEqual(_multipleSeqGffFileExpectedOutput.Replace("\r\n", Environment.NewLine), actual); }
/// <summary> /// Validates the Format() method in Gff Formatter based on the parameters. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> /// <param name="isFilePath">Is file path passed as parameter?</param> /// <param name="isSequenceList">Is sequence list passed as parameter?</param> void ValidateFormatGeneralTestCases(string nodeName, bool isFilePath, bool isSequenceList) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); seqs = parserObj.Parse(filePath).ToList(); Sequence originalSequence = (Sequence)seqs[0]; // Use the formatter to write the original sequences to a temp file ApplicationLog.WriteLine(string.Format("Gff Formatter BVT: Creating the Temp file '{0}'.", Constants.GffTempFileName)); GffFormatter formatter = new GffFormatter { ShouldWriteSequenceData = true }; if (isFilePath) { if (isSequenceList) formatter.Format(seqs, Constants.GffTempFileName); else formatter.Format(originalSequence, Constants.GffTempFileName); } else { if (isSequenceList) { formatter.Format(seqs); } else { formatter.Format(originalSequence); } } // Read the new file, then compare the sequences IList<ISequence> seqsNew = null; GffParser newParser = new GffParser(); { seqsNew = newParser.Parse(Constants.GffTempFileName).ToList(); } Assert.IsNotNull(seqsNew); ApplicationLog.WriteLine(string.Format("Gff Formatter BVT: New Sequence is '{0}'.", seqsNew[0].ToString())); bool val = ValidateFeatures(seqsNew[0], nodeName); Assert.IsTrue(val); ApplicationLog.WriteLine( "GFF Formatter BVT : All the features validated successfully."); // Now compare the sequences. int countNew = seqsNew.Count(); int expectedCount = 1; Assert.AreEqual(expectedCount, countNew); ApplicationLog.WriteLine("The Number of sequences are matching."); Assert.AreEqual(originalSequence.ID, seqsNew[0].ID); string orgSeq = new string(originalSequence.Select(x => (char)x).ToArray()); ; ISequence newSeq = seqsNew.FirstOrDefault(); string newSeqString = new string(newSeq.Select(x => (char)x).ToArray()); Assert.AreEqual(orgSeq, newSeqString); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter BVT: The Gff sequences '{0}' are matching with Format() method.", seqsNew[0].ToString())); // Passed all the tests, delete the tmp file. If we failed an Assert, // the tmp file will still be there in case we need it for debugging. if (File.Exists(Constants.GffTempFileName)) File.Delete(Constants.GffTempFileName); ApplicationLog.WriteLine("Deleted the temp file created."); }
/// <summary> /// Parses all test cases related to Parse() method based on the /// parameters passed and validates the same. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> void ValidateParseWithStreams(string nodeName) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); // Logs information to the log file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT : File Exists in the Path '{0}'.", filePath)); IList<ISequence> seqs = null; using (var reader = File.OpenRead(filePath)) { GffParser parserObj = new GffParser(); { seqs = parserObj.Parse(reader).ToList(); } } int expectedSequenceCount = 1; Assert.IsNotNull(seqs); Assert.AreEqual(expectedSequenceCount, seqs.Count); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT : Number of Sequences found are '{0}'.", seqs.Count.ToString((IFormatProvider)null))); Assert.IsTrue(ValidateFeatures(seqs[0], nodeName)); ApplicationLog.WriteLine( "Gff Parser BVT : Successfully validated all the Features for a give Sequence in GFF File."); string expectedSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode); Sequence seq = (Sequence)seqs[0]; Assert.IsNotNull(seq); byte[] TempSeqData = new byte[seq.Count]; for (int i = 0; i < seq.Count; i++) { TempSeqData[i] = seq[i]; } string sequenceInString = new string(TempSeqData.Select(x => (char)x).ToArray()); Assert.AreEqual(expectedSequence, sequenceInString); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Gff sequence '{0}' validation after Parse() is found to be as expected.", seq.ToString())); byte[] tmpEncodedSeq = new byte[seq.Count]; for (int i = 0; i < seq.Count; i++) { tmpEncodedSeq[i] = seq[i]; } Assert.AreEqual(expectedSequence.Length, tmpEncodedSeq.Length); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Gff Length sequence '{0}' is as expected.", expectedSequence.Length)); string expectedAlphabet = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode).ToLower(CultureInfo.CurrentCulture); Assert.IsNotNull(seq.Alphabet); Assert.AreEqual(seq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), expectedAlphabet); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Sequence Alphabet is '{0}' and is as expected.", seq.Alphabet.Name)); string expectedSequenceId = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceIdNode); Assert.AreEqual(expectedSequenceId, seq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Sequence ID is '{0}' and is as expected.", seq.ID)); }
public void GffFormatterValidateFormatString() { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(Constants.SimpleGffNodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); seqs = parserObj.Parse(filePath).ToList(); ISequence originalSequence = seqs[0]; // Use the formatter to write the original sequences to a temp file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter BVT: Creating the Temp file '{0}'.", Constants.GffTempFileName)); GffFormatter formatter = new GffFormatter(); formatter.ShouldWriteSequenceData = true; string formatString = formatter.FormatString(originalSequence); string expectedString = utilityObj.xmlUtil.GetTextValue( Constants.SimpleGffNodeName, Constants.FormatStringNode); expectedString = expectedString.Replace("current-date", DateTime.Today.ToString("yyyy-MM-dd", null)); expectedString = expectedString.Replace("\r", "").Replace("\n", "").Replace(" ", "").Replace("\t", "").ToUpper(CultureInfo.CurrentCulture); string modifedformatString = formatString.Replace("\r", "").Replace("\n", "").Replace(" ", "").Replace("\t", "").ToUpper(CultureInfo.CurrentCulture); Assert.AreEqual(modifedformatString, expectedString); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter BVT: The Gff Format String '{0}' are matching with FormatString() method and is as expected.", formatString)); // Passed all the tests, delete the tmp file. If we failed an Assert, // the tmp file will still be there in case we need it for debugging. File.Delete(Constants.GffTempFileName); ApplicationLog.WriteLine("Deleted the temp file created."); }
/// <summary> /// Parses all test cases related to ParseOne() method based on the /// parameters passed and validates the same. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> /// <param name="isFilePath">Is file path passed as parameter?</param> void ValidateParseOneGeneralTestCases(string nodeName, bool isFilePath) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); // Logs information to the log file ApplicationLog.WriteLine(string.Format("Gff Parser BVT : File Exists in the Path '{0}'.", filePath)); ISequence originalSeq; GffParser parserObj = new GffParser(); if (isFilePath) { originalSeq = parserObj.Parse(filePath).First(); } else { using (var reader = File.OpenRead(filePath)) { originalSeq = parserObj.Parse(reader).First(); } } Assert.IsNotNull(originalSeq); Assert.IsTrue(ValidateFeatures(originalSeq, nodeName)); ApplicationLog.WriteLine( "Gff Parser BVT : Successfully validated all the Features for a give Sequence in GFF File."); string expectedSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode); string sequenceInString = new string(originalSeq.Select(x => (char)x).ToArray()); Assert.AreEqual(expectedSequence, sequenceInString); ApplicationLog.WriteLine(string.Format("Gff Parser BVT: The Gff sequence '{0}' validation after ParseOne() is found to be as expected.", originalSeq.ToString())); byte[] tmpEncodedSeq = new byte[originalSeq.Count]; for (int i = 0; i < originalSeq.Count; i++) { tmpEncodedSeq[i] = originalSeq[i]; } Assert.AreEqual(expectedSequence.Length, tmpEncodedSeq.Length); ApplicationLog.WriteLine(string.Format("Gff Parser BVT: The Gff Length sequence '{0}' is as expected.", expectedSequence.Length)); string expectedAlphabet = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode).ToLower(CultureInfo.CurrentCulture); Assert.IsNotNull(originalSeq.Alphabet); Assert.AreEqual(originalSeq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), expectedAlphabet); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Sequence Alphabet is '{0}' and is as expected.", originalSeq.Alphabet.Name)); string expectedSequenceId = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceIdNode); Assert.AreEqual(expectedSequenceId, originalSeq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser BVT: The Sequence ID is '{0}' and is as expected.", originalSeq.ID)); }
public void GffParserValidateOpen() { string filename = utilityObj.xmlUtil.GetTextValue(Constants.OneLineSeqGffNodeName, Constants.FilePathNode); GffParser parser = new GffParser(); { try { parser.Open(filename); } catch (System.IO.IOException exception) { Assert.Fail("Exception thrown on opening a file " + exception.Message); } } ApplicationLog.WriteLine("Opened the file successfully"); }
public void GffParserValidateParseWithOneLineFeatures() { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue( Constants.SimpleGffFeaturesNode, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); seqs = parserObj.Parse(filePath).ToList(); Sequence originalSequence = (Sequence)seqs[0]; bool val = ValidateFeatures(originalSequence, Constants.OneLineSeqGffNodeName); Assert.IsTrue(val); filePath = utilityObj.xmlUtil.GetTextValue( Constants.SimpleGffFeaturesReaderNode, Constants.FilePathNode); GffParser parserObj1 = new GffParser(); seqs.Add(parserObj1.Parse(filePath).FirstOrDefault()); originalSequence = (Sequence)seqs[0]; val = ValidateFeatures(originalSequence, Constants.OneLineSeqGffNodeName); Assert.IsTrue(val); ApplicationLog.WriteLine("GFF Parser BVT : All the features validated successfully."); }
/// <summary> /// Parses all test cases related to Parse() method with multi sequence /// based on the parameters passed /// and validates the same. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> /// <param name="isFilePath">Is file path passed as parameter?</param> void ValidateParseMultiSequenceGeneralTestCases(string nodeName, bool isFilePath) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); // Logs information to the log file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1 : File Exists in the Path '{0}'.", filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); if (isFilePath) { seqs = parserObj.Parse(filePath).ToList(); } else { using (var reader = File.OpenRead(filePath)) { seqs = parserObj.Parse(reader).ToList(); } } int expectedNoOfSeqs = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.NumberOfSequencesNode), null); Assert.IsNotNull(seqs); Assert.AreEqual(expectedNoOfSeqs, seqs.Count); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1 : Number of Sequences found are '{0}'.", seqs.Count.ToString((IFormatProvider)null))); string[] expectedSequences = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.ExpectedSequenesNode); string[] alphabets = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.AlphabetsNode); string[] seqIds = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.SequenceIdsNode); for (int i = 0; i < expectedNoOfSeqs; i++) { bool valFeat = ValidateMultiSequenceFeatures(seqs[i], i + 1, nodeName); Assert.IsTrue(valFeat); ApplicationLog.WriteLine( "Gff Parser P1 : Successfully validated all the Features for a give Sequence in GFF File."); Sequence seq = (Sequence)seqs[i]; Assert.IsNotNull(seq); string sequenceInString1 = new string(seq.Select(x => (char)x).ToArray()); if (string.Compare(sequenceInString1, sequenceInString1.ToUpper(CultureInfo.CurrentCulture)) == 0) { expectedSequences[i] = expectedSequences[i].ToUpper(CultureInfo.CurrentCulture); } else { expectedSequences[i] = expectedSequences[i].ToLower(CultureInfo.CurrentCulture); } Assert.AreEqual(expectedSequences[i], sequenceInString1); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Gff sequence '{0}' validation after Parse() is found to be as expected.", sequenceInString1)); Assert.AreEqual(expectedSequences[i].Length, sequenceInString1.Length); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Gff Length sequence '{0}' is as expected.", expectedSequences[i].Length)); Assert.IsNotNull(seq.Alphabet); Assert.AreEqual(seq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), alphabets[i]); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Sequence Alphabet is '{0}' and is as expected.", seq.Alphabet.Name)); Assert.AreEqual(seqIds[i], seq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Sequence ID is '{0}' and is as expected.", seq.ID)); } }
/// <summary> /// Parses all test cases related to Parse() method based on /// the parameters passed and validates the same. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> /// <param name="isFilePath">Is file path passed as parameter?</param> /// <param name="parseParam">Parse method parameters</param> void ValidateParseGeneralTestCases(string nodeName, bool isFilePath, ParserParameters parseParam) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); // Logs information to the log file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1 : File Exists in the Path '{0}'.", filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); switch (parseParam) { case ParserParameters.AlphabetProperty: parserObj.Alphabet = Alphabets.DNA; break; default: break; } if (isFilePath) { seqs = parserObj.Parse(filePath).ToList(); } else { using (var reader = File.OpenRead(filePath)) seqs = parserObj.Parse(reader).ToList(); } Assert.IsNotNull(seqs); int expectedCount = 1; Assert.AreEqual(expectedCount, seqs.Count); ApplicationLog.WriteLine(string.Format("Gff Parser P1 : Number of Sequences found are '{0}'.", seqs.Count.ToString((IFormatProvider)null))); bool valFeat = ValidateFeatures(seqs[0], nodeName); Assert.IsTrue(valFeat); ApplicationLog.WriteLine( "Gff Parser P1 : Successfully validated all the Features for a give Sequence in GFF File."); string expectedSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode); Sequence seq = (Sequence)seqs[0]; Assert.IsNotNull(seq); string sequenceInString = new string(seq.Select(x => (char)x).ToArray()); Assert.AreEqual(expectedSequence, sequenceInString); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Gff sequence '{0}' validation after Parse() is found to be as expected.", sequenceInString)); byte[] TempSeqData1 = new byte[seq.Count]; for (int i = 0; i < seq.Count; i++) { TempSeqData1[i] = seq[i]; } Assert.AreEqual(expectedSequence.Length, TempSeqData1.Length); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Gff Length sequence '{0}' is as expected.", expectedSequence.Length)); string expectedAlphabet = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode).ToLower(CultureInfo.CurrentCulture); Assert.IsNotNull(seq.Alphabet); Assert.AreEqual(seq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), expectedAlphabet); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Sequence Alphabet is '{0}' and is as expected.", seq.Alphabet.Name)); string expectedSequenceId = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceIdNode); Assert.AreEqual(expectedSequenceId, seq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Parser P1: The Sequence ID is '{0}' and is as expected.", seq.ID)); }
/// <summary> /// Validates the Format() method in Gff Formatter for Multi sequences based on the parameters. /// </summary> /// <param name="nodeName">Xml Node name to be read.</param> void ValidateFormatMultiSequencesTestCases(string nodeName) { // Gets the expected sequence from the Xml string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsTrue(File.Exists(filePath)); IList<ISequence> seqs = null; GffParser parserObj = new GffParser(); seqs = parserObj.Parse(filePath).ToList(); // Use the formatter to write the original sequences to a temp file ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter P1: Creating the Temp file '{0}'.", Constants.GffTempFileName)); GffFormatter formatter = new GffFormatter { ShouldWriteSequenceData = true }; formatter.Format(seqs, Constants.GffTempFileName); int noOfSeqs = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.NumberOfSequencesNode), null); Assert.IsNotNull(seqs); Assert.AreEqual(noOfSeqs, seqs.Count); ApplicationLog.WriteLine(string.Format("Gff Formatter P1 : Number of Sequences found are '{0}'.", seqs.Count.ToString((IFormatProvider)null))); string[] expectedSequences = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.ExpectedSequenesNode); string[] alphabets = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.AlphabetsNode); string[] seqIds = utilityObj.xmlUtil.GetTextValues(nodeName, Constants.SequenceIdsNode); for (int i = 0; i < noOfSeqs; i++) { bool valFeat = ValidateMultiSequenceFeatures(seqs[i], i + 1, nodeName); Assert.IsTrue(valFeat); ApplicationLog.WriteLine( "Gff Formatter P1 : Successfully validated all the Features for a give Sequence in GFF File."); Sequence seq = (Sequence)seqs[i]; Assert.IsNotNull(seq); string newSeq = new string(seq.Select(x => (char)x).ToArray()); if (string.Compare(newSeq, newSeq.ToUpper(CultureInfo.CurrentCulture)) == 0) { expectedSequences[i] = expectedSequences[i].ToUpper(CultureInfo.CurrentCulture); } else { expectedSequences[i] = expectedSequences[i].ToLower(CultureInfo.CurrentCulture); } Assert.AreEqual(expectedSequences[i], newSeq); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter P1: The Gff sequence '{0}' validation after Parse() is found to be as expected.", newSeq)); byte[] TempSeqData = new byte[seq.Count]; for (int j = 0; j < seq.Count; j++) { TempSeqData[j] = seq[j]; } Assert.AreEqual(expectedSequences[i].Length, TempSeqData.Length); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter P1: The Gff Length sequence '{0}' is as expected.", expectedSequences[i].Length)); Assert.IsNotNull(seq.Alphabet); Assert.AreEqual(seq.Alphabet.Name.ToLower(CultureInfo.CurrentCulture), alphabets[i]); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter P1: The Sequence Alphabet is '{0}' and is as expected.", seq.Alphabet.Name)); Assert.AreEqual(seqIds[i], seq.ID); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "Gff Formatter P1: The Sequence ID is '{0}' and is as expected.", seq.ID)); } // Passed all the tests, delete the tmp file. If we failed an Assert, // the tmp file will still be there in case we need it for debugging. if (File.Exists(Constants.GffTempFileName)) File.Delete(Constants.GffTempFileName); ApplicationLog.WriteLine("Deleted the temp file created."); }