public void BuildScaffold() { const int kmerLength = 6; const int dangleThreshold = 3; const int redundantThreshold = 7; List <ISequence> sequences = TestInputs.GetReadsForScaffolds(); KmerLength = kmerLength; SequenceReads.Clear(); this.AddSequenceReads(sequences); CreateGraph(); DanglingLinksThreshold = dangleThreshold; DanglingLinksPurger = new DanglingLinksPurger(dangleThreshold); RedundantPathLengthThreshold = redundantThreshold; RedundantPathsPurger = new RedundantPathsPurger(redundantThreshold); UnDangleGraph(); RemoveRedundancy(); IList <ISequence> contigs = BuildContigs(); CloneLibrary.Instance.AddLibrary("abc", (float)5, (float)20); GraphScaffoldBuilder scaffold = new GraphScaffoldBuilder(); IList <ISequence> scaffoldSeq = scaffold.BuildScaffold( sequences, contigs, this.KmerLength, 3, 0); Assert.AreEqual(scaffoldSeq.Count, 8); Assert.IsTrue(scaffoldSeq[0].ToString().Equals( "ATGCCTCCTATCTTAGCGCGC")); scaffold.Dispose(); }
public void AssemblerTestWithScaffoldBuilder() { const int kmerLength = 6; const int dangleThreshold = 3; const int redundantThreshold = 7; using (ParallelDeNovoAssembler assembler = new ParallelDeNovoAssembler()) { assembler.KmerLength = kmerLength; assembler.DanglingLinksThreshold = dangleThreshold; assembler.RedundantPathLengthThreshold = redundantThreshold; assembler.ScaffoldRedundancy = 0; assembler.Depth = 3; CloneLibrary.Instance.AddLibrary("abc", (float)5, (float)20); PaDeNAAssembly result = (PaDeNAAssembly)assembler.Assemble(TestInputs.GetReadsForScaffolds(), true); Assert.AreEqual(10, result.ContigSequences.Count); HashSet <string> expectedContigs = new HashSet <string> { "GCGCGC", "TTTTTT", "TTTTTA", "TTTTAA", "TTTAAA", "ATGCCTCCTATCTTAGC", "TTTTAGC", "TTAGCGCG", "CGCGCCGCGC", "CGCGCG" }; foreach (ISequence contig in result.ContigSequences) { string contigSeq = contig.ToString(); Assert.IsTrue( expectedContigs.Contains(contigSeq) || expectedContigs.Contains(contigSeq.GetReverseComplement(new char[contigSeq.Length]))); } Assert.AreEqual(8, result.Scaffolds.Count); HashSet <string> expectedScaffolds = new HashSet <string> { "ATGCCTCCTATCTTAGCGCGC", "TTTTTT", "TTTTTA", "TTTTAA", "TTTAAA", "CGCGCCGCGC", "TTTTAGC", "CGCGCG" }; foreach (ISequence scaffold in result.Scaffolds) { string scaffoldSeq = scaffold.ToString(); Assert.IsTrue( expectedScaffolds.Contains(scaffoldSeq) || expectedScaffolds.Contains(scaffoldSeq.GetReverseComplement(new char[scaffoldSeq.Length]))); } } }