/// <summary> /// Initializes the above defined fields. For each step in assembly /// we use a separate class for implementation. This method assigns /// these variables to classes with desired implementation. /// </summary> protected void InitializeDefaultGraphModifiers() { // Assign uninitialized fields to default values if (DanglingLinksPurger == null) { DanglingLinksPurger = new DanglingLinksPurger(); } if (RedundantPathsPurger == null) { RedundantPathsPurger = new RedundantPathsPurger(RedundantPathLengthThreshold); } if (LowCoverageContigPurger == null) { LowCoverageContigPurger = new SimplePathContigBuilder(); } }
/// <summary> /// Initializes a new instance of the ParallelDeNovoAssembler class. /// Sets thresholds to default values. /// Also initializes instances implementing different steps. /// </summary> public ParallelDeNovoAssembler() { ContigCoverageThreshold = -1; ErosionThreshold = -1; AllowErosion = false; // Initialize to default here. // Values set to -1 here will be reset based on input sequences. this.kmerLength = -1; DanglingLinksThreshold = -1; RedundantPathLengthThreshold = -1; this.sequenceReads = new List <ISequence>(); // Contig and scaffold Builder are required modules. Set this to default. ContigBuilder = new SimplePathContigBuilder(); // Default values for parameters used in building scaffolds. ScaffoldRedundancy = 2; Depth = 10; AllowKmerLengthEstimation = true; }
/// <summary> /// Initializes a new instance of the ParallelDeNovoAssembler class. /// Sets thresholds to default values. /// Also initializes instances implementing different steps. /// </summary> public ParallelDeNovoAssembler() { ContigCoverageThreshold = -1; ErosionThreshold = -1; AllowErosion = false; // Initialize to default here. // Values set to -1 here will be reset based on input sequences. this.kmerLength = -1; DanglingLinksThreshold = -1; RedundantPathLengthThreshold = -1; this.sequenceReads = new List<ISequence>(); // Contig and scaffold Builder are required modules. Set this to default. ContigBuilder = new SimplePathContigBuilder(); // Default values for parameters used in building scaffolds. ScaffoldRedundancy = 2; Depth = 10; AllowKmerLengthEstimation = true; }
/// <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"); }
/// <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"); }