From f6c0fe778ea14164435a618296be402c1cb998bd Mon Sep 17 00:00:00 2001 From: Nigel Delaney Date: Sun, 12 Jul 2015 02:01:42 -0700 Subject: [PATCH] Remove outdated and redundant aligner tests --- .../Alignment/AlignmentP1TestCases.cs | 2790 ----------------- .../Alignment/NeedlemanWunschP2TestCases.cs | 2211 ------------- .../PairwiseOverlapAlignerP2TestCases.cs | 2219 ------------- .../Alignment/SmithWatermanP2TestCases.cs | 2259 ------------- 4 files changed, 9479 deletions(-) delete mode 100644 bio/Tests/Bio.TestAutomation/Algorithms/Alignment/AlignmentP1TestCases.cs delete mode 100644 bio/Tests/Bio.TestAutomation/Algorithms/Alignment/NeedlemanWunschP2TestCases.cs delete mode 100644 bio/Tests/Bio.TestAutomation/Algorithms/Alignment/PairwiseOverlapAlignerP2TestCases.cs delete mode 100644 bio/Tests/Bio.TestAutomation/Algorithms/Alignment/SmithWatermanP2TestCases.cs diff --git a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/AlignmentP1TestCases.cs b/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/AlignmentP1TestCases.cs deleted file mode 100644 index c2fd550..0000000 --- a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/AlignmentP1TestCases.cs +++ /dev/null @@ -1,2790 +0,0 @@ -/**************************************************************************** - * AlignmentP1TestCases.cs - * - * This file contains the Alignment P1 test cases i.e., NeedlemanWunschAligner, - * SmithWatermanAlignmer and SequenceAlignment - * -***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.IO; -using System.Linq; -using Bio.Algorithms.Alignment; -using Bio.Extensions; -using Bio.IO.FastA; -using Bio.SimilarityMatrices; -using Bio.TestAutomation.Util; -using Bio.Tests.Framework; -using Bio.Util.Logging; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Bio.TestAutomation.Algorithms.Alignment -{ - /// - /// Alignment P1 Test case implementation. - /// - [TestClass] - public class AlignmentP1TestCases - { - #region Enums - - /// - /// Alignment Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignParameters - { - AlignList, - AlignListCode, - AllParam, - AllParamCode, - AlignTwo, - AlignTwoCode - }; - - /// - /// Alignment Type Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignmentType - { - SimpleAlign, - Align, - }; - - /// - /// SequenceAlignment methods name which are used for different cases. - /// - private enum SeqAlignmentMethods - { - Add, - Clear, - Contains, - CopyTo, - Remove, - AddSequence, - GetEnumerator - }; - - /// - /// Similarity Matrix Parameters which are used for different test cases - /// based on which the test cases are executed with different Similarity Matrixes. - /// - private enum SimilarityMatrixParameters - { - TextReader, - DiagonalMatrix, - Default - }; - - #endregion Enums - - #region Global Variables - - private readonly Utility utilityObj = new Utility(@"TestUtils\TestsConfig.xml"); - - #endregion Global Variables - - #region Constructor - - /// - /// Static constructor to open log and make other settings needed for test - /// - static AlignmentP1TestCases() - { - Trace.Set(Trace.SeqWarnings); - if (!ApplicationLog.Ready) - { - ApplicationLog.Open("bio.automation.log"); - } - } - - #endregion Constructor - - #region NeedlemanWunschAligner P1 Test cases - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesDna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamDna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesPro() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamPro() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesRna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamRna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesGapCostMin() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamGapCostMin() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesBlosum() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamBlosum() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesPam() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamPam() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesSimMatTextRead() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text Reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamSimMatTextRead() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListSequencesDiagonalSimMat() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamDiagonalSimMat() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoDnaSequences() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoDnaSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListDnaSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamDnaFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoRnaSequences() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoRnaSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListRnaSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamRnaFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoProSequences() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoProSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignListProSequencesFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamProFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesGapCostMin() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesGapCostMinFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignSequenceListGapCostMinFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignAllParamGapCostMinFromXml() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(Two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesBlosum() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesPam() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesSimMatTextRead() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignTwo, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschSimpleAlignTwoSequencesDiagonalSimMat() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignTwo, - SimilarityMatrixParameters.DiagonalMatrix); - } - - #region Gap Extension Cost inclusion Test cases - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesDna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamDna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesPro() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamPro() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesRna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamRna() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - - - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesGapCostMin() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamGapCostMin() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesBlosum() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamBlosum() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesPam() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamPam() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesSimMatTextRead() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.TextReader, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text Reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamSimMatTextRead() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschProAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.TextReader, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesDiagonalSimMat() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.DiagonalMatrix, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamDiagonalSimMat() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.DiagonalMatrix, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost = Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignListSequencesGapCostGapExtensionEqual() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschEqualAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.Default, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost = Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void NeedlemanWunschAlignAllParamGapCostGapExtensionEqual() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschEqualAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.Default, AlignmentType.Align); - } - - #endregion Gap Extension Cost inclusion Test cases - - #endregion NeedlemanWunschAligner P1 Test cases - - #region SmithWatermanAligner P1 Test cases - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesDna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamDna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesPro() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamPro() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesRna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamRna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesGapCostMin() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamGapCostMin() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesBlosum() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamBlosum() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesPam() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanPamAlignAlgorithmNodeName, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamPam() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanPamAlignAlgorithmNodeName, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesSimMatTextRead() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text Reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamSimMatTextRead() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListSequencesDiagonalSimMat() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamDiagonalSimMat() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoDnaSequences() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoDnaSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListDnaSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamDnaFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoRnaSequences() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoRnaSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListRnaSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA RNA sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamRnaFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoProSequences() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoProSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignListProSequencesFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein sequence - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamProFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesGapCostMin() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesGapCostMinFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignTwoCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(list of sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignSequenceListGapCostMinFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignListCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a xml file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein Sequence with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignAllParamGapCostMinFromXml() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParamCode); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(Two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesBlosum() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesPam() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanPamAlignAlgorithmNodeName, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesSimMatTextRead() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignTwo, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two Sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanSimpleAlignTwoSequencesDiagonalSimMat() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignTwo, - SimilarityMatrixParameters.DiagonalMatrix); - } - - #region Gap Extension Cost inclusion Test cases - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesDna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamDna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDnaAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesPro() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamPro() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesRna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Rna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamRna() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanRnaAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesGapCostMin() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Min Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamGapCostMin() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesBlosum() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with blosum SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamBlosum() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesPam() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanPamAlignAlgorithmNodeName, - AlignParameters.AlignList, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Pam SM - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamPam() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanPamAlignAlgorithmNodeName, - AlignParameters.AllParam, SimilarityMatrixParameters.Default, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesSimMatTextRead() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.TextReader, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Similarity Matrix passed as Text Reader - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamSimMatTextRead() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanProAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.TextReader, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesDiagonalSimMat() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.DiagonalMatrix, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost, Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File Diagonal Matrix - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamDiagonalSimMat() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.DiagonalMatrix, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost = Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(ListofSequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignListSequencesGapCostGapExtensionEqual() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanEqualAlignAlgorithmNodeName, - AlignParameters.AlignList, - SimilarityMatrixParameters.Default, AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid Gap Cost = Gap Extension, Similarity Matrix - /// which is in a text file using the method Align(all parameters) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Dna File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SmithWatermanAlignAllParamGapCostGapExtensionEqual() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanEqualAlignAlgorithmNodeName, - AlignParameters.AllParam, - SimilarityMatrixParameters.Default, AlignmentType.Align); - } - - #endregion Gap Extension Cost inclusion Test cases - - #endregion SmithWatermanAligner P1 Test cases - - #region Sequence Alignment P1 Test cases - - /// - /// Pass a valid Dna sequences to AddSequence() method and validate the same. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SequenceAlignmentAddDnaSequence() - { - ValidateGeneralSequenceAlignment(Constants.AlignDnaAlgorithmNodeName, false); - } - - /// - /// Pass a valid Rna sequences to AddSequence() method and validate the same. - /// Input : Rna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SequenceAlignmentAddRnaSequence() - { - ValidateGeneralSequenceAlignment(Constants.AlignRnaAlgorithmNodeName, false); - } - - /// - /// Pass a valid Protein sequences to AddSequence() method and validate the same. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SequenceAlignmentAddProteinSequence() - { - ValidateGeneralSequenceAlignment(Constants.AlignProteinAlgorithmNodeName, false); - } - - /// - /// Pass a valid sequences to AddSequence() method and validate the properties. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void SequenceAlignmentValidateProperties() - { - ValidateGeneralSequenceAlignment(Constants.AlignAlgorithmNodeName, true); - } - - /// - /// Validate all SequenceAlignment public properties - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope"), TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateSequenceAlignmentProperties() - { - // Read the xml file for getting both the files for aligning. - string origSequence1 = utilityObj.xmlUtil.GetTextValue(Constants.AlignDnaAlgorithmNodeName, - Constants.SequenceNode1); - string origSequence2 = utilityObj.xmlUtil.GetTextValue(Constants.AlignDnaAlgorithmNodeName, - Constants.SequenceNode2); - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue( - Constants.AlignDnaAlgorithmNodeName, - Constants.AlphabetNameNode)); - string seqCount = utilityObj.xmlUtil.GetTextValue( - Constants.AlignDnaAlgorithmNodeName, - Constants.SequenceCountNode); - - // Create two sequences - ISequence aInput = new Sequence(alphabet, origSequence1); - ISequence bInput = new Sequence(alphabet, origSequence2); - - // Add the sequences to the Sequence alignment object using AddSequence() method. - IList sequenceAlignmentObj = new List(); - - var alignSeq = new PairwiseAlignedSequence(); - - alignSeq.FirstSequence = aInput; - alignSeq.SecondSequence = bInput; - IPairwiseSequenceAlignment seqAlignObj = new PairwiseSequenceAlignment(aInput, bInput); - seqAlignObj.Add(alignSeq); - sequenceAlignmentObj.Add(seqAlignObj); - - // Validate all properties of sequence alignment class. - Assert.AreEqual(seqCount, seqAlignObj.Count.ToString((IFormatProvider) null)); - Assert.AreEqual(origSequence1, new string(seqAlignObj.FirstSequence.Select(a => (char) a).ToArray())); - Assert.AreEqual(origSequence2, new string(seqAlignObj.SecondSequence.Select(a => (char) a).ToArray())); - Assert.IsFalse(seqAlignObj.IsReadOnly); - Assert.IsNull(seqAlignObj.Documentation); - Assert.AreEqual(seqCount, seqAlignObj.PairwiseAlignedSequences.Count.ToString((IFormatProvider) null)); - - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the IsRead Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Count Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Sequences Property"); - } - - /// - /// Validate SequenceAlignment Add() method. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateAddSequenceToSequenceAlignment() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.Add, false); - } - - /// - /// Validate SequenceAlignment Clear() method. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateDeletingSequenceAlignment() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.Clear, false); - } - - /// - /// Validate SequenceAlignment Contains() method. - /// Input : Dna Sequence read from xml file. - /// Validation : Validate whether SequenceAlignment contains Aligned sequence or not. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateSequenceAlignmentContainsMethod() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.Contains, false); - } - - /// - /// Validate copying SequenceAlignment values to array. - /// Input : Dna Sequence read from xml file. - /// Validation : Validate copying SequenceAlignment values to array. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateCopiedSeqAlinmentItems() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.CopyTo, false); - } - - /// - /// Validate Remove Aligned Sequence from Sequence Alignment - /// Input : Dna Sequence read from xml file. - /// Validation : Validate Sequence Alignment. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateRemoveAlignedSeqItem() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.Remove, false); - } - - /// - /// Validate Sequence Alignment default constructor - /// Input : Dna Sequence read from xml file. - /// Validation : Validate Sequence Alignment default constructor - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateSeqAlignmentDefaultCtr() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.Remove, true); - } - - /// - /// Validate SequenceAlignment AddSequence() method. - /// Input : Dna Sequence read from xml file. - /// Validation : Added sequences are got back and validated. - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateAddSequenceToAlignedSeqList() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.AddSequence, false); - } - - /// - /// Validate GetEnumerator() method. - /// Input : Dna Sequence read from xml file. - /// Validation : Validate GetEnumerator() method - /// - [TestMethod] - [Priority(1)] - [TestCategory("Priority1")] - public void ValidateAlignedSeqGetEnumerator() - { - ValidateSequenceAlignmentGeneralMethods(Constants.AlignAlgorithmNodeName, - SeqAlignmentMethods.GetEnumerator, false); - } - - #endregion Sequence Alignment P1 Test cases - - #region Supporting Methods - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - private void ValidateNeedlemanWunschAlignment(string nodeName, AlignParameters alignParam) - { - ValidateNeedlemanWunschAlignment(nodeName, alignParam, SimilarityMatrixParameters.Default); - } - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - /// Similarity Matrix Parameter. - private void ValidateNeedlemanWunschAlignment(string nodeName, AlignParameters alignParam, - SimilarityMatrixParameters similarityMatrixParam) - { - ValidateNeedlemanWunschAlignment(nodeName, alignParam, similarityMatrixParam, AlignmentType.SimpleAlign); - } - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - /// Similarity Matrix Parameter. - /// Is the Align type Simple or Align with Gap Extension cost? - [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity"), - SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private void ValidateNeedlemanWunschAlignment(string nodeName, AlignParameters alignParam, - SimilarityMatrixParameters similarityMatrixParam, - AlignmentType alignType) - { - ISequence aInput, bInput; - - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - - // Parse the files and get the sequence. - if (alignParam.ToString().Contains("Code")) - { - string sequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string sequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - aInput = new Sequence(alphabet, sequence1); - bInput = new Sequence(alphabet, sequence2); - } - else - { - // Read the xml file for getting both the files for aligning. - string filePath1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1); - string filePath2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2); - using (var parseObjectForFile1 = new FastAParser(filePath1)) - { - parseObjectForFile1.Alphabet = alphabet; - ISequence originalSequence1 = parseObjectForFile1.Parse().FirstOrDefault(); - Assert.IsNotNull(originalSequence1); - aInput = new Sequence(alphabet, originalSequence1.ConvertToString()); - } - using (var parseObjectForFile2 = new FastAParser(filePath2)) - { - parseObjectForFile2.Alphabet = alphabet; - ISequence originalSequence2 = parseObjectForFile2.Parse().FirstOrDefault(); - Assert.IsNotNull(originalSequence2); - bInput = new Sequence(alphabet, originalSequence2.ConvertToString()); - } - } - - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - SimilarityMatrix sm; - - switch (similarityMatrixParam) - { - case SimilarityMatrixParameters.TextReader: - using (TextReader reader = new StreamReader(blosumFilePath)) - sm = new SimilarityMatrix(reader); - break; - case SimilarityMatrixParameters.DiagonalMatrix: - string matchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MatchScoreNode); - string misMatchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MisMatchScoreNode); - sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), - int.Parse(misMatchValue, null)); - break; - default: - sm = new SimilarityMatrix(blosumFilePath); - break; - } - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null); - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode), - null); - - var needlemanWunschObj = new NeedlemanWunschAligner(); - if (AlignParameters.AllParam != alignParam) - { - needlemanWunschObj.SimilarityMatrix = sm; - needlemanWunschObj.GapOpenCost = gapOpenCost; - } - - IList result = null; - - switch (alignParam) - { - case AlignParameters.AlignList: - case AlignParameters.AlignListCode: - var sequences = new List {aInput, bInput}; - switch (alignType) - { - case AlignmentType.Align: - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - result = needlemanWunschObj.Align(sequences); - break; - default: - result = needlemanWunschObj.AlignSimple(sequences); - break; - } - break; - case AlignParameters.AllParam: - case AlignParameters.AllParamCode: - switch (alignType) - { - case AlignmentType.Align: - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - result = needlemanWunschObj.Align(sm, - gapOpenCost, gapExtensionCost, aInput, bInput); - break; - default: - result = needlemanWunschObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - break; - } - break; - case AlignParameters.AlignTwo: - case AlignParameters.AlignTwoCode: - switch (alignType) - { - case AlignmentType.Align: - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - result = needlemanWunschObj.Align(aInput, bInput); - break; - default: - result = needlemanWunschObj.AlignSimple(aInput, bInput); - break; - } - break; - default: - break; - } - - // Read the xml file for getting both the files for aligning. - string expectedSequence1, expectedSequence2, expectedScore; - - switch (alignType) - { - case AlignmentType.Align: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence1Node); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence2Node); - break; - default: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode1); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode2); - break; - } - - IList expectedOutput = new List(); - - IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(aInput, bInput); - var alignedSeq = new PairwiseAlignedSequence - { - FirstSequence = new Sequence(alphabet, expectedSequence1), - SecondSequence = new Sequence(alphabet, expectedSequence2), - Score = Convert.ToInt32(expectedScore, null) - }; - align.PairwiseAlignedSequences.Add(alignedSeq); - expectedOutput.Add(align); - - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P1 : Final Score '{0}'.", expectedScore)); - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P1 : Aligned First Sequence is '{0}'.", - expectedSequence1)); - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P1 : Aligned Second Sequence is '{0}'.", - expectedSequence2)); - - Assert.IsTrue(CompareAlignment(result, expectedOutput)); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - private void ValidateSmithWatermanAlignment(string nodeName, AlignParameters alignParam) - { - ValidateSmithWatermanAlignment(nodeName, alignParam, SimilarityMatrixParameters.Default); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - /// Similarity Matrix Parameter. - private void ValidateSmithWatermanAlignment(string nodeName, AlignParameters alignParam, - SimilarityMatrixParameters similarityMatrixParam) - { - ValidateSmithWatermanAlignment(nodeName, alignParam, similarityMatrixParam, AlignmentType.SimpleAlign); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Node Name in the xml. - /// parameter based on which certain validations are done. - /// Similarity Matrix Parameter. - /// Is the Align type Simple or Align with Gap Extension cost? - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private void ValidateSmithWatermanAlignment(string nodeName, AlignParameters alignParam, - SimilarityMatrixParameters similarityMatrixParam, - AlignmentType alignType) - { - ISequence aInput, bInput; - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - - // Parse the files and get the sequence. - if (alignParam.ToString().Contains("Code")) - { - string sequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string sequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - aInput = new Sequence(alphabet, sequence1); - bInput = new Sequence(alphabet, sequence2); - } - else - { - // Read the xml file for getting both the files for aligning. - string filePath1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1); - string filePath2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2); - - using (var parseObjectForFile1 = new FastAParser(filePath1)) - { - parseObjectForFile1.Alphabet = alphabet; - ISequence originalSequence1 = parseObjectForFile1.Parse().FirstOrDefault(); - Assert.IsNotNull(originalSequence1); - aInput = new Sequence(alphabet, originalSequence1.ConvertToString()); - } - - using (var parseObjectForFile2 = new FastAParser(filePath2)) - { - parseObjectForFile2.Alphabet = alphabet; - ISequence originalSequence2 = parseObjectForFile2.Parse().FirstOrDefault(); - Assert.IsNotNull(originalSequence2); - bInput = new Sequence(alphabet, originalSequence2.ConvertToString()); - } - } - - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - SimilarityMatrix sm; - - switch (similarityMatrixParam) - { - case SimilarityMatrixParameters.TextReader: - using (TextReader reader = new StreamReader(blosumFilePath)) - sm = new SimilarityMatrix(reader); - break; - case SimilarityMatrixParameters.DiagonalMatrix: - string matchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MatchScoreNode); - string misMatchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MisMatchScoreNode); - sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), - int.Parse(misMatchValue, null)); - break; - default: - sm = new SimilarityMatrix(blosumFilePath); - break; - } - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null); - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode), - null); - - var smithWatermanObj = new SmithWatermanAligner(); - - if (AlignParameters.AllParam != alignParam) - { - smithWatermanObj.SimilarityMatrix = sm; - smithWatermanObj.GapOpenCost = gapOpenCost; - } - - IList result = null; - - switch (alignParam) - { - case AlignParameters.AlignList: - case AlignParameters.AlignListCode: - var sequences = new List {aInput, bInput}; - switch (alignType) - { - case AlignmentType.Align: - smithWatermanObj.GapExtensionCost = gapExtensionCost; - result = smithWatermanObj.Align(sequences); - break; - default: - result = smithWatermanObj.AlignSimple(sequences); - break; - } - break; - case AlignParameters.AllParam: - case AlignParameters.AllParamCode: - switch (alignType) - { - case AlignmentType.Align: - smithWatermanObj.GapExtensionCost = gapExtensionCost; - result = smithWatermanObj.Align(sm, gapOpenCost, gapExtensionCost, aInput, bInput); - break; - default: - result = smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - break; - } - break; - case AlignParameters.AlignTwo: - case AlignParameters.AlignTwoCode: - switch (alignType) - { - case AlignmentType.Align: - smithWatermanObj.GapExtensionCost = gapExtensionCost; - result = smithWatermanObj.Align(aInput, bInput); - break; - default: - result = smithWatermanObj.AlignSimple(aInput, bInput); - break; - } - break; - default: - break; - } - // Read the xml file for getting both the files for aligning. - string expectedSequence1, expectedSequence2, expectedScore; - - switch (alignType) - { - case AlignmentType.Align: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence1Node); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence2Node); - break; - default: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode1); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedSequenceNode2); - break; - } - - IList expectedOutput = new List(); - - IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); - var alignedSeq = new PairwiseAlignedSequence - { - FirstSequence = new Sequence(alphabet, expectedSequence1), - SecondSequence = new Sequence(alphabet, expectedSequence2), - Score = Convert.ToInt32(expectedScore, null), - FirstOffset = Int32.MinValue, - SecondOffset = Int32.MinValue, - }; - align.PairwiseAlignedSequences.Add(alignedSeq); - expectedOutput.Add(align); - - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P1 : Final Score '{0}'.", expectedScore)); - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P1 : Aligned First Sequence is '{0}'.", - expectedSequence1)); - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P1 : Aligned Second Sequence is '{0}'.", - expectedSequence2)); - - Assert.IsTrue(CompareAlignment(result, expectedOutput)); - } - - - /// - /// Validates Sequence Alignment test cases for the parameters passed. - /// - /// Node Name in the xml. - /// Is validation of properties required? - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private void ValidateGeneralSequenceAlignment(string nodeName, bool validateProperty) - { - // Read the xml file for getting both the files for aligning. - string origSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string origSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - - ApplicationLog.WriteLine(string.Format(null, "SequenceAlignment P1 : First sequence used is '{0}'.", - origSequence1)); - ApplicationLog.WriteLine(string.Format(null, "SequenceAlignment P1 : Second sequence used is '{0}'.", - origSequence2)); - - // Create two sequences - ISequence aInput = new Sequence(alphabet, origSequence1); - ISequence bInput = new Sequence(alphabet, origSequence2); - - // Add the sequences to the Sequence alignment object using AddSequence() method. - IList sequenceAlignmentObj = new List(); - - var alignSeq = new PairwiseAlignedSequence {FirstSequence = aInput, SecondSequence = bInput}; - IPairwiseSequenceAlignment seqAlignObj = new PairwiseSequenceAlignment(); - seqAlignObj.Add(alignSeq); - sequenceAlignmentObj.Add(seqAlignObj); - - // Read the output back and validate the same. - IList newAlignedSequences = - sequenceAlignmentObj[0].PairwiseAlignedSequences; - - ApplicationLog.WriteLine(string.Format(null, "SequenceAlignment P1 : First sequence read is '{0}'.", - origSequence1)); - ApplicationLog.WriteLine(string.Format(null, "SequenceAlignment P1 : Second sequence read is '{0}'.", - origSequence2)); - - if (validateProperty) - { - string score = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.MatchScoreNode); - string seqCount = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceCountNode); - - Assert.IsFalse(sequenceAlignmentObj.IsReadOnly); - Assert.AreEqual(sequenceAlignmentObj.Count.ToString((IFormatProvider) null), seqCount); - Assert.AreEqual( - sequenceAlignmentObj[0].PairwiseAlignedSequences[0].Score.ToString((IFormatProvider) null), score); - Assert.AreEqual(sequenceAlignmentObj.Count.ToString((IFormatProvider) null), seqCount); - - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the IsRead Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Count Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Sequences Property"); - } - else - { - Assert.AreEqual(new String(newAlignedSequences[0].FirstSequence.Select(a => (char) a).ToArray()), - origSequence1); - Assert.AreEqual(new String(newAlignedSequences[0].SecondSequence.Select(a => (char) a).ToArray()), - origSequence2); - } - } - - /// - /// Compare the alignment of mummer and defined alignment - /// - /// - /// expected output - /// Compare result of alignments - private static bool CompareAlignment(IList actualAlignment, - IList expectedAlignment) - { - return AlignmentHelpers.CompareAlignment(actualAlignment, expectedAlignment); - } - - /// - /// Validates Sequence Alignment Class General methods. - /// - /// Node Name in the xml. - /// Name of the SequenceAlignment method to be validated - /// Is sequence alignment Def Constructor - private void ValidateSequenceAlignmentGeneralMethods(string nodeName, SeqAlignmentMethods methodName, - bool isSeqAlignDefCtr) - { - // Read the xml file for getting both the files for aligning. - string origSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string origSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - string seqCount = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SeqCountNode); - string alignedSeqCountAfterAddSeq = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .AlignedSeqCountAfterAddAlignedSeqNode); - string arrayLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ArraySizeNode); - - var alignedSeqItems = new PairwiseAlignedSequence[int.Parse(arrayLength, null)]; - const int index = 0; - - // Create two sequences - ISequence aInput = new Sequence(alphabet, origSequence1); - ISequence bInput = new Sequence(alphabet, origSequence2); - - // Add the sequences to the Sequence alignment object using AddSequence() method. - IList sequenceAlignmentObj = new List(); - - var alignSeq = new PairwiseAlignedSequence {FirstSequence = aInput, SecondSequence = bInput}; - IPairwiseSequenceAlignment seqAlignObj = isSeqAlignDefCtr - ? new PairwiseSequenceAlignment() - : new PairwiseSequenceAlignment(aInput, bInput); - - seqAlignObj.Add(alignSeq); - sequenceAlignmentObj.Add(seqAlignObj); - - IList newAlignedSequences = - sequenceAlignmentObj[0].PairwiseAlignedSequences; - - switch (methodName) - { - case SeqAlignmentMethods.Add: - seqAlignObj.Add(alignSeq); - Assert.AreEqual(seqCount, - seqAlignObj.PairwiseAlignedSequences.Count.ToString((IFormatProvider) null)); - break; - case SeqAlignmentMethods.Clear: - seqAlignObj.Clear(); - Assert.AreEqual(0, seqAlignObj.PairwiseAlignedSequences.Count); - break; - case SeqAlignmentMethods.Contains: - Assert.IsTrue(seqAlignObj.Contains(newAlignedSequences[0])); - break; - case SeqAlignmentMethods.CopyTo: - seqAlignObj.CopyTo(alignedSeqItems, index); - - // Validate Copied array. - Assert.AreEqual(alignedSeqItems[index].FirstSequence, seqAlignObj.FirstSequence); - Assert.AreEqual(alignedSeqItems[index].SecondSequence, seqAlignObj.SecondSequence); - break; - case SeqAlignmentMethods.Remove: - seqAlignObj.Remove(newAlignedSequences[0]); - - // Validate whether removed item is deleted from SequenceAlignment. - Assert.AreEqual(0, newAlignedSequences.Count); - break; - case SeqAlignmentMethods.AddSequence: - seqAlignObj.AddSequence(newAlignedSequences[0]); - - // Validate SeqAlignObj after adding aligned sequence. - Assert.AreEqual(alignedSeqCountAfterAddSeq, seqAlignObj.Count.ToString((IFormatProvider) null)); - break; - case SeqAlignmentMethods.GetEnumerator: - IEnumerator alignedSeqList = seqAlignObj.GetEnumerator(); - - // Aligned Sequence list after iterating through ailgnedSeq collection. - Assert.IsNotNull(alignedSeqList); - break; - default: - break; - } - - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the IsRead Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Count Property"); - ApplicationLog.WriteLine("SequenceAlignment P1 : Successfully validated the Sequences Property"); - } - - #endregion Supporting Methods - } -} \ No newline at end of file diff --git a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/NeedlemanWunschP2TestCases.cs b/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/NeedlemanWunschP2TestCases.cs deleted file mode 100644 index d6d3fcf..0000000 --- a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/NeedlemanWunschP2TestCases.cs +++ /dev/null @@ -1,2211 +0,0 @@ -/**************************************************************************** - * NeedlemanWunschP2TestCases.cs - * - * This file contains the NeedlemanWunschAlignment P2 test cases - * -***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.IO; -using System.Linq; -using Bio.Algorithms.Alignment; -using Bio.Extensions; -using Bio.IO.FastA; -using Bio.SimilarityMatrices; -using Bio.TestAutomation.Util; -using Bio.Tests.Framework; -using Bio.Util.Logging; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Bio.TestAutomation.Algorithms.Alignment -{ - /// - /// NeedlemanWunschAlignment algorithm P2 test cases - /// - [TestClass] - public class NeedlemanWunschP2TestCases - { - #region Enums - - /// - /// Alignment Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignParameters - { - AlignList, - AllParam, - AlignTwo, - }; - - /// - /// Alignment Type Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignmentType - { - SimpleAlign, - Align, - }; - - /// - /// Types of invalid sequence - /// - private enum InvalidSequenceType - { - SequenceWithSpecialChars, - AlphabetMap, - EmptySequence, - SequenceWithInvalidChars, - InvalidSequence, - SequenceWithSpaces, - SequenceWithGap, - SequenceWithUnicodeChars, - Default - } - - /// - /// Input sequences to get aligned in different cases. - /// - private enum SequenceCaseType - { - LowerCase, - UpperCase, - LowerUpperCase, - Default - } - - /// - /// Types of invalid similarity matrix - /// - private enum SimilarityMatrixInvalidTypes - { - NonMatchingSimilarityMatrix, - EmptySimilaityMatrix, - OnlyAlphabetSimilarityMatrix, - FewAlphabetsSimilarityMatrix, - ModifiedSimilarityMatrix, - NullSimilarityMatrix, - EmptySequence, - ExpectedErrorMessage, - } - - /// - /// Similarity Matrix Parameters which are used for different test cases - /// based on which the test cases are executed with different Similarity Matrixes. - /// - private enum SimilarityMatrixParameters - { - TextReader, - DiagonalMatrix, - Default - }; - - #endregion Enums - - #region Global Variables - - private readonly Utility utilityObj = new Utility(@"TestUtils\TestsConfig.xml"); - - #endregion Global Variables - - #region Constructor - - /// - /// Static constructor to open log and make other settings needed for test - /// - static NeedlemanWunschP2TestCases() - { - Trace.Set(Trace.SeqWarnings); - if (!ApplicationLog.Ready) - { - ApplicationLog.Open("bio.automation.log"); - } - } - - #endregion - - #region Test Cases - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoLowerCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid 1000 BP Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignWith1000BP() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeNameFor1000BP, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoLowerUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoLowerCaseSequencesFromCode() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoUpperCaseSequencesFromCode() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignTwoLowerUpperCaseSequencesFromCode() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignListLowerCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignListUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignListLowerUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignAllParamsLowerCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SequenceCaseType.LowerCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignAllParamsUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SequenceCaseType.UpperCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void NeedlemanWunschSimpleAlignAllParamsLowerUpperCaseSequencesFromTextFile() - { - ValidateNeedlemanWunschAlignment(Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithNonMatchingSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithNonMatchingSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithNonMatchingSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithModifiedSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithModifiedSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithModifiedSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align(seq1,seq2) throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using list throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoWithInvalidSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListWithInvalidSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsWithInvalidSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoWithEmptySequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListWithEmptySequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsWithEmptySequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoWithGapSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListWithGapSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsWithGapSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoWithUnicodeSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListWithUnicodeSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignAllParamsWithUnicodeSequencesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignTwoSequencesWithSpacesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignListSequencesWithSpacesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidateNWSimpleAlignParamsSequencesWithSpacesFromTextFile() - { - InValidateNeedlemanWunschAlignmentWithInvalidSequence( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoDnaSequences() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschDnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoRnaSequences() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschRnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoProteinSequences() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschProAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesGapCostMin() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschGapCostMinAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesWithBlosomSimilarityMatrix() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschBlosumAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesWithPamSimilarityMatrix() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschPamAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesWithTextReaderSimilarityMatrix() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesWithDiagonalSimilarityMatrix() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschDiagonalSimMatAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateNeedlemanWunschAlignTwoSequencesWithEqualGapOpenAndExtensionCost() - { - ValidateNeedlemanWunschAlignment( - Constants.NeedlemanWunschEqualAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - #endregion - - #region Helper Methods - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - private void ValidateNeedlemanWunschAlignment(string nodeName, - bool isTextFile, SequenceCaseType caseType, - AlignParameters additionalParameter) - { - ValidateNeedlemanWunschAlignment(nodeName, isTextFile, - caseType, additionalParameter, AlignmentType.SimpleAlign); - } - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - private void ValidateNeedlemanWunschAlignment(string nodeName, - bool isTextFile, SequenceCaseType caseType, - AlignParameters additionalParameter, AlignmentType alignType) - { - ValidateNeedlemanWunschAlignment(nodeName, isTextFile, - caseType, additionalParameter, alignType, - SimilarityMatrixParameters.Default); - } - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// Similarity Matrix - [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling"), - SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void ValidateNeedlemanWunschAlignment(string nodeName, bool isTextFile, SequenceCaseType caseType, - AlignParameters additionalParameter, AlignmentType alignType, - SimilarityMatrixParameters similarityMatrixParam) - { - Sequence aInput, bInput; - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filePath1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1); - string filePath2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2); - - // Parse the files and get the sequence. - ISequence originalSequence1, originalSequence2; - - using (var parseObjectForFile1 = new FastAParser(filePath1)) - { - using (var parseObjectForFile2 = new FastAParser(filePath2)) - { - parseObjectForFile1.Alphabet = alphabet; - parseObjectForFile2.Alphabet = alphabet; - originalSequence1 = parseObjectForFile1.Parse().First(); - originalSequence2 = parseObjectForFile2.Parse().First(); - } - } - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(originalSequence1.ConvertToString(), - originalSequence2.ConvertToString(), alphabet, caseType, out aInput, out bInput); - } - else - { - string originalSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string originalSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType( - originalSequence1, - originalSequence2, - alphabet, - caseType, - out aInput, - out bInput); - } - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - - SimilarityMatrix sm; - switch (similarityMatrixParam) - { - case SimilarityMatrixParameters.TextReader: - using (TextReader reader = new StreamReader(blosumFilePath)) - sm = new SimilarityMatrix(reader); - break; - case SimilarityMatrixParameters.DiagonalMatrix: - string matchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MatchScoreNode); - string misMatchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MisMatchScoreNode); - sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), - int.Parse(misMatchValue, null)); - break; - default: - sm = new SimilarityMatrix(blosumFilePath); - break; - } - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null); - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode), - null); - - // Create NeedlemanWunschAligner instance and set its values. - var needlemanWunschObj = new NeedlemanWunschAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - needlemanWunschObj.SimilarityMatrix = sm; - needlemanWunschObj.GapOpenCost = gapOpenCost; - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - } - IList result = null; - - // Align the input sequences. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - result = needlemanWunschObj.Align(new List {aInput, bInput}); - break; - default: - result = needlemanWunschObj.AlignSimple(new List {aInput, bInput}); - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - result = needlemanWunschObj.Align(aInput, bInput); - break; - default: - result = needlemanWunschObj.AlignSimple(aInput, bInput); - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - result = needlemanWunschObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - break; - default: - result = needlemanWunschObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - break; - } - break; - default: - break; - } - - // Get the expected sequence and scorde from xml config. - string expectedSequence1, expectedSequence2, expectedScore; - - switch (alignType) - { - case AlignmentType.Align: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedGapExtensionScoreNode); - switch (caseType) - { - case SequenceCaseType.LowerCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence1InLower); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence2InLower); - break; - default: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence1Node); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence2Node); - break; - } - break; - default: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedScoreNode); - switch (caseType) - { - case SequenceCaseType.LowerCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence1inLowerNode); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence2inLowerNode); - break; - case SequenceCaseType.LowerUpperCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence1inLowerNode); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode2); - break; - default: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode1); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode2); - break; - } - break; - } - - IList expectedOutput = new List(); - - IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); - var alignedSeq = new PairwiseAlignedSequence - { - FirstSequence = new Sequence(alphabet, expectedSequence1), - SecondSequence = new Sequence(alphabet, expectedSequence2), - Score = Convert.ToInt32(expectedScore, null), - FirstOffset = Int32.MinValue, - SecondOffset = Int32.MinValue - }; - align.PairwiseAlignedSequences.Add(alignedSeq); - expectedOutput.Add(align); - - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P2 : Final Score '{0}'.", expectedScore)); - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P2 : Aligned First Sequence is '{0}'.", - expectedSequence1)); - ApplicationLog.WriteLine(string.Format(null, "NeedlemanWunschAligner P2 : Aligned Second Sequence is '{0}'.", - expectedSequence2)); - - Assert.IsTrue(CompareAlignment(result, expectedOutput)); - } - - /// - /// InValidates NeedlemanWunschAlignment with invalid sequence. - /// - /// - /// Is text file an input. - /// - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private void InValidateNeedlemanWunschAlignmentWithInvalidSequence( - string nodeName, bool isTextFile, InvalidSequenceType invalidSequenceType, - AlignParameters additionalParameter, AlignmentType alignType, - InvalidSequenceType sequenceType) - { - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - Exception actualException = null; - Sequence aInput = null; - Sequence bInput = null; - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filepath = GetInputFileNameWithInvalidType(nodeName, invalidSequenceType); - - // Create input sequence for sequence string in different cases. - try - { - // Parse the files and get the sequence. - IEnumerable seqs = null; - using (var parser = new FastAParser(filepath)) - { - parser.Alphabet = alphabet; - seqs = parser.Parse(); - aInput = new Sequence(alphabet, new string(seqs.ElementAt(0).Select(a => (char) a).ToArray())); - } - } - catch (FileFormatException ex) - { - actualException = ex; - } - } - else - { - string originalSequence = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequence1); - - // Create input sequence for sequence string in different cases. - try - { - aInput = new Sequence(alphabet, originalSequence); - } - catch (ArgumentException ex) - { - actualException = ex; - } - } - - if (null == actualException) - { - bInput = aInput; - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - - var sm = new SimilarityMatrix(blosumFilePath); - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create NeedlemanWunschAligner instance and set its values. - var needlemanWunschObj = new NeedlemanWunschAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - needlemanWunschObj.SimilarityMatrix = sm; - needlemanWunschObj.GapOpenCost = gapOpenCost; - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate Error messages for Invalid Sequence types. - string expectedErrorMessage = GetExpectedErrorMeesageWithInvalidSequenceType( - nodeName, sequenceType); - - Assert.AreEqual(expectedErrorMessage, actualException.Message); - - ApplicationLog.WriteLine(string.Concat( - "NeedlemanWunschAligner P2 : Expected Error message is thrown ", - expectedErrorMessage)); - } - - /// - /// Validates NeedlemanWunschAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Invalid type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void InValidateNeedlemanWunschAlignmentWithInvalidSimilarityMatrix( - string nodeName, bool isTextFile, SimilarityMatrixInvalidTypes invalidType, - AlignParameters additionalParameter, AlignmentType alignType) - { - Sequence aInput = null; - Sequence bInput = null; - - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string firstInputFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode1); - string secondInputFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode2); - - // Parse the files and get the sequence. - using (var parseObjectForFile1 = new FastAParser(firstInputFilePath)) - { - using (var parseObjectForFile2 = new FastAParser(secondInputFilePath)) - { - ISequence inputSequence1 = parseObjectForFile1.Parse().ElementAt(0); - ISequence inputSequence2 = parseObjectForFile2.Parse().ElementAt(0); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(new string(inputSequence1.Select(a => (char) a).ToArray()), - new string(inputSequence2.Select(a => (char) a).ToArray()), alphabet, - SequenceCaseType.LowerCase, out aInput, out bInput); - } - } - } - else - { - string firstInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string secondInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(firstInputSequence, secondInputSequence, alphabet, - SequenceCaseType.LowerCase, out aInput, out bInput); - } - - // Create similarity matrix object for a invalid file. - string blosumFilePath = GetSimilarityMatrixFileWithInvalidType(nodeName, invalidType); - Exception actualExpection = null; - - // For invalid similarity matrix data format; exception will be thrown while instantiating - SimilarityMatrix sm = null; - try - { - if (invalidType != SimilarityMatrixInvalidTypes.NullSimilarityMatrix) - { - sm = new SimilarityMatrix(blosumFilePath); - } - } - catch (InvalidDataException ex) - { - actualExpection = ex; - } - - // For non matching similarity matrix exception will be thrown while alignment - if (actualExpection == null) - { - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), - null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create NeedlemanWunschAligner instance and set its values. - var needlemanWunschObj = new NeedlemanWunschAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - needlemanWunschObj.SimilarityMatrix = sm; - needlemanWunschObj.GapOpenCost = gapOpenCost; - needlemanWunschObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - needlemanWunschObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - needlemanWunschObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate that expected exception is thrown using error message. - string expectedErrorMessage = - GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(nodeName, invalidType); - Assert.AreEqual(expectedErrorMessage, actualExpection.Message); - - ApplicationLog.WriteLine(string.Concat( - "NeedlemanWunschAligner P2 : Expected Error message is thrown ", - expectedErrorMessage)); - } - - /// - /// Gets the expected error message for invalid similarity matrix type. - /// - /// xml node - /// similarity matrix invalid type. - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string expectedErrorMessage = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptyMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SimilarityMatrixFewerLinesException); - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ModifiedMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.NullSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.NullErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySequence: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case SimilarityMatrixInvalidTypes.ExpectedErrorMessage: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - default: - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the expected error message for invalid sequence type. - /// - /// xml node - /// - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSequenceType(string nodeName, - InvalidSequenceType sequenceType) - { - string expectedErrorMessage = string.Empty; - switch (sequenceType) - { - case InvalidSequenceType.SequenceWithInvalidChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case InvalidSequenceType.InvalidSequence: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.UnicodeSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithSpaces: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SequenceWithSpaceErrorMessage); - break; - case InvalidSequenceType.AlphabetMap: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidAlphabetErrorMessage); - break; - default: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the similarity matrix file name for a given invalid similarity matrix type. - /// - /// xml node. - /// similarity matrix invalid type. - /// Returns similarity matrix file name. - private string GetSimilarityMatrixFileWithInvalidType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string invalidFileNode = string.Empty; - string invalidFilePath = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - invalidFileNode = Constants.BlosumInvalidFilePathNode; - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - invalidFileNode = Constants.BlosumEmptyFilePathNode; - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - invalidFileNode = Constants.BlosumOnlyAlphabetFilePathNode; - break; - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - invalidFileNode = Constants.BlosumFewAlphabetsFilePathNode; - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - invalidFileNode = Constants.BlosumModifiedFilePathNode; - break; - default: - break; - } - if (1 == string.Compare(invalidFileNode, string.Empty, StringComparison.CurrentCulture)) - { - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, invalidFileNode); - } - return invalidFilePath; - } - - /// - /// Gets the input file name for a given invalid sequence type. - /// - /// xml node. - /// sequence invalid type. - /// Returns input file name. - private string GetInputFileNameWithInvalidType(string nodeName, - InvalidSequenceType invalidSequenceType) - { - string invalidFilePath = string.Empty; - switch (invalidSequenceType) - { - case InvalidSequenceType.SequenceWithSpecialChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.InvalidFilePathNode1); - break; - case InvalidSequenceType.EmptySequence: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.EmptyFilePath1); - break; - case InvalidSequenceType.SequenceWithSpaces: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SpacesFilePath1); - break; - case InvalidSequenceType.SequenceWithGap: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapFilePath1); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.UnicodeFilePath1); - break; - case InvalidSequenceType.SequenceWithInvalidChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - default: - break; - } - - return invalidFilePath; - } - - /// - /// Creates the sequence object with sequences in different cases - /// - /// First sequence string. - /// Second sequence string. - /// alphabet type. - /// Sequence case type - /// First input sequence object. - /// Second input sequence object. - private static void GetSequenceWithCaseType(string firstSequenceString, - string secondSequenceString, IAlphabet alphabet, - SequenceCaseType caseType, - out Sequence firstInputSequence, out Sequence secondInputSequence) - { - switch (caseType) - { - case SequenceCaseType.LowerCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.UpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.LowerUpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.Default: - default: - firstInputSequence = new Sequence(alphabet, firstSequenceString.ToString(null)); - secondInputSequence = new Sequence(alphabet, secondSequenceString.ToString(null)); - break; - } - } - - /// - /// Compare the alignment of mummer and defined alignment - /// - /// - /// expected output - /// Compare result of alignments - private static bool CompareAlignment(IList actualAlignment, - IList expectedAlignment) - { - return AlignmentHelpers.CompareAlignment(actualAlignment, expectedAlignment); - } - - #endregion - } -} \ No newline at end of file diff --git a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/PairwiseOverlapAlignerP2TestCases.cs b/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/PairwiseOverlapAlignerP2TestCases.cs deleted file mode 100644 index 3476f5f..0000000 --- a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/PairwiseOverlapAlignerP2TestCases.cs +++ /dev/null @@ -1,2219 +0,0 @@ -/**************************************************************************** - * PairwiseOverlapAlignerP2TestCases.cs - * - * This file contains the PairwiseOverlapAlignment P2 test cases - * -***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using Bio.Algorithms.Alignment; -using Bio.IO.FastA; -using Bio.SimilarityMatrices; -using Bio.TestAutomation.Util; -using Bio.Tests.Framework; -using Bio.Util.Logging; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Bio.TestAutomation.Algorithms.Alignment -{ - /// - /// PairwiseOverlapAlignment algorithm P2 test cases - /// - [TestClass] - public class PairwiseOverlapAlignerP2TestCases - { - #region Enums - - /// - /// Alignment Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignParameters - { - AlignList, - AllParam, - AlignTwo, - }; - - /// - /// Alignment Type Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignmentType - { - SimpleAlign, - Align, - }; - - /// - /// Types of invalid sequence - /// - private enum InvalidSequenceType - { - SequenceWithSpecialChars, - AlphabetMap, - EmptySequence, - SequenceWithInvalidChars, - InvalidSequence, - SequenceWithSpaces, - SequenceWithGap, - SequenceWithUnicodeChars, - Default - } - - /// - /// Input sequences to get aligned in different cases. - /// - private enum SequenceCaseType - { - LowerCase, - UpperCase, - LowerUpperCase, - Default - } - - /// - /// Types of invalid similarity matrix - /// - private enum SimilarityMatrixInvalidTypes - { - NonMatchingSimilarityMatrix, - EmptySimilaityMatrix, - OnlyAlphabetSimilarityMatrix, - FewAlphabetsSimilarityMatrix, - ModifiedSimilarityMatrix, - NullSimilarityMatrix, - EmptySequence, - ExpectedErrorMessage, - } - - /// - /// Similarity Matrix Parameters which are used for different test cases - /// based on which the test cases are executed with different Similarity Matrixes. - /// - private enum SimilarityMatrixParameters - { - TextReader, - DiagonalMatrix, - Default - }; - - #endregion Enums - - #region Global Variables - - private readonly Utility utilityObj = new Utility(@"TestUtils\TestsConfig.xml"); - - #endregion Global Variables - - #region Constructor - - /// - /// Static constructor to open log and make other settings needed for test - /// - static PairwiseOverlapAlignerP2TestCases() - { - Trace.Set(Trace.SeqWarnings); - if (!ApplicationLog.Ready) - { - ApplicationLog.Open("bio.automation.log"); - } - } - - #endregion - - #region Test Cases - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoLowerCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoLowerUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoLowerCaseSequencesFromCode() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoUpperCaseSequencesFromCode() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignTwoLowerUpperCaseSequencesFromCode() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignListLowerCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignListUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignListLowerUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment(Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignAllParamsLowerCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment(Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SequenceCaseType.LowerCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignAllParamsUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment(Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SequenceCaseType.UpperCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void PairwiseOverlapSimpleAlignAllParamsLowerUpperCaseSequencesFromTextFile() - { - ValidatePairwiseOverlapAlignment(Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithNonMatchingSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithNonMatchingSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithNonMatchingSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithModifiedSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithModifiedSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithModifiedSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithFewAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithFewAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithFewAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align(seq1,seq2) throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using list throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithNullSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithNullSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithNullSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix( - Constants.PairwiseOverlapDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithInvalidSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithInvalidSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithInvalidSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithEmptySequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithEmptySequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithEmptySequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithGapSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithGapSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithGapSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithUnicodeSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithUnicodeSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithUnicodeSequencesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithSpacesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithSpacesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignParamsSequencesWithSpacesFromTextFile() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence with valid GapPenalty, Similarity Matrix - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithInvalidSequencesFromCode() - { - InValidatePairwiseOverlapAlignmentWithInvalidSequence( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - false, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.AlphabetMap); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoDnaSequences() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapDnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoRnaSequences() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapRnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoProteinSequences() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapProAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesGapCostMax() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapGapCostMaxAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesGapCostMin() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapGapCostMinAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesWithBlosomSimilarityMatrix() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapBlosumAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesWithPamSimilarityMatrix() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapPamAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesWithTextReaderSimilarityMatrix() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesWithDiagonalSimilarityMatrix() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapDiagonalSimMatAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidatePairwiseOverlapAlignTwoSequencesWithEqualGapOpenAndExtensionCost() - { - ValidatePairwiseOverlapAlignment( - Constants.PairwiseOverlapEqualAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - #endregion - - #region Helper Methods - - /// - /// Validates PairwiseOverlapAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - private void ValidatePairwiseOverlapAlignment(string nodeName, - bool isTextFile, SequenceCaseType caseType, - AlignParameters additionalParameter) - { - ValidatePairwiseOverlapAlignment(nodeName, isTextFile, - caseType, additionalParameter, AlignmentType.SimpleAlign); - } - - /// - /// Validates PairwiseOverlapAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - private void ValidatePairwiseOverlapAlignment(string nodeName, bool isTextFile, - SequenceCaseType caseType, AlignParameters additionalParameter, - AlignmentType alignType) - { - ValidatePairwiseOverlapAlignment(nodeName, isTextFile, - caseType, additionalParameter, alignType, - SimilarityMatrixParameters.Default); - } - - /// - /// Validates PairwiseOverlapAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// Similarity Matrix - private void ValidatePairwiseOverlapAlignment(string nodeName, bool isTextFile, - SequenceCaseType caseType, AlignParameters additionalParameter, - AlignmentType alignType, - SimilarityMatrixParameters similarityMatrixParam) - { - Sequence aInput = null; - Sequence bInput = null; - - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filePath1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode1); - string filePath2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode2); - - using (var parser1 = new FastAParser(filePath1)) - { - using (var parser2 = new FastAParser(filePath2)) - { - ISequence originalSequence1 = parser1.Parse().ElementAt(0); - ISequence originalSequence2 = parser2.Parse().ElementAt(0); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(new string(originalSequence1.Select(a => (char) a).ToArray()), - new string(originalSequence2.Select(a => (char) a).ToArray()), alphabet, - caseType, out aInput, out bInput); - } - } - } - else - { - string originalSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string originalSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType( - originalSequence1, - originalSequence2, - alphabet, - caseType, - out aInput, - out bInput); - } - - var aInputString = new string(aInput.Select(a => (char) a).ToArray()); - var bInputString = new string(bInput.Select(a => (char) a).ToArray()); - - ApplicationLog.WriteLine(string.Format(null, - "PairwiseOverlapAligner P2 : First sequence used is '{0}'.", - aInputString)); - ApplicationLog.WriteLine(string.Format(null, - "PairwiseOverlapAligner P2 : Second sequence used is '{0}'.", - bInputString)); - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - - SimilarityMatrix sm = null; - - switch (similarityMatrixParam) - { - case SimilarityMatrixParameters.TextReader: - using (TextReader reader = new StreamReader(blosumFilePath)) - sm = new SimilarityMatrix(reader); - break; - case SimilarityMatrixParameters.DiagonalMatrix: - string matchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MatchScoreNode); - string misMatchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MisMatchScoreNode); - sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), - int.Parse(misMatchValue, null)); - break; - default: - sm = new SimilarityMatrix(blosumFilePath); - break; - } - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create PairwiseOverlapAligner instance and set its values. - var pairwiseOverlapObj = new PairwiseOverlapAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - pairwiseOverlapObj.SimilarityMatrix = sm; - pairwiseOverlapObj.GapOpenCost = gapOpenCost; - pairwiseOverlapObj.GapExtensionCost = gapExtensionCost; - } - IList result = null; - - // Align the input sequences. - switch (additionalParameter) - { - case AlignParameters.AlignList: - var sequences = new List(); - sequences.Add(aInput); - sequences.Add(bInput); - switch (alignType) - { - case AlignmentType.Align: - result = pairwiseOverlapObj.Align(sequences); - break; - default: - result = pairwiseOverlapObj.AlignSimple(sequences); - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - result = pairwiseOverlapObj.Align(aInput, bInput); - break; - default: - result = pairwiseOverlapObj.AlignSimple(aInput, bInput); - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - result = pairwiseOverlapObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - break; - default: - result = pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - break; - } - break; - default: - break; - } - - aInput = null; - bInput = null; - sm = null; - - // Get the expected sequence and scorde from xml config. - string expectedSequence1 = string.Empty; - string expectedSequence2 = string.Empty; - string expectedScore = string.Empty; - - switch (alignType) - { - case AlignmentType.Align: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence1Node); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionSequence2Node); - break; - default: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedScoreNode); - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode1); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode2); - break; - } - - IList expectedOutput = new List(); - string[] expectedSequences1, expectedSequences2; - var seperators = new char[1] {';'}; - expectedSequences1 = expectedSequence1.Split(seperators); - expectedSequences2 = expectedSequence2.Split(seperators); - - IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); - PairwiseAlignedSequence alignedSeq; - for (int i = 0; i < expectedSequences1.Length; i++) - { - alignedSeq = new PairwiseAlignedSequence - { - FirstSequence = new Sequence(alphabet, expectedSequences1[i]), - SecondSequence = new Sequence(alphabet, expectedSequences2[i]), - Score = Convert.ToInt32(expectedScore, null), - FirstOffset = Int32.MinValue, - SecondOffset = Int32.MinValue, - }; - align.PairwiseAlignedSequences.Add(alignedSeq); - } - - expectedOutput.Add(align); - Assert.IsTrue(AlignmentHelpers.CompareAlignment(result, expectedOutput,true)); - - ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Final Score '{0}'.", expectedScore)); - ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Aligned First Sequence is '{0}'.", expectedSequence1)); - ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Aligned Second Sequence is '{0}'.", expectedSequence2)); - } - - /// - /// InValidates PairwiseOverlapAlignment with invalid sequence. - /// - /// - /// Is text file an input. - /// - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// - private void InValidatePairwiseOverlapAlignmentWithInvalidSequence(string nodeName, - bool isTextFile, - InvalidSequenceType invalidSequenceType, - AlignParameters additionalParameter, - AlignmentType alignType, - InvalidSequenceType sequenceType) - { - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - Exception actualException = null; - Sequence aInput = null; - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filepath = GetInputFileNameWithInvalidType(nodeName, invalidSequenceType); - - // Create input sequence for sequence string in different cases. - try - { - // Parse the files and get the sequence. - using (var parser = new FastAParser(filepath)) - { - aInput = new Sequence(alphabet, new string(parser.Parse().ElementAt(0). - Select(a => (char) a).ToArray())); - } - } - catch (FileFormatException ex) - { - actualException = ex; - } - } - else - { - string originalSequence = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequence1); - - // Create input sequence for sequence string in different cases. - try - { - aInput = new Sequence(alphabet, originalSequence); - } - catch (ArgumentException ex) - { - actualException = ex; - } - } - - if (null == actualException) - { - Sequence bInput = aInput; - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.BlosumFilePathNode); - - var sm = new SimilarityMatrix(blosumFilePath); - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create PairwiseOverlapAligner instance and set its values. - var pairwiseOverlapObj = new PairwiseOverlapAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - pairwiseOverlapObj.SimilarityMatrix = sm; - pairwiseOverlapObj.GapOpenCost = gapOpenCost; - pairwiseOverlapObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - var sequences = new List {aInput, bInput}; - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(sequences); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(sequences); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, - aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate Error messages for Invalid Sequence types. - string expectedErrorMessage = GetExpectedErrorMeesageWithInvalidSequenceType(nodeName, - sequenceType); - - Assert.AreEqual(expectedErrorMessage.Replace("\\r", "").Replace("\\n", "").Replace("\t", ""), - actualException.Message.Replace("\r", "").Replace("\n", "").Replace("\t", "")); - - ApplicationLog.WriteLine("PairwiseOverlapAligner P2 : Expected Error message is thrown ", expectedErrorMessage); - } - - /// - /// Validates PairwiseOverlapAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Invalid type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - private void InValidatePairwiseOverlapAlignmentWithInvalidSimilarityMatrix(string nodeName, - bool isTextFile, - SimilarityMatrixInvalidTypes - invalidType, - AlignParameters additionalParameter, - AlignmentType alignType) - { - Sequence aInput = null; - Sequence bInput = null; - - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string firstInputFilepath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode1); - string secondInputFilepath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode2); - - // Parse the files and get the sequence. - using (var parser1 = new FastAParser(firstInputFilepath)) - { - using (var parser2 = new FastAParser(secondInputFilepath)) - { - ISequence inputSequence1 = parser1.Parse().ElementAt(0); - ISequence inputSequence2 = parser2.Parse().ElementAt(0); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(new string(inputSequence1.Select(a => (char) a).ToArray()), - new string(inputSequence2.Select(a => (char) a).ToArray()), alphabet, - SequenceCaseType.LowerCase, out aInput, out bInput); - } - } - } - else - { - string firstInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string secondInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(firstInputSequence, secondInputSequence, - alphabet, SequenceCaseType.LowerCase, out aInput, out bInput); - } - - var aInputString = new string(aInput.Select(a => (char) a).ToArray()); - var bInputString = new string(bInput.Select(a => (char) a).ToArray()); - - ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : First sequence used is '{0}'.", aInputString)); - ApplicationLog.WriteLine(string.Format(null, "PairwiseOverlapAligner P2 : Second sequence used is '{0}'.", bInputString)); - - // Create similarity matrix object for a invalid file. - string blosumFilePath = GetSimilarityMatrixFileWithInvalidType(nodeName, invalidType); - Exception actualExpection = null; - - // For invalid similarity matrix data format; exception will be thrown while instantiating - SimilarityMatrix sm = null; - try - { - if (invalidType != SimilarityMatrixInvalidTypes.NullSimilarityMatrix) - { - sm = new SimilarityMatrix(blosumFilePath); - } - } - catch (InvalidDataException ex) - { - actualExpection = ex; - } - - // For non matching similarity matrix exception will be thrown while alignment - if (actualExpection == null) - { - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create PairwiseOverlapAligner instance and set its values. - var pairwiseOverlapObj = new PairwiseOverlapAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - pairwiseOverlapObj.SimilarityMatrix = sm; - pairwiseOverlapObj.GapOpenCost = gapOpenCost; - pairwiseOverlapObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - var sequences = new List(); - sequences.Add(aInput); - sequences.Add(bInput); - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(sequences); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(sequences); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - pairwiseOverlapObj.Align(sm, gapOpenCost, gapExtensionCost, - aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - pairwiseOverlapObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate that expected exception is thrown using error message. - string expectedErrorMessage = GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(nodeName, invalidType); - Assert.AreEqual(expectedErrorMessage, actualExpection.Message); - ApplicationLog.WriteLine("PairwiseOverlapAligner P2 : Expected Error message is thrown ", expectedErrorMessage); - } - - /// - /// Gets the expected error message for invalid similarity matrix type. - /// - /// xml node - /// similarity matrix invalid type. - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string expectedErrorMessage = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptyMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SimilarityMatrixFewerLinesException); - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ModifiedMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.NullSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.NullErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySequence: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case SimilarityMatrixInvalidTypes.ExpectedErrorMessage: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - default: - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the expected error message for invalid sequence type. - /// - /// xml node - /// invalid sequence type. - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSequenceType(string nodeName, - InvalidSequenceType sequenceType) - { - string expectedErrorMessage = string.Empty; - switch (sequenceType) - { - case InvalidSequenceType.SequenceWithInvalidChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case InvalidSequenceType.InvalidSequence: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.UnicodeSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithSpaces: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SequenceWithSpaceErrorMessage); - break; - case InvalidSequenceType.AlphabetMap: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidAlphabetErrorMessage); - break; - default: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the similarity matrix file name for a given invalid similarity matrix type. - /// - /// xml node. - /// similarity matrix invalid type. - /// Returns similarity matrix file name. - private string GetSimilarityMatrixFileWithInvalidType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string invalidFileNode = string.Empty; - string invalidFilePath = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - invalidFileNode = Constants.BlosumInvalidFilePathNode; - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - invalidFileNode = Constants.BlosumEmptyFilePathNode; - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - invalidFileNode = Constants.BlosumOnlyAlphabetFilePathNode; - break; - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - invalidFileNode = Constants.BlosumFewAlphabetsFilePathNode; - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - invalidFileNode = Constants.BlosumModifiedFilePathNode; - break; - default: - break; - } - if (1 == string.Compare(invalidFileNode, string.Empty, StringComparison.CurrentCulture)) - { - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, invalidFileNode); - } - return invalidFilePath; - } - - /// - /// Gets the input file name for a given invalid sequence type. - /// - /// xml node. - /// sequence invalid type. - /// Returns input file name. - private string GetInputFileNameWithInvalidType(string nodeName, - InvalidSequenceType invalidSequenceType) - { - string invalidFilePath = string.Empty; - switch (invalidSequenceType) - { - case InvalidSequenceType.SequenceWithSpecialChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidFilePathNode1); - break; - case InvalidSequenceType.EmptySequence: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.EmptyFilePath1); - break; - case InvalidSequenceType.SequenceWithSpaces: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SpacesFilePath1); - break; - case InvalidSequenceType.SequenceWithGap: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapFilePath1); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.UnicodeFilePath1); - break; - default: - break; - } - - return invalidFilePath; - } - - /// - /// Creates the sequence object with sequences in different cases - /// - /// First sequence string. - /// Second sequence string. - /// alphabet type. - /// Sequence case type - /// First input sequence object. - /// Second input sequence object. - private static void GetSequenceWithCaseType(string firstSequenceString, - string secondSequenceString, IAlphabet alphabet, - SequenceCaseType caseType, - out Sequence firstInputSequence, out Sequence secondInputSequence) - { - switch (caseType) - { - case SequenceCaseType.LowerCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.UpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.LowerUpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.Default: - default: - firstInputSequence = new Sequence(alphabet, firstSequenceString.ToString(null)); - secondInputSequence = new Sequence(alphabet, secondSequenceString.ToString(null)); - break; - } - } - - #endregion - } -} \ No newline at end of file diff --git a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/SmithWatermanP2TestCases.cs b/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/SmithWatermanP2TestCases.cs deleted file mode 100644 index d3a520c..0000000 --- a/bio/Tests/Bio.TestAutomation/Algorithms/Alignment/SmithWatermanP2TestCases.cs +++ /dev/null @@ -1,2259 +0,0 @@ -/**************************************************************************** - * SmithWatermanP2TestCases.cs - * - * This file contains the Smith Waterman Alignment P2 test cases - * -***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.IO; -using System.Linq; -using Bio.Algorithms.Alignment; -using Bio.Extensions; -using Bio.IO.FastA; -using Bio.SimilarityMatrices; -using Bio.TestAutomation.Util; -using Bio.Tests.Framework; -using Bio.Util.Logging; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace Bio.TestAutomation.Algorithms.Alignment -{ - /// - /// Smith Waterman Alignment algorithm P2 test cases - /// - [TestClass] - public class SmithWatermanP2TestCases - { - #region Enums - - /// - /// Alignment Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignParameters - { - AlignList, - AllParam, - AlignTwo, - }; - - /// - /// Alignment Type Parameters which are used for different test cases - /// based on which the test cases are executed. - /// - private enum AlignmentType - { - SimpleAlign, - Align, - }; - - /// - /// Types of invalid sequence - /// - private enum InvalidSequenceType - { - SequenceWithSpecialChars, - AlphabetMap, - EmptySequence, - SequenceWithInvalidChars, - InvalidSequence, - SequenceWithSpaces, - SequenceWithGap, - SequenceWithUnicodeChars, - Default - } - - /// - /// Input sequences to get aligned in different cases. - /// - private enum SequenceCaseType - { - LowerCase, - UpperCase, - LowerUpperCase, - Default - } - - /// - /// Types of invalid similarity matrix - /// - private enum SimilarityMatrixInvalidTypes - { - NonMatchingSimilarityMatrix, - EmptySimilaityMatrix, - OnlyAlphabetSimilarityMatrix, - FewAlphabetsSimilarityMatrix, - ModifiedSimilarityMatrix, - NullSimilarityMatrix, - EmptySequence, - ExpectedErrorMessage, - } - - /// - /// Similarity Matrix Parameters which are used for different test cases - /// based on which the test cases are executed with different Similarity Matrixes. - /// - private enum SimilarityMatrixParameters - { - TextReader, - DiagonalMatrix, - Default - }; - - #endregion Enums - - #region Global Variables - - private readonly Utility utilityObj = new Utility(@"TestUtils\TestsConfig.xml"); - - #endregion Global Variables - - #region Constructor - - /// - /// Static constructor to open log and make other settings needed for test - /// - static SmithWatermanP2TestCases() - { - Trace.Set(Trace.SeqWarnings); - if (!ApplicationLog.Ready) - { - ApplicationLog.Open("bio.automation.log"); - } - } - - #endregion - - #region Test Cases - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoLowerCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanGotohAlignSequenceWithMultiplePossibleIndelPositions() - { - var longRef = "TGACCCCGAGGGGGCCCGGGGCCGCGTCCCTGGGCCCTCCCCA"; - var longHapOrg = "TGACCCCGAGGG---CCGGG--------------CCCTCCCCA"; - var longHap = longHapOrg.Replace("-", ""); - var lr = new Sequence(DnaAlphabet.Instance, longRef); - var lh = new Sequence(DnaAlphabet.Instance, longHap); - - var al = new Bio.Algorithms.Alignment.SmithWatermanAligner(); - al.SimilarityMatrix = new Bio.SimilarityMatrices.DiagonalSimilarityMatrix(20, -15); - al.GapOpenCost = -26; - al.GapExtensionCost = -1; - - var res = al.Align(lr, lh); - var results = res.First(); - var alignedSeq = results.AlignedSequences[0].Sequences[1].ToString(); - Assert.AreEqual(alignedSeq, longHapOrg); - } - - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid 1000 BP Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : 1000 BP FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignWith1000BP() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeNameFor1000BP, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoLowerUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoLowerCaseSequencesFromCode() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoUpperCaseSequencesFromCode() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SequenceCaseType.UpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from code using the method Align(sequence1, sequence2) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignTwoLowerUpperCaseSequencesFromCode() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignTwo); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignListLowerCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignListUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.UpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignListLowerUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, - AlignParameters.AlignList); - } - - /// - /// Pass a Valid Sequence(Lower case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignAllParamsLowerCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanAlignAlgorithmNodeName, true, - SequenceCaseType.LowerCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignAllParamsUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanAlignAlgorithmNodeName, true, - SequenceCaseType.UpperCase, - AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence(Lower and Upper case) with valid GapPenalty, Similarity Matrix - /// from text file using the method AlignList - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void SmithWatermanSimpleAlignAllParamsLowerUpperCaseSequencesFromTextFile() - { - ValidateSmithWatermanAlignment(Constants.SmithWatermanAlignAlgorithmNodeName, true, - SequenceCaseType.LowerUpperCase, AlignParameters.AllParam); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithNonMatchingSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithNonMatchingSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Non Matching) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Non Matching similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithNonMatchingSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithModifiedSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithModifiedSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Modified) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Modified similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithModifiedSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using list throws expected exception - /// Input : Input sequence list and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Few Alphabet) - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithFewAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align(se1,seq2) throws expected exception - /// Input : Two Input sequence and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from text file and validate if Align using List throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Empty) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Empty similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithEmptySimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.EmptySimilaityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align(seq1,seq2) throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using list throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Only Alphabet) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithOnlyAlphabetSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix (Null) - /// from code and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesFromCodeWithNullSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanAlignAlgorithmNodeName, - false, - SimilarityMatrixInvalidTypes.NullSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Few Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AlignList, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Invalid DiagonalSimilarityMatrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence and Invalid DiagonalSimilarityMatrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsSequencesWithInvalidDiagonalSimilarityMatrix() - { - InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix( - Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - true, - SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix, - AlignParameters.AllParam, - AlignmentType.SimpleAlign); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithInvalidSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithInvalidSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass a In Valid Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithInvalidSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpecialChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.InvalidSequence); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithEmptySequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithEmptySequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass Empty Sequence with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithEmptySequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.EmptySequence, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithInvalidChars); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Parser throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithGapSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithGapSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Contains Gap) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithGapSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithGap, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.Default); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoWithUnicodeSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListWithUnicodeSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Unicode) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignAllParamsWithUnicodeSequencesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithUnicodeChars, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithUnicodeChars); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignTwoSequencesWithSpacesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignTwo, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignListSequencesWithSpacesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AlignList, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - /// - /// Pass invalid Sequence(Spaces) with valid GapPenalty, Similarity Matrix - /// from text file and validate if Align using all params throws expected exception - /// Input : Input sequence List and Only Alphabet similarity matrix - /// Validation : Exception should be thrown - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void InValidatePOSimpleAlignParamsSequencesWithSpacesFromTextFile() - { - InValidateSmithWatermanAlignmentWithInvalidSequence( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - InvalidSequenceType.SequenceWithSpaces, - AlignParameters.AllParam, - AlignmentType.SimpleAlign, - InvalidSequenceType.SequenceWithSpaces); - } - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoDnaSequences() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanDnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoRnaSequences() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanRnaAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA DNA File - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoProteinSequences() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanProAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesGapCostMin() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanGapCostMinAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesWithBlosomSimilarityMatrix() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanBlosumAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesWithPamSimilarityMatrix() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanPamAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesWithTextReaderSimilarityMatrix() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanAlignAlgorithmNodeName, - true, - SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.TextReader); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesWithDiagonalSimilarityMatrix() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanDiagonalSimMatAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align, - SimilarityMatrixParameters.DiagonalMatrix); - } - - /// - /// Pass a Valid Sequence with valid GapPenalty, Similarity Matrix - /// which is in a text file using the method Align(two sequences) - /// and validate if the aligned sequence is as expected and - /// also validate the score for the same - /// Input : FastA Protein File with Max Gap Cost - /// Validation : Aligned sequence and score. - /// - [TestMethod] - [Priority(2)] - [TestCategory("Priority2")] - public void ValidateSmithWatermanAlignTwoSequencesWithEqualGapOpenAndExtensionCost() - { - ValidateSmithWatermanAlignment( - Constants.SmithWatermanEqualAlignAlgorithmNodeName, - true, SequenceCaseType.LowerCase, - AlignParameters.AlignTwo, - AlignmentType.Align); - } - - #endregion - - #region Helper Methods - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - private void ValidateSmithWatermanAlignment(string nodeName, - bool isTextFile, SequenceCaseType caseType, - AlignParameters additionalParameter) - { - ValidateSmithWatermanAlignment(nodeName, isTextFile, caseType, additionalParameter, - AlignmentType.SimpleAlign); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - private void ValidateSmithWatermanAlignment(string nodeName, bool isTextFile, - SequenceCaseType caseType, AlignParameters additionalParameter, - AlignmentType alignType) - { - ValidateSmithWatermanAlignment(nodeName, isTextFile, caseType, additionalParameter, - alignType, SimilarityMatrixParameters.Default); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Case Type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// Similarity Matrix - [SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling"), - SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void ValidateSmithWatermanAlignment(string nodeName, bool isTextFile, - SequenceCaseType caseType, AlignParameters additionalParameter, - AlignmentType alignType, - SimilarityMatrixParameters similarityMatrixParam) - { - Sequence aInput, bInput; - IAlphabet alphabet = - Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filePath1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode1); - string filePath2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode2); - - // Parse the files and get the sequence. - ISequence originalSequence1 = null; - ISequence originalSequence2 = null; - - using (var parseObjectForFile1 = new FastAParser(filePath1)) - { - using (var parseObjectForFile2 = new FastAParser(filePath2)) - { - parseObjectForFile1.Alphabet = alphabet; - parseObjectForFile2.Alphabet = alphabet; - originalSequence1 = parseObjectForFile1.Parse().ElementAt(0); - originalSequence2 = parseObjectForFile2.Parse().ElementAt(0); - } - } - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(originalSequence1.ConvertToString(), originalSequence2.ConvertToString(), - alphabet, caseType, out aInput, out bInput); - } - else - { - string originalSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string originalSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType( - originalSequence1, - originalSequence2, - alphabet, - caseType, - out aInput, - out bInput); - } - - ApplicationLog.WriteLine(string.Format("SmithWatermanAligner P2 : First sequence used is '{0}'.", - aInput.ConvertToString())); - ApplicationLog.WriteLine(string.Format("SmithWatermanAligner P2 : Second sequence used is '{0}'.", - bInput.ConvertToString())); - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.BlosumFilePathNode); - SimilarityMatrix sm; - switch (similarityMatrixParam) - { - case SimilarityMatrixParameters.TextReader: - using (TextReader reader = new StreamReader(blosumFilePath)) - sm = new SimilarityMatrix(reader); - break; - case SimilarityMatrixParameters.DiagonalMatrix: - string matchValue = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.MatchScoreNode); - string misMatchValue = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.MisMatchScoreNode); - sm = new DiagonalSimilarityMatrix(int.Parse(matchValue, null), - int.Parse(misMatchValue, null)); - break; - default: - sm = new SimilarityMatrix(blosumFilePath); - break; - } - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapOpenCostNode), null); - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapExtensionCostNode), - null); - - // Create SmithWatermanAligner instance and set its values. - var smithWatermanObj = new SmithWatermanAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - smithWatermanObj.SimilarityMatrix = sm; - smithWatermanObj.GapOpenCost = gapOpenCost; - smithWatermanObj.GapExtensionCost = gapExtensionCost; - } - IList result = null; - - // Align the input sequences. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - result = smithWatermanObj.Align(new List {aInput, bInput}); - break; - default: - result = smithWatermanObj.AlignSimple(new List {aInput, bInput}); - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - result = smithWatermanObj.Align(aInput, bInput); - break; - default: - result = smithWatermanObj.AlignSimple(aInput, bInput); - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - result = smithWatermanObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - break; - default: - result = smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - break; - } - break; - default: - break; - } - - // Get the expected sequence and scorde from xml config. - string expectedSequence1, expectedSequence2, expectedScore; - - switch (alignType) - { - case AlignmentType.Align: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedGapExtensionScoreNode); - - switch (caseType) - { - case SequenceCaseType.LowerCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence1InLower); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence2InLower); - break; - default: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence1Node); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants - .ExpectedGapExtensionSequence2Node); - break; - } - break; - default: - expectedScore = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedScoreNode); - - switch (caseType) - { - case SequenceCaseType.LowerCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence1inLowerNode); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence2inLowerNode); - break; - case SequenceCaseType.LowerUpperCase: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequence1inLowerNode); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode2); - break; - default: - expectedSequence1 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode1); - expectedSequence2 = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedSequenceNode2); - break; - } - - break; - } - - // Match the alignment result with expected result. - IList expectedOutput = new List(); - - IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); - var alignedSeq = new PairwiseAlignedSequence - { - FirstSequence = new Sequence(alphabet, expectedSequence1), - SecondSequence = new Sequence(alphabet, expectedSequence2), - Score = Convert.ToInt32(expectedScore, null), - FirstOffset = Int32.MinValue, - SecondOffset = Int32.MinValue, - }; - align.PairwiseAlignedSequences.Add(alignedSeq); - expectedOutput.Add(align); - - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Final Score '{0}'.", expectedScore)); - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Aligned First Sequence is '{0}'.", - expectedSequence1)); - ApplicationLog.WriteLine(string.Format(null, "SmithWatermanAligner P2 : Aligned Second Sequence is '{0}'.", - expectedSequence2)); - - Assert.IsTrue(CompareAlignment(result, expectedOutput)); - } - - /// - /// InValidates SmithWatermanAlignment with invalid sequence. - /// - /// Xml node name - /// Is text file an input. - /// Invalid sequence type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - /// Sequence Type - [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] - private void InValidateSmithWatermanAlignmentWithInvalidSequence(string nodeName, - bool isTextFile, - InvalidSequenceType invalidSequenceType, - AlignParameters additionalParameter, - AlignmentType alignType, - InvalidSequenceType sequenceType) - { - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - - Exception actualException = null; - Sequence aInput = null; - Sequence bInput = null; - - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string filepath = GetInputFileNameWithInvalidType(nodeName, invalidSequenceType); - - // Create input sequence for sequence string in different cases. - try - { - // Parse the files and get the sequence. - IEnumerable seqs = null; - using (var parser = new FastAParser(filepath)) - { - seqs = parser.Parse(); - aInput = new Sequence(alphabet, new string(seqs.ElementAt(0).Select(a => (char) a).ToArray())); - } - } - catch (FileFormatException ex) - { - actualException = ex; - } - } - else - { - string originalSequence = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequence1); - - // Create input sequence for sequence string in different cases. - try - { - aInput = new Sequence(alphabet, originalSequence); - } - catch (ArgumentException ex) - { - actualException = ex; - } - } - - if (actualException == null) - { - bInput = aInput; - - // Create similarity matrix object for a given file. - string blosumFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.BlosumFilePathNode); - - var sm = new SimilarityMatrix(blosumFilePath); - - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create SmithWatermanAligner instance and set its values. - var smithWatermanObj = new SmithWatermanAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - smithWatermanObj.SimilarityMatrix = sm; - smithWatermanObj.GapOpenCost = gapOpenCost; - smithWatermanObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(sm, gapOpenCost, - gapExtensionCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(sm, gapOpenCost, - aInput, bInput); - } - catch (ArgumentException ex) - { - actualException = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate Error messages for Invalid Sequence types. - string expectedErrorMessage = GetExpectedErrorMeesageWithInvalidSequenceType(nodeName, - sequenceType); - - Assert.AreEqual(expectedErrorMessage, actualException.Message); - - ApplicationLog.WriteLine(string.Concat( - "SmithWatermanAligner P2 : Expected Error message is thrown ", expectedErrorMessage)); - } - - /// - /// Validates SmithWatermanAlignment algorithm for the parameters passed. - /// - /// Xml node name - /// Is text file an input. - /// Invalid type - /// parameter based on which certain validations are done. - /// Is the Align type Simple or Align with Gap Extension cost? - [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void InValidateSmithWatermanAlignmentWithInvalidSimilarityMatrix(string nodeName, - bool isTextFile, - SimilarityMatrixInvalidTypes - invalidType, - AlignParameters additionalParameter, - AlignmentType alignType) - { - Sequence aInput = null; - Sequence bInput = null; - ISequence inputSequence1; - ISequence inputSequence2; - - IAlphabet alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.AlphabetNameNode)); - if (isTextFile) - { - // Read the xml file for getting both the files for aligning. - string firstInputFilepath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode1); - string secondInputFilepath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.FilePathNode2); - - // Parse the files and get the sequence. - using (var parseObjectForFile1 = new FastAParser(firstInputFilepath)) - { - using (var parseObjectForFile2 = new FastAParser(secondInputFilepath)) - { - parseObjectForFile1.Alphabet = alphabet; - parseObjectForFile2.Alphabet = alphabet; - inputSequence1 = parseObjectForFile1.Parse().ElementAt(0); - inputSequence2 = parseObjectForFile2.Parse().ElementAt(0); - } - } - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(new string(inputSequence1.Select(a => (char) a).ToArray()), - new string(inputSequence2.Select(a => (char) a).ToArray()), - alphabet, SequenceCaseType.LowerCase, out aInput, out bInput); - } - else - { - string firstInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode1); - string secondInputSequence = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SequenceNode2); - - // Create input sequence for sequence string in different cases. - GetSequenceWithCaseType(firstInputSequence, secondInputSequence, - alphabet, SequenceCaseType.LowerCase, out aInput, out bInput); - } - - ApplicationLog.WriteLine(string.Concat( - "SmithWatermanAligner P2 : First sequence used is '{0}'.", - new string(aInput.Select(a => (char) a).ToArray()))); - ApplicationLog.WriteLine(string.Concat( - "SmithWatermanAligner P2 : Second sequence used is '{0}'.", - new string(bInput.Select(a => (char) a).ToArray()))); - - // Create similarity matrix object for a invalid file. - string blosumFilePath = GetSimilarityMatrixFileWithInvalidType(nodeName, invalidType); - Exception actualExpection = null; - - // For invalid similarity matrix data format; exception will be thrown while instantiating - SimilarityMatrix sm = null; - try - { - if (invalidType != SimilarityMatrixInvalidTypes.NullSimilarityMatrix) - { - sm = new SimilarityMatrix(blosumFilePath); - } - } - catch (InvalidDataException ex) - { - actualExpection = ex; - } - - // For non matching similarity matrix exception will be thrown while alignment - if (actualExpection == null) - { - int gapOpenCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapOpenCostNode), null); - - int gapExtensionCost = int.Parse(utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.GapExtensionCostNode), null); - - // Create SmithWatermanAligner instance and set its values. - var smithWatermanObj = new SmithWatermanAligner(); - if (additionalParameter != AlignParameters.AllParam) - { - smithWatermanObj.SimilarityMatrix = sm; - smithWatermanObj.GapOpenCost = gapOpenCost; - smithWatermanObj.GapExtensionCost = gapExtensionCost; - } - - // Align the input sequences and catch the exception. - switch (additionalParameter) - { - case AlignParameters.AlignList: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(new List {aInput, bInput}); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AlignTwo: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - case AlignParameters.AllParam: - switch (alignType) - { - case AlignmentType.Align: - try - { - smithWatermanObj.Align(sm, gapOpenCost, gapExtensionCost, - aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - default: - try - { - smithWatermanObj.AlignSimple(sm, gapOpenCost, aInput, bInput); - } - catch (ArgumentException ex) - { - actualExpection = ex; - } - break; - } - break; - default: - break; - } - } - - // Validate that expected exception is thrown using error message. - string expectedErrorMessage = GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(nodeName, - invalidType); - Assert.AreEqual(expectedErrorMessage, actualExpection.Message); - - ApplicationLog.WriteLine(string.Concat( - "SmithWatermanAligner P2 : Expected Error message is thrown ", expectedErrorMessage)); - } - - /// - /// Gets the expected error message for invalid similarity matrix type. - /// - /// xml node - /// similarity matrix invalid type. - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSimilarityMatrixType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string expectedErrorMessage = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptyMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SimilarityMatrixFewerLinesException); - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ModifiedMatrixErrorMessage); - break; - case SimilarityMatrixInvalidTypes.NullSimilarityMatrix: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.NullErrorMessage); - break; - case SimilarityMatrixInvalidTypes.EmptySequence: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case SimilarityMatrixInvalidTypes.ExpectedErrorMessage: - expectedErrorMessage = utilityObj.xmlUtil.GetFileTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - default: - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the expected error message for invalid sequence type. - /// - /// xml node - /// invalid sequence type. - /// Returns expected error message - private string GetExpectedErrorMeesageWithInvalidSequenceType(string nodeName, InvalidSequenceType sequenceType) - { - string expectedErrorMessage = string.Empty; - switch (sequenceType) - { - case InvalidSequenceType.SequenceWithInvalidChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.EmptySequenceErrorMessage); - break; - case InvalidSequenceType.InvalidSequence: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.UnicodeSequenceErrorMessage); - break; - case InvalidSequenceType.SequenceWithSpaces: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.SequenceWithSpaceErrorMessage); - break; - case InvalidSequenceType.AlphabetMap: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidAlphabetErrorMessage); - break; - default: - expectedErrorMessage = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.ExpectedErrorMessage); - break; - } - - return expectedErrorMessage; - } - - /// - /// Gets the similarity matrix file name for a given invalid similarity matrix type. - /// - /// xml node. - /// similarity matrix invalid type. - /// Returns similarity matrix file name. - private string GetSimilarityMatrixFileWithInvalidType(string nodeName, - SimilarityMatrixInvalidTypes invalidType) - { - string invalidFileNode = string.Empty; - string invalidFilePath = string.Empty; - switch (invalidType) - { - case SimilarityMatrixInvalidTypes.NonMatchingSimilarityMatrix: - invalidFileNode = Constants.BlosumInvalidFilePathNode; - break; - case SimilarityMatrixInvalidTypes.EmptySimilaityMatrix: - invalidFileNode = Constants.BlosumEmptyFilePathNode; - break; - case SimilarityMatrixInvalidTypes.OnlyAlphabetSimilarityMatrix: - invalidFileNode = Constants.BlosumOnlyAlphabetFilePathNode; - break; - case SimilarityMatrixInvalidTypes.FewAlphabetsSimilarityMatrix: - invalidFileNode = Constants.BlosumFewAlphabetsFilePathNode; - break; - case SimilarityMatrixInvalidTypes.ModifiedSimilarityMatrix: - invalidFileNode = Constants.BlosumModifiedFilePathNode; - break; - default: - break; - } - if (1 == string.Compare(invalidFileNode, string.Empty, StringComparison.CurrentCulture)) - { - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, invalidFileNode); - } - return invalidFilePath; - } - - /// - /// Gets the input file name for a given invalid sequence type. - /// - /// xml node. - /// - /// Returns input file name. - private string GetInputFileNameWithInvalidType(string nodeName, - InvalidSequenceType invalidSequenceType) - { - string invalidFilePath = string.Empty; - switch (invalidSequenceType) - { - case InvalidSequenceType.SequenceWithSpecialChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, - Constants.InvalidFilePathNode1); - break; - case InvalidSequenceType.EmptySequence: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.EmptyFilePath1); - break; - case InvalidSequenceType.SequenceWithSpaces: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.SpacesFilePath1); - break; - case InvalidSequenceType.SequenceWithGap: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GapFilePath1); - break; - case InvalidSequenceType.SequenceWithUnicodeChars: - invalidFilePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.UnicodeFilePath1); - break; - default: - break; - } - - return invalidFilePath; - } - - /// - /// Creates the sequence object with sequences in different cases - /// - /// First sequence string. - /// Second sequence string. - /// alphabet type. - /// Sequence case type - /// First input sequence object. - /// Second input sequence object. - private static void GetSequenceWithCaseType(string firstSequenceString, string secondSequenceString, - IAlphabet alphabet, SequenceCaseType caseType, - out Sequence firstInputSequence, - out Sequence secondInputSequence) - { - switch (caseType) - { - case SequenceCaseType.LowerCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.UpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.LowerUpperCase: - firstInputSequence = new Sequence(alphabet, - firstSequenceString.ToString(null) - .ToLower(CultureInfo.CurrentCulture)); - secondInputSequence = new Sequence(alphabet, - secondSequenceString.ToString(null) - .ToUpper(CultureInfo.CurrentCulture)); - break; - case SequenceCaseType.Default: - default: - firstInputSequence = new Sequence(alphabet, firstSequenceString.ToString(null)); - secondInputSequence = new Sequence(alphabet, secondSequenceString.ToString(null)); - break; - } - } - - /// - /// Compare the alignment of mummer and defined alignment - /// - /// - /// expected output - /// Compare result of alignments - private static bool CompareAlignment(IList actualAlignment, - IList expectedAlignment) - { - return AlignmentHelpers.CompareAlignment(actualAlignment, expectedAlignment); - } - - #endregion - } -} \ No newline at end of file