Esempio n. 1
0
        void ValidateCompareSymbols(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte      byte1 = 0, byte2 = 0, byte3 = 0;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                byte1            = (byte)'A';
                byte2            = (byte)'A';
                byte3            = (byte)'B';
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                byte1            = (byte)'U';
                byte2            = (byte)'U';
                byte3            = (byte)'A';
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                byte1            = (byte)'T';
                byte2            = (byte)'T';
                byte3            = (byte)'A';
                break;
            }

            Assert.AreEqual(byte1, byte2);
            Assert.AreNotEqual(byte1, byte3);
            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Comparing Symbols operation ",
                                                   option, " completed successfully."));
        }
Esempio n. 2
0
        void ValidateGetAmbiguousCharacters(AlphabetsTypes option)
        {
            string    referenceCharacters = "";
            IAlphabet alphabetInstance    = null;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                referenceCharacters = "BZJX";
                alphabetInstance    = AmbiguousProteinAlphabet.Instance;
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance    = AmbiguousRnaAlphabet.Instance;
                referenceCharacters = "MRSWYKVHDBN";
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance    = AmbiguousDnaAlphabet.Instance;
                referenceCharacters = "MRSWYKVHDBN";
                break;
            }

            HashSet <byte> ambiguousCharacters = new HashSet <byte>();

            ambiguousCharacters = alphabetInstance.GetAmbiguousSymbols();
            string ambiguosCharacters = new string(ambiguousCharacters.Select(a => (char)a).ToArray());

            char[] refCharacters = referenceCharacters.ToCharArray();

            for (int i = 0; i < ambiguosCharacters.Length; i++)
            {
                Assert.IsTrue(ambiguosCharacters.Contains(refCharacters[i]));
            }
        }
Esempio n. 3
0
        void ValidateGetValidSymbols(AlphabetsTypes option)
        {
            string    referenceCharacters = "";
            IAlphabet alphabetInstance    = null;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                referenceCharacters = "AaCcDdEeFfGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvWwYy-*";
                alphabetInstance    = ProteinAlphabet.Instance;
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance    = RnaAlphabet.Instance;
                referenceCharacters = "AaCcGgUu-";
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance    = DnaAlphabet.Instance;
                referenceCharacters = "AaCcGgTt-";
                break;
            }

            HashSet <byte> validSymbolsByte = new HashSet <byte>();

            validSymbolsByte = alphabetInstance.GetValidSymbols();
            string validSymbols = new string(validSymbolsByte.Select(a => (char)a).ToArray());

            Assert.AreEqual(referenceCharacters, validSymbols);
            ApplicationLog.WriteLine(string.Concat(
                                         "Alphabets BVT: Validation of Alphabets operation ", option, " completed successfully."));
        }
Esempio n. 4
0
        /// <summary>
        /// Validate ValidateSequence method.
        /// Input Data : Valid Dna/Rna/Protein Sequences.
        /// Output Data : Validate Sequences for all Alphabet instances.
        /// </summary>
        void ValidateSequenceTypes(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            string    sequence         = "";

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                sequence         = utilityObj.xmlUtil.GetTextValue(Constants.ProteinDerivedSequenceNode,
                                                                   Constants.ExpectedDerivedSequence);
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                sequence         = utilityObj.xmlUtil.GetTextValue(Constants.RnaDerivedSequenceNode,
                                                                   Constants.ExpectedDerivedSequence);
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                sequence         = utilityObj.xmlUtil.GetTextValue(Constants.DnaDerivedSequenceNode,
                                                                   Constants.ExpectedDerivedSequence);
                break;
            }

            Assert.IsTrue(alphabetInstance.ValidateSequence(encodingObj.GetBytes(sequence), 0, 4));
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Validate Sequence method for ", option, " completed successfully."));
        }
