public void TestRedundantPathsPurger() { const int KmerLength = 5; const int RedundantThreshold = 10; List <ISequence> readSeqs = TestInputs.GetRedundantPathReads(); this.SequenceReads.Clear(); this.SetSequenceReads(readSeqs); this.KmerLength = KmerLength; this.RedundantPathLengthThreshold = RedundantThreshold; this.RedundantPathsPurger = new RedundantPathsPurger(RedundantThreshold); this.CreateGraph(); long graphCount = this.Graph.NodeCount; long graphEdges = this.Graph.GetNodes().Select(n => n.ExtensionsCount).Sum(); this.RemoveRedundancy(); long redundancyRemovedGraphCount = this.Graph.NodeCount; long redundancyRemovedGraphEdge = this.Graph.GetNodes().Select(n => n.ExtensionsCount).Sum(); // Compare the two graphs Assert.AreEqual(5, graphCount - redundancyRemovedGraphCount); Assert.AreEqual(12, graphEdges - redundancyRemovedGraphEdge); }
public void TestContigBuilder2() { const int KmerLength = 6; const int RedundantThreshold = 10; List <ISequence> readSeqs = TestInputs.GetRedundantPathReads(); SequenceReads.Clear(); this.SetSequenceReads(readSeqs); this.KmerLength = KmerLength; RedundantPathLengthThreshold = RedundantThreshold; RedundantPathsPurger = new RedundantPathsPurger(RedundantThreshold); ContigBuilder = new SimplePathContigBuilder(); CreateGraph(); RemoveRedundancy(); long graphCount = Graph.NodeCount; long graphEdges = Graph.GetNodes().Select(n => n.ExtensionsCount).Sum(); IEnumerable <ISequence> contigs = BuildContigs(); long contigsBuiltGraphCount = Graph.NodeCount; long contigsBuilt = Graph.GetNodes().Select(n => n.ExtensionsCount).Sum(); // Compare the two graphs Assert.AreEqual(1, contigs.Count()); string s = new string(contigs.ElementAt(0).Select(a => (char)a).ToArray()); Assert.AreEqual("ATGCCTCCTATCTTAGCGATGCGGTGT", s); Assert.AreEqual(graphCount, contigsBuiltGraphCount); Assert.AreEqual(graphEdges, contigsBuilt); }