public void SimpleFindOneOutputPatternTest() { ISequence sequence = new Sequence(DnaAlphabet.Instance, "AGCT"); IPatternFinder patternFinder = new BoyerMoore(); IList<int> actual = patternFinder.FindMatch(sequence, "AGCT"); HashSet<int> expected = new HashSet<int>(); expected.Add(0); Assert.IsTrue(Compare(expected, actual)); }
public void BoyerMooreAlignDnaSequenceWith1000BP() { var boyerMoore = new BoyerMoore(); string boyerMooreSequence = utilityObj.xmlUtil.GetTextValue(Constants.BoyerMooreSequence, Constants.SequenceNode); string referenceSequence = utilityObj.xmlUtil.GetTextValue(Constants.BoyerMooreSequence, Constants.SearchSequenceNode); string expectedMatch = utilityObj.xmlUtil.GetTextValue(Constants.BoyerMooreSequence, Constants.ExpectedMatch); ISequence boyerMooreSeq = new Sequence(Alphabets.DNA, boyerMooreSequence); IList<int> indexList = boyerMoore.FindMatch(boyerMooreSeq, referenceSequence); Assert.AreEqual(expectedMatch, indexList[0].ToString((IFormatProvider) null)); }
public void MultipleFindOneOutputPatternTest() { ISequence sequence = new Sequence(DnaAlphabet.Instance, "AGCTAGGTTGGCC"); IList<string> patterns = new List<string>(); patterns.Add("AGCT"); patterns.Add("AAAAA"); IPatternFinder patternFinder = new BoyerMoore(); IDictionary<string, IList<int>> actual = patternFinder.FindMatch(sequence, patterns); IDictionary<string, HashSet<int>> expected = new Dictionary<string, HashSet<int>>(); HashSet<int> indices = new HashSet<int>(); indices.Add(0); expected.Add("AGCT", indices); indices = new HashSet<int>(); expected.Add("AAAAA", indices); Assert.IsTrue(Compare(expected, actual)); }
public void MatchWildcardPatternMiddle() { ISequence sequence = new Sequence(DnaAlphabet.Instance, "AGCTAGGTAGCTCAAAAAAGGG"); IPatternFinder patternFinder = new BoyerMoore(); IList<int> actual = patternFinder.FindMatch(sequence, "AGCTAGGTAGCTCA*GGG"); HashSet<int> expected = new HashSet<int>(); expected.Add(0); Assert.IsTrue(Compare(expected, actual)); }