public void TestMatch() { Sequence seq = new Sequence(AlphabetType.DNA,"tttaagaacaagttt"); Motif motif = new Motif("motif", AlphabetType.DNA,"aag", 0.5); Iteration iteration; Match match; iteration = new Iteration("test",motif,1,3,0.0); match = iteration.Match(seq, 4); Assert.AreEqual(4, match.Start); Assert.AreEqual(9, match.Length); Assert.AreEqual(1, match.Strand); Assert.AreEqual("aagaacaag", match.Letters()); Assert.AreEqual(seq, match.BaseSequence); Assert.AreEqual(0.888, match.Similarity, 1e-3); iteration = new Iteration("test",motif,1,1,0.0); match = iteration.Match(seq, 4); Assert.AreEqual("aag", match.Letters()); Assert.AreEqual(1.0, match.Similarity, 1e-3); iteration = new Iteration("test",motif,1,2,0.0); match = iteration.Match(seq, 4); Assert.AreEqual("aagaac", match.Letters()); Assert.AreEqual(0.833, match.Similarity, 1e-3); iteration = new Iteration("test",motif,4,5,0.0); Assert.AreEqual(null, iteration.Match(seq, 4)); }
public void TestMatchVariablePattern() { Sequence seq = new Sequence(AlphabetType.DNA, "tttaagaacaagttt"); Gap gap = new Gap("gap", 1, 4, 1, new double[] { 0.0, 0.1, 1.0, 0.5 }, 0.0); Iteration iteration; Match match; iteration = new Iteration("test", gap, 1, 3, 0.0); match = iteration.Match(seq, 4); Assert.AreEqual("aagaacaag", match.Letters()); Assert.AreEqual(1.0, match.Similarity, 1e-3); }