コード例 #1
0
        public void TestContigBuilder2()
        {
            const int KmerLength         = 6;
            const int RedundantThreshold = 10;

            List <ISequence> readSeqs = TestInputs.GetRedundantPathReads();

            SequenceReads.Clear();
            this.AddSequenceReads(readSeqs);
            this.KmerLength = KmerLength;
            RedundantPathLengthThreshold = RedundantThreshold;
            RedundantPathsPurger         = new RedundantPathsPurger(RedundantThreshold);
            ContigBuilder = new SimplePathContigBuilder();

            CreateGraph();
            RemoveRedundancy();
            int graphCount = Graph.Nodes.Count;
            int graphEdges = Graph.Nodes.Select(n => n.ExtensionsCount).Sum();

            IList <ISequence> contigs  = BuildContigs();
            int contigsBuiltGraphCount = Graph.Nodes.Count;
            int contigsBuilt           = Graph.Nodes.Select(n => n.ExtensionsCount).Sum();

            // Compare the two graphs
            Assert.AreEqual(1, contigs.Count);
            Assert.AreEqual("ATGCCTCCTATCTTAGCGATGCGGTGT", contigs[0].ToString());
            Assert.AreEqual(graphCount, contigsBuiltGraphCount);
            Assert.AreEqual(graphEdges, contigsBuilt);
        }
コード例 #2
0
        public void TestRedundantPathsPurger()
        {
            const int KmerLength         = 5;
            const int RedundantThreshold = 10;

            List <ISequence> readSeqs = TestInputs.GetRedundantPathReads();

            this.SequenceReads.Clear();
            this.AddSequenceReads(readSeqs);
            this.KmerLength = KmerLength;
            this.RedundantPathLengthThreshold = RedundantThreshold;
            this.RedundantPathsPurger         = new RedundantPathsPurger(RedundantThreshold);

            this.CreateGraph();
            int graphCount = this.Graph.Nodes.Count;
            int graphEdges = this.Graph.Nodes.Select(n => n.ExtensionsCount).Sum();

            this.RemoveRedundancy();
            int redundancyRemovedGraphCount = this.Graph.Nodes.Count;
            int redundancyRemovedGraphEdge  = this.Graph.Nodes.Select(n => n.ExtensionsCount).Sum();

            // Compare the two graphs
            Assert.AreEqual(5, graphCount - redundancyRemovedGraphCount);
            Assert.AreEqual(12, graphEdges - redundancyRemovedGraphEdge);
        }
コード例 #3
0
        public void TestContigGraphBuilder2()
        {
            const int KmerLength         = 6;
            const int RedundantThreshold = 10;

            List <ISequence> readSeqs = TestInputs.GetRedundantPathReads();

            this.SequenceReads.Clear();
            this.AddSequenceReads(readSeqs);
            this.KmerLength = KmerLength;
            this.RedundantPathLengthThreshold = RedundantThreshold;
            this.RedundantPathsPurger         = new RedundantPathsPurger(RedundantThreshold);
            this.ContigBuilder = new SimplePathContigBuilder();

            this.CreateGraph();
            this.RemoveRedundancy();
            IList <ISequence> contigs = this.BuildContigs();

            this.Graph.BuildContigGraph(contigs, KmerLength);

            int contigGraphCount = this.Graph.Nodes.Count;
            int contigGraphEdges = this.Graph.Nodes.Select(n => n.ExtensionsCount).Sum();

            Assert.AreEqual(contigs.Count, contigGraphCount);
            Assert.AreEqual(0, contigGraphEdges);
            HashSet <string> contigSeqs = new HashSet <string>(contigs.Select(c => c.ToString()));

            foreach (DeBruijnNode node in this.Graph.Nodes)
            {
                Assert.IsTrue(contigSeqs.Contains(this.Graph.GetNodeSequence(node).ToString()));
            }
        }