/// <summary> /// Traverse the suffix tree using query sequence and return list of MUMs. /// Note: If MaximumMatchEnabled property is true, then MUMs are generated irrespective /// of uniqueness in query and reference sequences; else MUMs are unique in reference /// sequence only. /// </summary> /// <param name="suffixTree">Suffix Tree</param> /// <param name="referenceSequence">Reference sequence</param> /// <param name="sequence">Query Sequence</param> /// <param name="lengthOfMUM">Minimum length of MUM</param> /// <returns>List of MUMs</returns> protected override IList <MaxUniqueMatch> Streaming( ISuffixTree suffixTree, ISequence referenceSequence, ISequence sequence, long lengthOfMUM) { ISuffixTreeBuilder suffixTreeBuilder = Factory.CreateNew(referenceSequence); if (MaximumMatchEnabled) { return(suffixTreeBuilder.FindMaximumMatches(suffixTree, sequence, lengthOfMUM)); } return(suffixTreeBuilder.FindMatches(suffixTree, sequence, lengthOfMUM)); }
public void TestFindMaximumMatchInSequence() { string sequenceString = "BANANA"; Sequence sequence = new Sequence(Alphabets.Protein, sequenceString); using (SimpleSuffixTreeBuilder simpleSuffixTreebldr = new SimpleSuffixTreeBuilder()) { ISuffixTreeBuilder simpleSuffixTreeBuilder = simpleSuffixTreebldr; ISuffixTree simpleSuffixTree = simpleSuffixTreeBuilder.BuildSuffixTree(sequence); string queryString = "ANA"; Sequence querySequence = new Sequence(Alphabets.Protein, queryString); IList <MaxUniqueMatch> MUMs = simpleSuffixTreeBuilder.FindMaximumMatches(simpleSuffixTree, querySequence, 3); // Verify the count of MUMs found Assert.AreEqual(1, MUMs.Count); simpleSuffixTreeBuilder = null; } }