public void FastaParserForManyFiles() { string path = @"TestUtils\FASTA"; Assert.IsTrue(Directory.Exists(path)); int count = 0; FastaParser parser = new FastaParser(); FastaFormatter formatter = new FastaFormatter(); DirectoryInfo di = new DirectoryInfo(path); foreach (FileInfo fi in di.GetFiles("*.fasta")) { using (StreamReader reader = File.OpenText(fi.FullName)) { ApplicationLog.WriteLine("parsing file {0}...", fi.FullName); foreach (Sequence seq in parser.Parse(reader)) { ApplicationLog.Write(formatter.FormatString(seq)); count++; } } ApplicationLog.WriteLine("parsing file {0}...", fi.FullName); } Assert.IsTrue(count >= 3); ((FastaParser)parser).Dispose(); }
private void WriteToLog(string ExceptionMessage) { // Let the calling process know there was an error HasError = true; ExceptionMessage += "\n\nAdditional information:\n\n" + Information; ApplicationLog logger = new ApplicationLog(ExceptionMessage); logger.Write(); }
public void FastAFormatterInvalidateClose() { try { FastAFormatter formatter = new FastAFormatter(); formatter.Close(); Assert.Fail(); } catch (InvalidOperationException ex) { ApplicationLog.Write("Fasta P2 : InvalidOperationException caught successfully. " + ex.Message); } }
public void FastAFormatterInvalidateFormatString() { ISequence iSeq = null; try { string formattedString = FastAFormatter.FormatString(iSeq); Assert.Fail(); } catch (ArgumentNullException ex) { ApplicationLog.Write("Fasta P2 : ArgumentNullException caught successfully. " + ex.Message); } }
public void ValidateWriteForValidLogFile() { string output = utilityObj.xmlUtil.GetTextValue( Constants.ApplicationLogNode, Constants.ExpectedOutputNode); //// Open the file for write. String expectedOutput = ApplicationLog.Write(output); Assert.IsTrue(ApplicationLog.Ready); Assert.AreEqual(output, expectedOutput); ApplicationLog.WriteLine(string.Concat( "ApplicationLog BVT: Validation of Write method for File completed successfully.")); }
/// <summary> /// Writes F matrix to application log. Used for test and debugging. /// Only _FSource can be dumped. /// _FScore, _M, _Ix, _Iy are not stored as part of memory optimization. /// </summary> protected void DumpF() { if (_FSource != null) { ApplicationLog.WriteLine(string.Empty); ApplicationLog.WriteLine("_FSource"); for (int cell = 0; cell < _nCols * _nRows; cell++) { if (cell % _nCols == 0) { ApplicationLog.WriteLine(string.Empty); } ApplicationLog.Write("{0,4} ", _FSource[cell]); } } }
public void InvalidateParseWithEmptyParam() { try { AggregateNumbers aggregateNos = new AggregateNumbers(); CommandLineArguments parser = new CommandLineArguments(); //add parameters parser.Parameter(ArgumentType.Required, "bValue", ArgumentValueType.Bool, "bv", "bool"); parser.Parameter(ArgumentType.Required, "iValue", ArgumentValueType.Int, "iv", "int"); string[] args = { "-:true", "-iValue:5" }; parser.Parse(args, aggregateNos); Assert.Fail(); } catch (ArgumentSyntaxException ex) { ApplicationLog.Write("Successfully caught ArgumentSyntaxException : " + ex.Message); } }
public void InvalidateParseWithWrongParamName() { try { AggregateNumbers aggregateNos = new AggregateNumbers(); CommandLineArguments parser = new CommandLineArguments(); //add parameters parser.Parameter(ArgumentType.Required, "bValue", ArgumentValueType.Bool, "bv", "bool"); parser.Parameter(ArgumentType.Required, "iValue", ArgumentValueType.Int, "iv", "int"); parser.Parameter(ArgumentType.Required, "bArrValues", ArgumentValueType.Bool, "bmv", "boolArrValues"); //pass char in integer array string[] args = { "/wrongname:true", "/iValue:5", "/bArrValues:true", "false" }; parser.Parse(args, aggregateNos); Assert.Fail(); } catch (ArgumentParserException ex) { ApplicationLog.Write("Successfully caught ArgumentNotFoundException : " + ex.Message); } }
public void ValidateSequenceAlignersAll() { MUMmer mumobj = new MUMmer3(); Assert.AreEqual(mumobj.ToString(), SequenceAligners.MUMmer.ToString()); NeedlemanWunschAligner nwAlignerobj = new NeedlemanWunschAligner(); Assert.AreEqual(nwAlignerobj.ToString(), SequenceAligners.NeedlemanWunsch.ToString()); NUCmer nucobj = new NUCmer3(); Assert.AreEqual(nucobj.ToString(), SequenceAligners.NUCmer.ToString()); PairwiseOverlapAligner poAlignerobj = new PairwiseOverlapAligner(); Assert.AreEqual(poAlignerobj.ToString(), SequenceAligners.PairwiseOverlap.ToString()); SmithWatermanAligner swAlignerobj = new SmithWatermanAligner(); Assert.AreEqual(swAlignerobj.ToString(), SequenceAligners.SmithWaterman.ToString()); Assert.IsNotNull(SequenceAligners.All); Console.Write("Successfully created all the objects in Sequence Aligners"); ApplicationLog.Write("Successfully created all the objects in Sequence Aligners"); }