Exemple #1
0
        /// <summary>
        /// Validate the SimpleContigBuilder Build() method using step 4 graph
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        /// <param name="isChromosomeRC">Is Chromosome RC?</param>
        internal void ValidateSimpleContigBuilderBuild(string nodeName, bool isChromosomeRC)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.FilePathNode);
            string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.KmerLengthNode);
            string expectedContigsString = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.ContigsNode);
            string[] expectedContigs = expectedContigsString.Split(',');
            string expectedContigsCount = utilityObj.xmlUtil.GetTextValue(nodeName,
              Constants.ContigsCount);

            // Get the input reads and build kmers
            IEnumerable<ISequence> sequenceReads = null;
            using (FastAParser parser = new FastAParser(filePath))
            {
                sequenceReads = parser.Parse();

                // Build kmers from step1,graph in step2 
                // Remove the dangling links from graph in step3
                // Remove bubbles from graph in step4
                this.KmerLength = int.Parse(kmerLength, (IFormatProvider)null);
                this.SequenceReads.Clear();
                this.SetSequenceReads(sequenceReads.ToList());
                this.CreateGraph();
                DeBruijnGraph graph = this.Graph;
                this.UnDangleGraph();
                this.RemoveRedundancy();

                // Validate the SimpleContigBuilder.Build() by passing graph
                SimplePathContigBuilder builder = new SimplePathContigBuilder();
                IList<ISequence> contigs = builder.Build(graph).ToList();

                if (isChromosomeRC)
                {
                    Assert.AreEqual(expectedContigsCount,
                        contigs.Count.ToString((IFormatProvider)null));
                }
                else
                {
                    // Validate the contigs
                    for (int index = 0; index < contigs.Count; index++)
                    {
                        Assert.IsTrue(expectedContigs.Contains(new string(contigs[index].Select(a => (char)a).ToArray())));
                    }
                }
            }
            ApplicationLog.WriteLine(@"Padena P1 :SimpleContigBuilder.BuildContigs() validation for Padena step5 completed successfully");
        }
Exemple #2
0
        /// <summary>
        /// Validate the SimpleContigBuilder Build() method using step 4 graph
        /// </summary>
        /// <param name="nodeName">xml node name used for different testcases</param>
        internal void ValidateSimpleContigBuilderBuild(string nodeName)
        {
            string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
            string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.KmerLengthNode);
            string expectedContigsString =
                utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ContigsNode);
            string[] expectedContigs = expectedContigsString.Split(',');

            // Get the input reads and build kmers
            IEnumerable<ISequence> sequenceReads = null;
            FastAParser parser = new FastAParser();
                parser.Open( filePath.Replace("\\", System.IO.Path.DirectorySeparatorChar.ToString()));
                sequenceReads = parser.Parse().ToList();
                parser.Close();

                // Build kmers from step1,graph in step2 
                // Remove the dangling links from graph in step3
                // Remove bubbles from graph in step4
                this.KmerLength = int.Parse(kmerLength, (IFormatProvider)null);
                this.SequenceReads.Clear();

                this.SetSequenceReads(sequenceReads.ToList());
                this.CreateGraph();
                this.UnDangleGraph();
                this.RedundantPathsPurger =
                    new RedundantPathsPurger(int.Parse(kmerLength, (IFormatProvider)null) + 1);
                this.RemoveRedundancy();

                // Validate the SimpleContigBuilder.Build() by passing graph
                SimplePathContigBuilder builder = new SimplePathContigBuilder();
                IEnumerable<ISequence> contigs = builder.Build(this.Graph);

                // Validate the contigs
                for (int index = 0; index < contigs.Count(); index++)
                {
                    Assert.IsTrue(expectedContigs.Contains(
                         new string(contigs.ToList()[index].Select(a => (char)a).ToArray())));
                }


            ApplicationLog.WriteLine(
                @"Padena BVT :SimpleContigBuilder.BuildContigs() validation for 
                    Padena step5 completed successfully");
        }