Esempio n. 5
0
        void ValidateTryGetAmbiguousSymbol(AlphabetsTypes option)
        {
            IAlphabet      alphabetInstance = null;
            HashSet <byte> basicSymbols = new HashSet <byte>();
            byte           ambiguousSymbol = 0, expectedAmbiguousSymbol = 0;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = AmbiguousProteinAlphabet.Instance;
                basicSymbols.Add((byte)'Q');
                basicSymbols.Add((byte)'E');
                expectedAmbiguousSymbol = (byte)'Z';
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = AmbiguousRnaAlphabet.Instance;
                basicSymbols.Add((byte)'G');
                basicSymbols.Add((byte)'C');
                expectedAmbiguousSymbol = (byte)'S';
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = AmbiguousDnaAlphabet.Instance;
                basicSymbols.Add((byte)'G');
                basicSymbols.Add((byte)'A');
                expectedAmbiguousSymbol = (byte)'R';
                break;
            }

            Assert.IsTrue(alphabetInstance.TryGetAmbiguousSymbol(basicSymbols, out ambiguousSymbol));
            Assert.AreEqual(expectedAmbiguousSymbol, ambiguousSymbol);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get Ambiguous symbol for ", option, " completed successfully."));
        }
Esempio n. 6
0
        void ValidateTryGetDefaultGapSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                break;
            }

            byte outputByte;

            alphabetInstance.TryGetDefaultGapSymbol(out outputByte);
            Assert.AreEqual('-', (char)outputByte);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try Default gap symbol for ", option, " completed successfully."));
            HashSet <byte> outputGapSymbol = new HashSet <byte>();
            string         outputGapString = "";

            alphabetInstance.TryGetGapSymbols(out outputGapSymbol);
            outputGapString = new string(outputGapSymbol.Select(a => (char)a).ToArray());
            Assert.AreEqual("-", outputGapString);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get gap symbol for ", option, " completed successfully."));
        }
Esempio n. 7
0
        void ValidatePublicProperties(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            int       count = 0;
            bool      hasGaps = true, hasAmbiguity = true, hasTermination = true, isComplementSupported = true;
            string    name = "";

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance      = ProteinAlphabet.Instance;
                count                 = 24;
                hasAmbiguity          = false;
                hasGaps               = true;
                hasTermination        = true;
                isComplementSupported = false;
                name = "Protein";
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance      = RnaAlphabet.Instance;
                count                 = 5;
                hasAmbiguity          = false;
                hasGaps               = true;
                hasTermination        = false;
                isComplementSupported = true;
                name = "Rna";
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance      = DnaAlphabet.Instance;
                count                 = 5;
                hasAmbiguity          = false;
                hasGaps               = true;
                hasTermination        = false;
                isComplementSupported = true;
                name = "Dna";
                break;
            }

            Assert.AreEqual(count, alphabetInstance.Count);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Count property for ", option, " completed successfully."));
            Assert.AreEqual(hasGaps, alphabetInstance.HasGaps);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasGaps property for ", option, " completed successfully."));
            Assert.AreEqual(hasAmbiguity, alphabetInstance.HasAmbiguity);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasAmbiguity property for ", option, " completed successfully."));
            Assert.AreEqual(hasTermination, alphabetInstance.HasTerminations);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasTermination property for ", option, " completed successfully."));
            Assert.AreEqual(isComplementSupported, alphabetInstance.IsComplementSupported);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                IsComplementSupported property for ", option, " completed successfully."));
            Assert.AreEqual(name, alphabetInstance.Name);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Name property for ", option, " completed successfully."));
        }
Esempio n. 8
0
        void ValidateGetSymbolValueMap(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;

            byte[] queryReference = null;
            byte   inputByte1 = 0, inputByte2 = 0, outputByte1 = 0, outputByte2 = 0;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                inputByte1       = (byte)'w';
                outputByte1      = (byte)'W';
                inputByte2       = (byte)'e';
                outputByte2      = (byte)'E';
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                inputByte1       = (byte)'a';
                outputByte1      = (byte)'A';
                inputByte2       = (byte)'u';
                outputByte2      = (byte)'U';
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                inputByte1       = (byte)'a';
                outputByte1      = (byte)'A';
                inputByte2       = (byte)'t';
                outputByte2      = (byte)'T';
                break;
            }

            byte output = 0;

            queryReference = alphabetInstance.GetSymbolValueMap();
            output         = queryReference[inputByte1];
            Assert.AreEqual(outputByte1, output);
            output = queryReference[inputByte2];
            Assert.AreEqual(outputByte2, output);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                GetSymbolValueMap method for ", option, " completed successfully."));
        }
