示例#1
0
        public void TestAllAlphabetsToString()
        {
            DnaAlphabet              dna              = DnaAlphabet.Instance;
            RnaAlphabet              rna              = RnaAlphabet.Instance;
            ProteinAlphabet          protein          = ProteinAlphabet.Instance;
            AmbiguousDnaAlphabet     dnaAmbiguous     = AmbiguousDnaAlphabet.Instance;
            AmbiguousRnaAlphabet     rnaAmbiguous     = AmbiguousRnaAlphabet.Instance;
            AmbiguousProteinAlphabet proteinAmbiguous = AmbiguousProteinAlphabet.Instance;

            string dnaStringActual              = dna.ToString();
            string rnaStringActual              = rna.ToString();
            string proteinStringActual          = protein.ToString();
            string dnaAmbiguousStringActual     = dnaAmbiguous.ToString();
            string rnaAmbiguousStringActual     = rnaAmbiguous.ToString();
            string proteinAmbiguousStringActual = proteinAmbiguous.ToString();

            string dnaStringExpected              = "ACGT-";
            string rnaStringExpected              = "ACGU-";
            string proteinStringExpected          = "ACDEFGHIKLMNOPQRSTUVWY-*";
            string dnaAmbiguousStringExpected     = "ACGT-MRSWYKVHDBN";
            string rnaAmbiguousStringExpected     = "ACGU-NMRSWYKVHDB";
            string proteinAmbiguousStringExpected = "ACDEFGHIKLMNOPQRSTUVWY-*XZBJ";

            Assert.AreEqual(dnaStringExpected, dnaStringActual);
            Assert.AreEqual(rnaStringExpected, rnaStringActual);
            Assert.AreEqual(proteinStringExpected, proteinStringActual);
            Assert.AreEqual(dnaAmbiguousStringExpected, dnaAmbiguousStringActual);
            Assert.AreEqual(rnaAmbiguousStringExpected, rnaAmbiguousStringActual);
            Assert.AreEqual(proteinAmbiguousStringExpected, proteinAmbiguousStringActual);
        }
示例#2
0
        public void ValidateAmbiguousDnaAplhabet()
        {
            char[] ambiguousCharacters = new char[16] {
                'A', 'M', 'R', 'S', 'W', 'Y', 'K', 'V', 'H', 'D', 'B', 'N', 'C', 'G', '-', 'T'
            };
            AmbiguousDnaAlphabet dnaAlphabetInstance = AmbiguousDnaAlphabet.Instance;

            Assert.AreEqual((char)dnaAlphabetInstance.A, ambiguousCharacters[0]);
            Assert.AreEqual((char)dnaAlphabetInstance.AC, ambiguousCharacters[1]);
            Assert.AreEqual((char)dnaAlphabetInstance.ACT, ambiguousCharacters[8]);
            Assert.AreEqual((char)dnaAlphabetInstance.AT, ambiguousCharacters[4]);
            Assert.AreEqual((char)dnaAlphabetInstance.C, ambiguousCharacters[12]);
            Assert.AreEqual((char)dnaAlphabetInstance.G, ambiguousCharacters[13]);
            Assert.AreEqual((char)dnaAlphabetInstance.GA, ambiguousCharacters[2]);
            Assert.AreEqual((char)dnaAlphabetInstance.Gap, ambiguousCharacters[14]);
            Assert.AreEqual((char)dnaAlphabetInstance.GAT, ambiguousCharacters[9]);
            Assert.AreEqual((char)dnaAlphabetInstance.GC, ambiguousCharacters[3]);
            Assert.AreEqual((char)dnaAlphabetInstance.GCA, ambiguousCharacters[7]);
            Assert.AreEqual((char)dnaAlphabetInstance.GT, ambiguousCharacters[6]);
            Assert.AreEqual((char)dnaAlphabetInstance.GTC, ambiguousCharacters[10]);
            Assert.AreEqual((char)dnaAlphabetInstance.T, ambiguousCharacters[15]);
            Assert.AreEqual((char)dnaAlphabetInstance.TC, ambiguousCharacters[5]);
            ApplicationLog.WriteLine(string.Concat(@"Alphabets BVT: Validation of 
                                Ambiguous Dna characters completed successfully."));
        }
示例#3
0
        public void TestDnaAlphabetTryGetBasicSymbols()
        {
            HashSet <byte>       basicSymbols;
            AmbiguousDnaAlphabet dnaAlphabet = AmbiguousDnaAlphabet.Instance;

            Assert.AreEqual(true, dnaAlphabet.TryGetBasicSymbols((byte)'M', out basicSymbols));
            Assert.IsTrue(basicSymbols.All(sy => (sy == (byte)'A' || sy == (byte)'C')));
        }
示例#4
0
        public void ValidateAllAlphabetsToString()
        {
            DnaAlphabet              dna              = DnaAlphabet.Instance;
            RnaAlphabet              rna              = RnaAlphabet.Instance;
            ProteinAlphabet          protein          = ProteinAlphabet.Instance;
            AmbiguousDnaAlphabet     dnaAmbiguous     = AmbiguousDnaAlphabet.Instance;
            AmbiguousRnaAlphabet     rnaAmbiguous     = AmbiguousRnaAlphabet.Instance;
            AmbiguousProteinAlphabet proteinAmbiguous = AmbiguousProteinAlphabet.Instance;

            string dnaStringActual              = dna.ToString();
            string rnaStringActual              = rna.ToString();
            string proteinStringActual          = protein.ToString();
            string dnaAmbiguousStringActual     = dnaAmbiguous.ToString();
            string rnaAmbiguousStringActual     = rnaAmbiguous.ToString();
            string proteinAmbiguousStringActual = proteinAmbiguous.ToString();

            Assert.AreEqual("ACGT-", dnaStringActual);
            Assert.AreEqual("ACGU-", rnaStringActual);
            Assert.AreEqual("ACDEFGHIKLMNOPQRSTUVWY-*", proteinStringActual);
            Assert.AreEqual("ACGT-MRSWYKVHDBN", dnaAmbiguousStringActual);
            Assert.AreEqual("ACGU-NMRSWYKVHDB", rnaAmbiguousStringActual);
            Assert.AreEqual("ACDEFGHIKLMNOPQRSTUVWY-*XZBJ", proteinAmbiguousStringActual);
        }