Beispiel #1
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."));
        }
Beispiel #2
0
        public void TestDnaAlphabetTryGetAmbiguousSymbols()
        {
            byte      basicSymbol;
            IAlphabet alphabet = AmbiguousDnaAlphabet.Instance;

            Assert.AreEqual(true, alphabet.TryGetAmbiguousSymbol(new HashSet <byte>()
            {
                (byte)'A', (byte)'C'
            }, out basicSymbol));
            Assert.IsTrue(basicSymbol == (byte)'M');

            alphabet = AmbiguousRnaAlphabet.Instance;
            Assert.AreEqual(true, alphabet.TryGetAmbiguousSymbol(new HashSet <byte>()
            {
                (byte)'U', (byte)'C'
            }, out basicSymbol));
            Assert.IsTrue(basicSymbol == (byte)'Y');
        }
Beispiel #3
0
        public void TestProteinAlphabetTryGetAmbiguousSymbols()
        {
            byte      basicSymbol;
            IAlphabet alphabet = AmbiguousProteinAlphabet.Instance;

            Assert.AreEqual(true, alphabet.TryGetAmbiguousSymbol(new HashSet <byte>()
            {
                (byte)'D', (byte)'N'
            }, out basicSymbol));
            Assert.IsTrue(basicSymbol == (byte)'B');
        }