Esempio n. 9
0
        void GetDefaultTerminationSymbol(AlphabetsTypes option)
        {
            IAlphabet      alphabetInstance = null;
            byte           outputDefaultTerminationSymbol = 0;
            HashSet <byte> outputTerminationSymbol        = new HashSet <byte>();
            string         outputTerminationString        = "";

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                break;
            }

            if (option.Equals(AlphabetsTypes.Protein))
            {
                Assert.AreEqual(true, alphabetInstance.TryGetDefaultTerminationSymbol(out outputDefaultTerminationSymbol));
                Assert.AreEqual(true, alphabetInstance.TryGetTerminationSymbols(out outputTerminationSymbol));
                outputTerminationString = new string(outputTerminationSymbol.Select(a => (char)a).ToArray());
                Assert.AreEqual('*', (char)outputDefaultTerminationSymbol);
                Assert.AreEqual("*", outputTerminationString);
            }
            else
            {
                Assert.AreEqual(false, alphabetInstance.TryGetDefaultTerminationSymbol(out outputDefaultTerminationSymbol));
                Assert.AreEqual(false, alphabetInstance.TryGetTerminationSymbols(out outputTerminationSymbol));
            }

            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Get Default termination symbol for",
                                                   option, " completed successfully."));
        }
Esempio n. 10
0
        void TryGetComplementSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte      inputByte = 0, complementByte = 0, outputByte = 0;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = ProteinAlphabet.Instance;
                inputByte        = (byte)'F';
                complementByte   = (byte)'U';
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = RnaAlphabet.Instance;
                inputByte        = (byte)'A';
                complementByte   = (byte)'U';
                break;

            case AlphabetsTypes.Dna:
                alphabetInstance = DnaAlphabet.Instance;
                inputByte        = (byte)'A';
                complementByte   = (byte)'T';
                break;
            }

            if (!option.Equals(AlphabetsTypes.Protein))
            {
                Assert.AreEqual(true, alphabetInstance.TryGetComplementSymbol(inputByte, out outputByte));
                Assert.AreEqual(complementByte, outputByte);
            }
            else
            {
                Assert.AreEqual(false, alphabetInstance.TryGetComplementSymbol(inputByte, out outputByte));
            }

            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Get Complement operation for",
                                                   option, " completed successfully."));
        }
Esempio n. 11
0
        void ValidateTryGetBasicSymbols(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte      basicSymbol = 0, expectedSymbol1 = 0, expectedSymbol2 = 0;

            switch (option)
            {
            case AlphabetsTypes.Protein:
                alphabetInstance = AmbiguousProteinAlphabet.Instance;
                basicSymbol      = (byte)'Z';
                expectedSymbol1  = (byte)'Q';
                expectedSymbol2  = (byte)'E';
                break;

            case AlphabetsTypes.Rna:
                alphabetInstance = AmbiguousRnaAlphabet.Instance;
                basicSymbol      = (byte)'R';
                expectedSymbol1  = (byte)'G';
                expectedSymbol2  = (byte)'A';
                break;

            case AlphabetsTypes.Dna:
                basicSymbol      = (byte)'M';
                expectedSymbol1  = (byte)'A';
                expectedSymbol2  = (byte)'C';
                alphabetInstance = AmbiguousDnaAlphabet.Instance;
                break;
            }

            HashSet <byte> basicSymbols;

            Assert.AreEqual(true, alphabetInstance.TryGetBasicSymbols(basicSymbol, out basicSymbols));
            Assert.IsTrue(basicSymbols.All(sy => (sy == expectedSymbol1 || sy == expectedSymbol2)));
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get Basics symbol for ", option, " completed successfully."));
        }
