示例#1
0
        public void BuildScaffold()
        {
            const int        kmerLength         = 6;
            const int        dangleThreshold    = 3;
            const int        redundantThreshold = 7;
            List <ISequence> sequences          = new List <ISequence>(TestInputs.GetReadsForScaffolds());

            KmerLength = kmerLength;
            SequenceReads.Clear();
            this.SetSequenceReads(sequences);
            CreateGraph();
            DanglingLinksThreshold       = dangleThreshold;
            DanglingLinksPurger          = new DanglingLinksPurger(dangleThreshold);
            RedundantPathLengthThreshold = redundantThreshold;
            RedundantPathsPurger         = new RedundantPathsPurger(redundantThreshold);
            UnDangleGraph();
            RemoveRedundancy();

            IList <ISequence> contigs = BuildContigs().ToList();

            Assert.AreEqual(contigs.Count, 10);
            CloneLibrary.Instance.AddLibrary("abc", (float)5, (float)20);
            GraphScaffoldBuilder    scaffold    = new GraphScaffoldBuilder();
            IEnumerable <ISequence> scaffoldSeq = scaffold.BuildScaffold(
                sequences, contigs, this.KmerLength, 3, 0);

            Assert.AreEqual(scaffoldSeq.Count(), 8);
            Assert.IsTrue(new string(scaffoldSeq.First().Select(a => (char)a).ToArray()).Equals(
                              "ATGCCTCCTATCTTAGCGCGC"));
            scaffold.Dispose();
        }
示例#2
0
        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", 5, 20);

                PadenaAssembly result = (PadenaAssembly)assembler.Assemble(TestInputs.GetReadsForScaffolds(), true);

                HashSet <string> expectedContigs = new HashSet <string>
                {
                    "TTTTTT", "CGCGCG", "TTAGCGCG", "CGCGCCGCGC", "GCGCGC", "TTTTTA", "TTTTAA", "TTTAAA", "TTTTAGC", "ATGCCTCCTATCTTAGC"
                };

                AlignmentHelpers.CompareSequenceLists(expectedContigs, result.ContigSequences);

                HashSet <string> expectedScaffolds = new HashSet <string>
                {
                    "ATGCCTCCTATCTTAGCGCGC", "TTTAAA", "TTTTTT", "TTTTAGC", "TTTTAA", "CGCGCCGCGC", "TTTTTA", "CGCGCG"
                };

                AlignmentHelpers.CompareSequenceLists(expectedScaffolds, result.Scaffolds);
            }
        }
示例#3
0
        public void BuildScaffold()
        {
            const int kmerLength         = 6;
            const int dangleThreshold    = 3;
            const int redundantThreshold = 7;
            var       sequences          = new List <ISequence>(TestInputs.GetReadsForScaffolds());

            KmerLength = kmerLength;
            SequenceReads.Clear();
            this.SetSequenceReads(sequences);
            CreateGraph();

            DanglingLinksThreshold       = dangleThreshold;
            DanglingLinksPurger          = new DanglingLinksPurger(dangleThreshold);
            RedundantPathLengthThreshold = redundantThreshold;
            RedundantPathsPurger         = new RedundantPathsPurger(redundantThreshold);
            UnDangleGraph();
            RemoveRedundancy();

            IList <ISequence> contigs = BuildContigs().ToList();

            CloneLibrary.Instance.AddLibrary("abc", 5, 20);

            using (GraphScaffoldBuilder scaffold = new GraphScaffoldBuilder())
            {
                IEnumerable <ISequence> scaffoldSeq = scaffold.BuildScaffold(sequences, contigs, this.KmerLength, 3, 0);
                HashSet <string>        expected    = new HashSet <string>
                {
                    "ATGCCTCCTATCTTAGCGCGC", "CGCGCCGCGC", "TTTTTT", "CGCGCG", "TTTTAGC", "TTTTTA", "TTTAAA", "TTTTAA",
                };
                AlignmentHelpers.CompareSequenceLists(expected, scaffoldSeq);
            }
        }
示例#4
0
        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 = new string(contig.Select(a => (char)a).ToArray());
                    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 = new string(scaffold.Select(a => (char)a).ToArray());
                    Assert.IsTrue(
                        expectedScaffolds.Contains(scaffoldSeq) ||
                        expectedScaffolds.Contains(scaffoldSeq.GetReverseComplement(new char[scaffoldSeq.Length])));
                }
            }
        }