/** Tests the weigthed matching */ public void TestMatchWeighted () { Gap gap = new Gap( "test", 1, 4, 1, new double[] { 0.5, 0.5, 0.5 }, 0.0 ); Sequence seq = new Sequence( AlphabetType.DNA, "actga" ); Match match = gap.Match( seq, 1 ); Assert.AreEqual( "a", match.Letters() ); Assert.AreEqual( 1.0, match.Similarity, 1e-1 ); }
/** Tests the matching with increment. */ public void TestMatchIncrement () { Gap gap = new Gap( "test", 1, 8, 1.7 ); Sequence seq = new Sequence( AlphabetType.DNA, "actgactg" ); Match match = gap.Match( seq, 1 ); Assert.AreEqual( "a", match.Letters() ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "act", match.Letters() ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "actg", match.Letters() ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "actgac", match.Letters() ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "actgactg", match.Letters() ); Assert.AreEqual( 1, gap.Increment ); }
/** Tests the weigthed matching */ public void TestMatchWeighted1 () { Gap gap = new Gap( "test", 1, 4, 1, new double[] { 1, 5, 10 }, 0.0 ); Sequence seq = new Sequence( AlphabetType.DNA, "actga" ); Match match = gap.Match( seq, 1 ); Assert.AreEqual( "a", match.Letters() ); Assert.AreEqual( 0.1, match.Similarity, 1e-1 ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "ac", match.Letters() ); Assert.AreEqual( 0.5, match.Similarity, 1e-1 ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "act", match.Letters() ); Assert.AreEqual( 1.0, match.Similarity, 1e-1 ); Assert.AreEqual( 0, gap.Increment ); match = gap.Match( seq, 1 ); Assert.AreEqual( "actg", match.Letters() ); Assert.AreEqual( 1.0, match.Similarity, 1e-1 ); Assert.AreEqual( 1, gap.Increment ); }