public void PathPurger1() { const int KmerLength = 7; ISequence sequence = new Sequence(Alphabets.DNA, "GATTCAAGGGCTGGGGG"); IList <ISequence> contigsSequence = SequenceToKmerBuilder.GetKmerSequences(sequence, KmerLength).ToList(); ContigGraph graph = new ContigGraph(); graph.BuildContigGraph(contigsSequence, KmerLength); List <Node> contigs = graph.Nodes.ToList(); IList <ScaffoldPath> paths = new List <ScaffoldPath>(); ScaffoldPath path = new ScaffoldPath(); foreach (Node node in contigs) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(2, 5)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(3, 5)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(6, 5)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(0, 11)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(7, 4)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(11, 0)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(2, 9)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(1, 10)) { path.Add(new KeyValuePair <Node, Edge>(node, null)); } paths.Add(path); PathPurger assembler = new PathPurger(); assembler.PurgePath(paths); Assert.AreEqual(paths.Count, 1); Assert.IsTrue(Compare(paths.First(), contigs)); }
public void PathPurger1() { const int kmerLength = 7; List <ISequence> sequences = new List <ISequence>(); sequences.Add(new Sequence(Alphabets.DNA, "GATTCAAGGGCTGGGGG")); this.KmerLength = kmerLength; this.AddSequenceReads(sequences); this.CreateGraph(); List <DeBruijnNode> contigs = this.Graph.Nodes.ToList(); IList <ScaffoldPath> paths = new List <ScaffoldPath>(); ScaffoldPath path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(2, 5)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(3, 5)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(6, 5)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(0, 11)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(7, 4)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(11, 0)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(2, 9)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); path = new ScaffoldPath(); foreach (DeBruijnNode node in contigs.GetRange(1, 10)) { path.Add(new KeyValuePair <DeBruijnNode, DeBruijnEdge>(node, null)); } paths.Add(path); PathPurger assembler = new PathPurger(); assembler.PurgePath(paths); Assert.AreEqual(paths.Count, 1); Assert.IsTrue(Compare(paths.First(), contigs)); }
public void ValidateBuildSequenceFromPath() { const int KmerLength = 7; ISequence sequence = new Sequence(Alphabets.DNA, "GATTCAAGGGCTGGGGG"); ISequence sequenceNew; IList<ISequence> contigsSequence = SequenceToKmerBuilder.GetKmerSequences(sequence, KmerLength).ToList(); using (ContigGraph graph = new ContigGraph()) { graph.BuildContigGraph(contigsSequence, KmerLength); List<Node> contigs = graph.Nodes.ToList(); ScaffoldPath path = new ScaffoldPath(); foreach (Node node in contigs.GetRange(0, 11)) { path.Add(new KeyValuePair<Node, Edge>(node, new Edge(true))); } sequenceNew = path.BuildSequenceFromPath(graph, KmerLength); } Assert.IsNotNull(sequenceNew); Assert.AreEqual((new string(sequenceNew.Select(a => (char)a).ToArray())), "GATTCAAGGGCTGGGGG"); }