public void MotifTestMatch () { Sequence seq = new Sequence( AlphabetType.DNA, "aTtga" ); Motif motif = new Motif( "test", AlphabetType.DNA, "tgn", 0.0 ); Match match = motif.Match( seq, 3 ); Assert.AreEqual( 3, match.Start ); Assert.AreEqual( 3, match.Length ); Assert.AreEqual( 1, match.Strand ); Assert.AreEqual( 1.0, match.Similarity, 1e-2 ); match = motif.Match( seq, 2 ); Assert.AreEqual( 2, match.Start ); Assert.AreEqual( 3, match.Length ); Assert.AreEqual( 1, match.Strand ); Assert.AreEqual( 0.66, match.Similarity, 1e-2 ); }
public void MotifTestTwoMatches () { Sequence seq = new Sequence( AlphabetType.DNA, "aTtgattgaca" ); Motif motif = new Motif( "test", AlphabetType.DNA, "attg", 0.0 ); Match match = motif.Match( seq, 1 ); Assert.AreEqual( 1, match.Start ); Assert.AreEqual( 4, match.Length ); Assert.AreEqual( 1, match.Strand ); Assert.AreEqual( 1.0, match.Similarity, 1e-2 ); Assert.AreEqual( "attg", match.Letters() ); Match match2 = motif.Match( seq, 2 ); Assert.AreEqual( 2, match.Start ); Assert.AreEqual( 4, match.Length ); Assert.AreEqual( 1, match.Strand ); Assert.AreEqual( 0.25, match.Similarity, 1e-2 ); Assert.AreEqual( "ttga", match.Letters() ); }
public void MotifTestMatchSimiliarity () { Sequence seq = new Sequence(AlphabetType.DNA, "aCtG", true); Assert.AreEqual(2, (new Motif("test", AlphabetType.DNA, "ct", 0)).Match(seq, 1).Length); Assert.AreEqual(3, (new Motif("test", AlphabetType.DNA, "ct", 0)).Match(seq, 3).Start); Assert.AreEqual(0.0, (new Motif("test", AlphabetType.DNA, "ct", 0)).Match(seq, 1).Similarity); Assert.AreEqual(0.5, (new Motif("test", AlphabetType.DNA, "cc", 0)).Match(seq, 1).Similarity, 1e-3); Assert.AreEqual(1.0, (new Motif("test", AlphabetType.DNA, "ct", 0)).Match(seq, 2).Similarity, 1e-3); Assert.AreEqual(0.0, (new Motif("test", AlphabetType.DNA, "ct", 0)).Match(seq, 3).Similarity, 1e-3); Assert.AreEqual(1.0, (new Motif("test", AlphabetType.DNA, "ctga", 0)).Match(seq, 2).Similarity, 1e-3); Motif seq1 = new Motif("test", AlphabetType.DNA, "cc", 0.6); Assert.AreEqual(null, seq1.Match(seq, 1)); }
public void MotifTestMatchAlternatives () { Sequence seq = new Sequence(AlphabetType.DNA, "atgc"); Motif motif = new Motif("test", AlphabetType.DNA,"[ga]tg[c]", 0.0); Match match = motif.Match(seq, 1); Assert.AreEqual(1.0, match.Similarity, 1e-2); }