Esempio n. 12
0
        void ValidateGetValidSymbols(AlphabetsTypes option)
        {
            string referenceCharacters = "";
            IAlphabet alphabetInstance = null;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    referenceCharacters = "AaCcDdEeFfGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvWwYy-*";
                    alphabetInstance = ProteinAlphabet.Instance;
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    referenceCharacters = "AaCcGgUu-";
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    referenceCharacters = "AaCcGgTt-";
                    break;
            }

            HashSet<byte> validSymbolsByte = new HashSet<byte>();
            validSymbolsByte = alphabetInstance.GetValidSymbols();
            string validSymbols = new string(validSymbolsByte.Select(a => (char)a).ToArray());
            Assert.AreEqual(referenceCharacters, validSymbols);
            ApplicationLog.WriteLine(string.Concat(
                   "Alphabets BVT: Validation of Alphabets operation ", option, " completed successfully."));
        }
Esempio n. 13
0
        void ValidateCompareSymbols(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte byte1 = 0, byte2 = 0, byte3 = 0;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    byte1 = (byte)'A';
                    byte2 = (byte)'A';
                    byte3 = (byte)'B';
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    byte1 = (byte)'U';
                    byte2 = (byte)'U';
                    byte3 = (byte)'A';
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    byte1 = (byte)'T';
                    byte2 = (byte)'T';
                    byte3 = (byte)'A';
                    break;
            }

            Assert.AreEqual(byte1, byte2);
            Assert.AreNotEqual(byte1, byte3);
            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Comparing Symbols operation ",
                                    option, " completed successfully."));
        }
Esempio n. 14
0
        void ValidateGetSymbolValueMap(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte[] queryReference = null;
            byte inputByte1 = 0, inputByte2 = 0, outputByte1 = 0, outputByte2 = 0;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    inputByte1 = (byte)'w';
                    outputByte1 = (byte)'W';
                    inputByte2 = (byte)'e';
                    outputByte2 = (byte)'E';
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    inputByte1 = (byte)'a';
                    outputByte1 = (byte)'A';
                    inputByte2 = (byte)'u';
                    outputByte2 = (byte)'U';
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    inputByte1 = (byte)'a';
                    outputByte1 = (byte)'A';
                    inputByte2 = (byte)'t';
                    outputByte2 = (byte)'T';
                    break;
            }

            byte output = 0;
            queryReference = alphabetInstance.GetSymbolValueMap();
            output = queryReference[inputByte1];
            Assert.AreEqual(outputByte1, output);
            output = queryReference[inputByte2];
            Assert.AreEqual(outputByte2, output);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                GetSymbolValueMap method for ", option, " completed successfully."));
        }
Esempio n. 15
0
        void ValidateGetAmbiguousCharacters(AlphabetsTypes option)
        {
            string referenceCharacters = "";
            IAlphabet alphabetInstance = null;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    referenceCharacters = "BZJX";
                    alphabetInstance = AmbiguousProteinAlphabet.Instance;
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = AmbiguousRnaAlphabet.Instance;
                    referenceCharacters = "MRSWYKVHDBN";
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = AmbiguousDnaAlphabet.Instance;
                    referenceCharacters = "MRSWYKVHDBN";
                    break;
            }

            HashSet<byte> ambiguousCharacters = new HashSet<byte>();
            ambiguousCharacters = alphabetInstance.GetAmbiguousSymbols();
            string ambiguosCharacters = new string(ambiguousCharacters.Select(a => (char)a).ToArray());

            char[] refCharacters = referenceCharacters.ToCharArray();

            for (int i = 0; i < ambiguosCharacters.Length; i++)
            {
                Assert.IsTrue(ambiguosCharacters.Contains(refCharacters[i]));
            }

        }
