Beispiel #1
0
        public void TestStreamingPersistentSegmentedSequence()
        {
            string            sequenceString   = "AAATTGGC";
            Sequence          sequence         = new Sequence(Alphabets.Protein, sequenceString);
            SegmentedSequence segmentedSequece = new SegmentedSequence(sequence);

            sequenceString = "ANANA";
            sequence       = new Sequence(Alphabets.Protein, sequenceString);
            segmentedSequece.Sequences.Add(sequence);

            using (SimpleSuffixTreeBuilder simpleSuffixTreeBuilder = new SimpleSuffixTreeBuilder())
            {
                simpleSuffixTreeBuilder.PersistenceThreshold = 0;

                ISuffixTree persistentSuffixTree = simpleSuffixTreeBuilder.BuildSuffixTree(segmentedSequece);

                string   queryString   = "AATTNANAGGC";
                Sequence querySequence = new Sequence(Alphabets.Protein, queryString);

                IList <MaxUniqueMatch> MUMs = simpleSuffixTreeBuilder.FindMatches(persistentSuffixTree, querySequence, 3);

                // Verify the count of MUMs found
                Assert.AreEqual(3, MUMs.Count);
            }
        }
Beispiel #2
0
        public void TestInMemorySimpleSequence()
        {
            string   sequenceString = "BANANA";
            Sequence sequence       = new Sequence(Alphabets.Protein, sequenceString);

            using (SimpleSuffixTreeBuilder simpleSuffixTreeBuilder = new SimpleSuffixTreeBuilder())
            {
                IMultiWaySuffixTree inMemorySuffixTree = simpleSuffixTreeBuilder.BuildSuffixTree(sequence) as IMultiWaySuffixTree;

                // Verify the edges in Suffix Tree
                Assert.AreEqual(7, inMemorySuffixTree.Count);

                // Verify the sequence in Suffix Tree
                Assert.AreEqual(inMemorySuffixTree.Sequence.ToString(), sequenceString);
            }
        }
Beispiel #3
0
        public void TestStreamingInMemorySimpleSequence()
        {
            string   sequenceString = "AGTATGCCCCCCCCCCTGCCG";
            Sequence sequence       = new Sequence(Alphabets.Protein, sequenceString);

            using (SimpleSuffixTreeBuilder simpleSuffixTreeBuilder = new SimpleSuffixTreeBuilder())
            {
                ISuffixTree inMemorySuffixTree = simpleSuffixTreeBuilder.BuildSuffixTree(sequence);

                string   queryString   = "CCCCCCCCTATG";
                Sequence querySequence = new Sequence(Alphabets.Protein, queryString);

                IList <MaxUniqueMatch> MUMs = simpleSuffixTreeBuilder.FindMatches(inMemorySuffixTree, querySequence, 3);

                // Verify the count of MUMs found
                Assert.AreEqual(2, MUMs.Count);
            }
        }
Beispiel #4
0
        public void TestPersistentSimpleSequence()
        {
            string   sequenceString = "BANANA";
            Sequence sequence       = new Sequence(Alphabets.Protein, sequenceString);

            using (SimpleSuffixTreeBuilder simpleSuffixTreeBuilder = new SimpleSuffixTreeBuilder())
            {
                simpleSuffixTreeBuilder.PersistenceThreshold = 0;

                IMultiWaySuffixTree persistentSuffixTree = simpleSuffixTreeBuilder.BuildSuffixTree(sequence) as IMultiWaySuffixTree;

                // Verify the edges in Suffix Tree
                Assert.AreEqual(7, persistentSuffixTree.Count);

                // Verify the sequence in Suffix Tree
                Assert.AreEqual(persistentSuffixTree.Sequence.ToString(), sequenceString);
            }
        }
Beispiel #5
0
        public void TestFindMaximumMatchPersistentInSequence()
        {
            string   sequenceString = "BANANA";
            Sequence sequence       = new Sequence(Alphabets.Protein, sequenceString);

            using (SimpleSuffixTreeBuilder simpleSuffixTreeBuilder = new SimpleSuffixTreeBuilder())
            {
                simpleSuffixTreeBuilder.PersistenceThreshold = 0;
                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);
            }
        }