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); }
public void ValidateDnaAlphabetCompareSymbols() { DnaAlphabet alp = DnaAlphabet.Instance; Assert.IsTrue(alp.CompareSymbols(65, 65)); ApplicationLog.WriteLine( "Alphabets BVT: Validation of CompareSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of CompareSymbols() method completed successfully."); }
public void ValidateDnaAlphabetLookupAll() { DnaAlphabet alp = DnaAlphabet.Instance; List <ISequenceItem> itm = alp.LookupAll(true, true, true, true); Assert.AreEqual(15, itm.Count); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of LookupAll() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of LookupAll() method completed successfully."); }
public void ValidateDnaAlphabetLookupBySymbol() { DnaAlphabet alp = DnaAlphabet.Instance; ISequenceItem itm = alp.LookupBySymbol("A"); Assert.AreEqual('A', itm.Symbol); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of LookupBySymbol() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of LookupBySymbol() method completed successfully."); }
public void ValidateDnaAlphabetCopyTo() { ISequence seq = new Sequence(Alphabets.DNA, "AAAAAAAAAAAAAAAA"); DnaAlphabet alp = DnaAlphabet.Instance; ISequenceItem[] item = seq.ToArray(); alp.CopyTo(item, 0); Assert.AreEqual('A', item[0].Symbol); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of CopyTo() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of CopyTo() method completed successfully."); }
public void ValidateDnaAlphabetClear() { DnaAlphabet alp = DnaAlphabet.Instance; try { alp.Clear(); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine("Alphabets BVT: Validation of Clear() method completed successfully."); Console.WriteLine("Alphabets BVT: Validation of Clear() method completed successfully."); } }
public void InValidateDnaAlphabetRemove() { try { DnaAlphabet alp = DnaAlphabet.Instance; alp.Remove(null as ISequenceItem); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of Remove() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of Remove() method completed successfully."); } }
public void InValidateDnaAlphabetGetBasicSymbols() { DnaAlphabet alp = DnaAlphabet.Instance; try { alp.GetBasicSymbols(null); Assert.Fail(); } catch (ArgumentException) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of GetBasicSymbols() method completed successfully."); } }
public void ValidateDnaAlphabetAllProperties() { DnaAlphabet alp = DnaAlphabet.Instance; Assert.AreEqual(16, alp.Count); Assert.AreEqual('-', alp.DefaultGap.Symbol); Assert.IsTrue(alp.HasAmbiguity); Assert.IsTrue(alp.HasGaps); Assert.IsFalse(alp.HasTerminations); Assert.IsTrue(alp.IsReadOnly); Assert.AreEqual("DNA", alp.Name); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of All properties completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of All properties method completed successfully."); }
public void InValidateDnaAlphabetLookupBySymbol() { DnaAlphabet alp = DnaAlphabet.Instance; try { ISequenceItem itm = alp.LookupBySymbol(""); Assert.IsNotNull(itm); Assert.Fail(); } catch (ArgumentException) { // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets P2: Validation of LookupBySymbol() method completed successfully."); Console.WriteLine( "Alphabets P2: Validation of LookupBySymbol() method completed successfully."); } }
public void ValidateDnaAlphabetGetConsensusSymbol() { ISequence seq = new Sequence(Alphabets.DNA, "ATGCA"); DnaAlphabet alp = DnaAlphabet.Instance; HashSet <ISequenceItem> hashSet = new HashSet <ISequenceItem>(); foreach (ISequenceItem item in seq) { hashSet.Add(item); } Assert.IsNotNull(alp.GetConsensusSymbol(hashSet)); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); }
public void ValidateDnaAlphabetGetBasicSymbols() { ISequence seq = new Sequence(Alphabets.DNA, "AGCTB"); DnaAlphabet alp = DnaAlphabet.Instance; ISequenceItem item = seq[4]; Assert.IsNotNull(alp.GetBasicSymbols(item)); item = seq[3]; Assert.IsNotNull(alp.GetBasicSymbols(item)); item = seq[3]; Assert.IsNotNull(alp.GetBasicSymbols(item)); // Logs to the NUnit GUI window ApplicationLog.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); Console.WriteLine( "Alphabets BVT: Validation of GetBasicSymbols() method completed successfully."); }
public void TestDnaAlphabetTryGetComplementSymbol() { byte basicSymbols; DnaAlphabet dnaAlphabet = DnaAlphabet.Instance; Assert.AreEqual(true, dnaAlphabet.TryGetComplementSymbol((byte)'A', out basicSymbols)); Assert.AreEqual('T', (char)basicSymbols); Assert.AreEqual(true, dnaAlphabet.TryGetComplementSymbol((byte)'T', out basicSymbols)); Assert.AreEqual('A', (char)basicSymbols); Assert.AreEqual(true, dnaAlphabet.TryGetComplementSymbol((byte)'G', out basicSymbols)); Assert.AreEqual('C', (char)basicSymbols); Assert.AreEqual(true, dnaAlphabet.TryGetComplementSymbol((byte)'C', out basicSymbols)); Assert.AreEqual('G', (char)basicSymbols); Assert.AreEqual('G', (char)dnaAlphabet.GetSymbolValueMap()[(byte)'g']); Assert.IsTrue(dnaAlphabet.CompareSymbols((byte)'T', (byte)'t')); Assert.IsTrue(dnaAlphabet.CompareSymbols((byte)'t', (byte)'T')); Assert.AreEqual(dnaAlphabet.GetAmbiguousSymbols().Count, 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); }
public void ValidateDnaAlphabetAdd() { // Gets the actual sequence and the alphabet from the Xml string alphabetName = Utility._xmlUtil.GetTextValue(Constants.SimpleDnaAlphabetNode, Constants.AlphabetNameNode); string actualSequence = Utility._xmlUtil.GetTextValue(Constants.SimpleDnaAlphabetNode, Constants.ExpectedSingleChar); ISequence seq = new Sequence(Utility.GetAlphabet(alphabetName), actualSequence); DnaAlphabet alp = DnaAlphabet.Instance; try { alp.Add(seq[0]); Assert.Fail(); } catch (Exception) { // Logs to the NUnit GUI window ApplicationLog.WriteLine("Alphabets BVT: Validation of Add() method completed successfully."); Console.WriteLine("Alphabets BVT: Validation of Add() method completed successfully."); } }
private void InitializeAlignment() { DnaAlphabet dna = DnaAlphabet.Instance; }