Esempio n. 16
0
        void ValidatePublicProperties(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            int count = 0;
            bool hasGaps = true, hasAmbiguity = true, hasTermination = true, isComplementSupported = true;
            string name = "";

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    count = 24;
                    hasAmbiguity = false;
                    hasGaps = true;
                    hasTermination = true;
                    isComplementSupported = false;
                    name = "Protein";
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    count = 5;
                    hasAmbiguity = false;
                    hasGaps = true;
                    hasTermination = false;
                    isComplementSupported = true;
                    name = "Rna";
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    count = 5;
                    hasAmbiguity = false;
                    hasGaps = true;
                    hasTermination = false;
                    isComplementSupported = true;
                    name = "Dna";
                    break;
            }

            Assert.AreEqual(count, alphabetInstance.Count);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Count property for ", option, " completed successfully."));
            Assert.AreEqual(hasGaps, alphabetInstance.HasGaps);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasGaps property for ", option, " completed successfully."));
            Assert.AreEqual(hasAmbiguity, alphabetInstance.HasAmbiguity);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasAmbiguity property for ", option, " completed successfully."));
            Assert.AreEqual(hasTermination, alphabetInstance.HasTerminations);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                HasTermination property for ", option, " completed successfully."));
            Assert.AreEqual(isComplementSupported, alphabetInstance.IsComplementSupported);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                IsComplementSupported property for ", option, " completed successfully."));
            Assert.AreEqual(name, alphabetInstance.Name);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Name property for ", option, " completed successfully."));
        }
Esempio n. 17
0
        /// <summary>
        /// Validate ValidateSequence method.
        /// Input Data : Valid Dna/Rna/Protein Sequences.
        /// Output Data : Validate Sequences for all Alphabet instances.
        /// </summary>
        void ValidateSequenceTypes(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            string sequence = "";

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    sequence = this.utilityObj.xmlUtil.GetTextValue(Constants.ProteinDerivedSequenceNode,
                                Constants.ExpectedDerivedSequence);
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    sequence = this.utilityObj.xmlUtil.GetTextValue(Constants.RnaDerivedSequenceNode,
                                Constants.ExpectedDerivedSequence);
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    sequence = this.utilityObj.xmlUtil.GetTextValue(Constants.DnaDerivedSequenceNode,
                                Constants.ExpectedDerivedSequence);
                    break;
            }
                        
            Assert.IsTrue(alphabetInstance.ValidateSequence(UTF8Encoding.UTF8.GetBytes(sequence), 0, 4));
            
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Validate Sequence method for ", option, " completed successfully."));
        }
Esempio n. 18
0
        void ValidateTryGetAmbiguousSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            HashSet<byte> basicSymbols = new HashSet<byte>();
            byte ambiguousSymbol = 0, expectedAmbiguousSymbol = 0;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = AmbiguousProteinAlphabet.Instance;
                    basicSymbols.Add((byte)'Q');
                    basicSymbols.Add((byte)'E');
                    expectedAmbiguousSymbol = (byte)'Z';
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = AmbiguousRnaAlphabet.Instance;
                    basicSymbols.Add((byte)'G');
                    basicSymbols.Add((byte)'C');
                    expectedAmbiguousSymbol = (byte)'S';
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = AmbiguousDnaAlphabet.Instance;
                    basicSymbols.Add((byte)'G');
                    basicSymbols.Add((byte)'A');
                    expectedAmbiguousSymbol = (byte)'R';
                    break;
            }

            Assert.IsTrue(alphabetInstance.TryGetAmbiguousSymbol(basicSymbols, out ambiguousSymbol));
            Assert.AreEqual(expectedAmbiguousSymbol, ambiguousSymbol);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get Ambiguous symbol for ", option, " completed successfully."));
        }
Esempio n. 19
0
        void ValidateTryGetBasicSymbols(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte basicSymbol = 0, expectedSymbol1 = 0, expectedSymbol2 = 0;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = AmbiguousProteinAlphabet.Instance;
                    basicSymbol = (byte)'Z';
                    expectedSymbol1 = (byte)'Q';
                    expectedSymbol2 = (byte)'E';
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = AmbiguousRnaAlphabet.Instance;
                    basicSymbol = (byte)'R';
                    expectedSymbol1 = (byte)'G';
                    expectedSymbol2 = (byte)'A';
                    break;
                case AlphabetsTypes.Dna:
                    basicSymbol = (byte)'M';
                    expectedSymbol1 = (byte)'A';
                    expectedSymbol2 = (byte)'C';
                    alphabetInstance = AmbiguousDnaAlphabet.Instance;
                    break;
            }

            HashSet<byte> basicSymbols;
            Assert.AreEqual(true, alphabetInstance.TryGetBasicSymbols(basicSymbol, out basicSymbols));
            Assert.IsTrue(basicSymbols.All(sy => (sy == expectedSymbol1 || sy == expectedSymbol2)));
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get Basics symbol for ", option, " completed successfully."));
        }
Esempio n. 20
0
        void TryGetComplementSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte inputByte = 0, complementByte = 0, outputByte = 0;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    inputByte = (byte)'F';
                    complementByte = (byte)'U';
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    inputByte = (byte)'A';
                    complementByte = (byte)'U';
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    inputByte = (byte)'A';
                    complementByte = (byte)'T';
                    break;
            }

            if (!option.Equals(AlphabetsTypes.Protein))
            {
                Assert.AreEqual(true, alphabetInstance.TryGetComplementSymbol(inputByte, out outputByte));
                Assert.AreEqual(complementByte, outputByte);
            }
            else
            {
                Assert.AreEqual(false, alphabetInstance.TryGetComplementSymbol(inputByte, out outputByte));
            }

            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Get Complement operation for",
                                    option, " completed successfully."));

        }
Esempio n. 21
0
        void GetDefaultTerminationSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;
            byte outputDefaultTerminationSymbol = 0;
            HashSet<byte> outputTerminationSymbol = new HashSet<byte>();
            string outputTerminationString = "";

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    break;
            }

            if (option.Equals(AlphabetsTypes.Protein))
            {
                Assert.AreEqual(true, alphabetInstance.TryGetDefaultTerminationSymbol(out outputDefaultTerminationSymbol));
                Assert.AreEqual(true, alphabetInstance.TryGetTerminationSymbols(out outputTerminationSymbol));
                outputTerminationString = new string(outputTerminationSymbol.Select(a => (char)a).ToArray());
                Assert.AreEqual('*', (char)outputDefaultTerminationSymbol);
                Assert.AreEqual("*", outputTerminationString);
            }
            else
            {
                Assert.AreEqual(false, alphabetInstance.TryGetDefaultTerminationSymbol(out outputDefaultTerminationSymbol));
                Assert.AreEqual(false, alphabetInstance.TryGetTerminationSymbols(out outputTerminationSymbol));
            }

            ApplicationLog.WriteLine(string.Concat("Alphabets BVT: Validation of Get Default termination symbol for",
                                    option, " completed successfully."));
        }
Esempio n. 22
0
        void ValidateTryGetDefaultGapSymbol(AlphabetsTypes option)
        {
            IAlphabet alphabetInstance = null;

            switch (option)
            {
                case AlphabetsTypes.Protein:
                    alphabetInstance = ProteinAlphabet.Instance;
                    break;
                case AlphabetsTypes.Rna:
                    alphabetInstance = RnaAlphabet.Instance;
                    break;
                case AlphabetsTypes.Dna:
                    alphabetInstance = DnaAlphabet.Instance;
                    break;
            }

            byte outputByte;
            alphabetInstance.TryGetDefaultGapSymbol(out outputByte);
            Assert.AreEqual('-', (char)outputByte);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try Default gap symbol for ", option, " completed successfully."));
            HashSet<byte> outputGapSymbol = new HashSet<byte>();
            string outputGapString = "";
            alphabetInstance.TryGetGapSymbols(out outputGapSymbol);
            outputGapString = new string(outputGapSymbol.Select(a => (char)a).ToArray());
            Assert.AreEqual("-", outputGapString);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Try  Get gap symbol for ", option, " completed successfully."));
        }