本文整理汇总了C#中Bio.IO.FastA.FastAParser.Open方法的典型用法代码示例。如果您正苦于以下问题:C# FastAParser.Open方法的具体用法?C# FastAParser.Open怎么用?C# FastAParser.Open使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bio.IO.FastA.FastAParser
的用法示例。
在下文中一共展示了FastAParser.Open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFastaWhenParsingOneOfMany
public void TestFastaWhenParsingOneOfMany()
{
// parse
string filepath = System.IO.Path.Combine("TestUtils","Fasta","5_sequences.fasta");
FastAParser parser = new FastAParser { Alphabet = Alphabets.Protein };
using (parser.Open(filepath))
{
int[] sequenceCountArray = { 27, 29, 30, 35, 32 };
int i = 0;
foreach (ISequence seq in parser.Parse())
{
Assert.IsNotNull(seq);
Assert.AreEqual(seq.Count, sequenceCountArray[i]);
i++;
}
}
}
示例2: ValidateReadContigMap
public void ValidateReadContigMap()
{
// Read all the input sequences from xml config file
string filePath = utilityObj.xmlUtil.GetTextValue(Constants.SmallChromosomeReadsNode,
Constants.FilePathNode);
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser ();
parser.Open( filePath.Replace("\\", System.IO.Path.DirectorySeparatorChar.ToString()));
sequenceReads = parser.Parse().ToList();
parser.Close ();
ReadContigMap map = new ReadContigMap(sequenceReads);
Assert.IsNotNull(map);
for (int i = 0; i < 10; i++)
{
Assert.IsTrue(map.ContainsKey(sequenceReads.ElementAt(0).ID));
}
}
示例3: FastAParserValidateParseWithAlphabetAsProperty
public void FastAParserValidateParseWithAlphabetAsProperty()
{
string filePath = utilityObj.xmlUtil.GetTextValue(Constants.SimpleFastaDnaNodeName, Constants.FilePathNode);
Assert.IsTrue(File.Exists(filePath));
ApplicationLog.WriteLine(string.Format("FastA Parser : File Exists in the Path '{0}'.", filePath));
var parserObj = new FastAParser();
using (parserObj.Open(filePath))
{
parserObj.Alphabet = Utility.GetAlphabet(utilityObj.xmlUtil.GetTextValue(Constants.SimpleFastaDnaNodeName,
Constants.AlphabetNameNode));
ValidateParserGeneralTestCases(parserObj);
}
}
示例4: ValidatePadenaAssembledSeqs
/// <summary>
/// Validate Parallel Denovo Assembly Assembled sequences.
/// </summary>
/// <param name="nodeName">XML node used to validate different test scenarios</param>
internal void ValidatePadenaAssembledSeqs(string nodeName)
{
// Get values from XML node.
string filePath = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.KmerLengthNode);
string daglingThreshold = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.DanglingLinkThresholdNode);
string redundantThreshold = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.RedundantThreshold);
string libraray = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.LibraryName);
string stdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.StdDeviation);
string mean = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.Mean);
string assembledSequences = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.SequencePathNode);
string assembledSeqCount = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.AssembledSeqCountNode);
string[] updatedAssembledSeqs = assembledSequences.Split(',');
// Get the input reads and build kmers
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Create a ParallelDeNovoAssembler instance.
ParallelDeNovoAssembler denovoObj = null;
try
{
denovoObj = new ParallelDeNovoAssembler();
denovoObj.KmerLength = Int32.Parse(kmerLength, (IFormatProvider)null);
denovoObj.DanglingLinksThreshold = Int32.Parse(daglingThreshold, (IFormatProvider)null);
denovoObj.RedundantPathLengthThreshold = Int32.Parse(redundantThreshold, (IFormatProvider)null);
CloneLibrary.Instance.AddLibrary(libraray, float.Parse(mean, (IFormatProvider)null),
float.Parse(stdDeviation, (IFormatProvider)null));
byte[] symbols = sequenceReads.ElementAt(0).Alphabet.GetSymbolValueMap();
IDeNovoAssembly assembly =
denovoObj.Assemble(sequenceReads.Select(a => new Sequence(Alphabets.DNA, a.Select(b => symbols[b]).ToArray()) { ID = a.ID }), true);
IList<ISequence> assembledSequenceList = assembly.AssembledSequences.ToList();
// Validate assembled sequences.
Assert.AreEqual(assembledSeqCount, assembledSequenceList.Count.ToString((IFormatProvider)null));
for (int i = 0; i < assembledSequenceList.Count; i++)
{
Assert.IsTrue(assembledSequences.Contains(
new string(assembledSequenceList[i].Select(a => (char)a).ToArray()))
|| updatedAssembledSeqs.Contains(
new string(assembledSequenceList[i].GetReverseComplementedSequence().Select(a => (char)a).ToArray())));
}
}
finally
{
if (denovoObj != null)
denovoObj.Dispose();
}
ApplicationLog.WriteLine("Padena P1 : Assemble() validation for Padena step6:step7 completed successfully");
}
示例5: ValidateScaffoldPath
/// <summary>
/// Validate scaffold paths for a given input reads.
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
internal void ValidateScaffoldPath(string nodeName)
{
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.KmerLengthNode);
string daglingThreshold = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.DanglingLinkThresholdNode);
string redundantThreshold = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.RedundantThreshold);
string[] expectedScaffoldNodes = utilityObj.xmlUtil.GetTextValues(nodeName,Constants.ScaffoldNodes);
string libraray = utilityObj.xmlUtil.GetTextValue(nodeName,Constants.LibraryName);
string stdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,Constants.StdDeviation);
string mean = utilityObj.xmlUtil.GetTextValue(nodeName,Constants.Mean);
string expectedDepth = utilityObj.xmlUtil.GetTextValue(nodeName,Constants.DepthNode);
// Get the input reads and build kmers
FastAParser parser = new FastAParser();
parser.Open(filePath);
IEnumerable<ISequence> sequenceReads = parser.Parse().ToList();
parser.Close ();
// Build kmers from step1,graph in step2
// Remove the dangling links from graph in step3
// Remove bubbles form the graph in step4
// Pass the graph and build contigs
// Validate contig reads
this.KmerLength = Int32.Parse(kmerLength, null);
this.DanglingLinksThreshold = Int32.Parse(daglingThreshold, null);
this.DanglingLinksPurger = new DanglingLinksPurger(Int32.Parse(daglingThreshold, null));
this.RedundantPathsPurger = new RedundantPathsPurger(Int32.Parse(redundantThreshold, null));
this.RedundantPathLengthThreshold = Int32.Parse(redundantThreshold, null);
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
this.CreateGraph();
ContigGraph graph = new ContigGraph();
this.UnDangleGraph();
// Build contig.
this.ContigBuilder = new SimplePathContigBuilder();
this.RemoveRedundancy();
IEnumerable<ISequence> contigs = this.BuildContigs();
IList<ISequence> sortedContigs = SortContigsData(contigs.ToList());
ReadContigMapper mapper = new ReadContigMapper();
ReadContigMap maps = mapper.Map(sortedContigs, sequenceReads, this.KmerLength);
// Find map paired reads.
CloneLibrary.Instance.AddLibrary(libraray, float.Parse(mean, null), float.Parse(stdDeviation, null));
MatePairMapper mapPairedReads = new MatePairMapper();
ContigMatePairs pairedReads = mapPairedReads.MapContigToMatePairs(sequenceReads, maps);
// Filter contigs based on the orientation.
OrientationBasedMatePairFilter filter = new OrientationBasedMatePairFilter();
ContigMatePairs contigpairedReads = filter.FilterPairedReads(pairedReads, 0);
DistanceCalculator dist = new DistanceCalculator(contigpairedReads);
dist.CalculateDistance();
graph.BuildContigGraph(contigs.ToList(), this.KmerLength);
// Validate ScaffoldPath using BFS.
TracePath trace = new TracePath();
IList<ScaffoldPath> paths = trace.FindPaths(graph, contigpairedReads, Int32.Parse(kmerLength, null),
Int32.Parse(expectedDepth, null));
ScaffoldPath scaffold = paths.First();
foreach (KeyValuePair<Node, Edge> kvp in scaffold)
{
ISequence seq = graph.GetNodeSequence(kvp.Key);
string sequence = seq.ConvertToString();
string reversedSequence = seq.GetReverseComplementedSequence().ConvertToString();
Assert.IsTrue(expectedScaffoldNodes.Contains(sequence)
|| expectedScaffoldNodes.Contains(reversedSequence),
"Failed to find " + sequence + ", or " + reversedSequence);
}
ApplicationLog.WriteLine("PADENA P1 : FindPaths() validation for Padena step6:step6 completed successfully");
}
示例6: ValidateFilterPaired
/// <summary>
/// Validate Filter contig nodes.
/// </summary>
/// <param name="nodeName">xml node name used for a differnt testcase.</param>
/// <param name="isFirstContig">Is First Contig?</param>
internal void ValidateFilterPaired(string nodeName, bool isFirstContig)
{
string filePath = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.KmerLengthNode);
string daglingThreshold = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.DanglingLinkThresholdNode);
string redundantThreshold = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.RedundantThreshold);
string expectedContigPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.ContigPairedReadsCount);
string forwardReadStartPos = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.ForwardReadStartPos);
string reverseReadStartPos = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.ReverseReadStartPos);
string reverseComplementStartPos = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.RerverseReadReverseCompPos);
string[] expectedForwardReadStartPos = forwardReadStartPos.Split(',');
string[] expectedReverseReadStartPos = reverseReadStartPos.Split(',');
string[] expectedReverseComplementStartPos = reverseComplementStartPos.Split(',');
// Get the input reads and build kmers
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Build kmers from step1,graph in step2
// Remove the dangling links from graph in step3
// Remove bubbles form the graph in step4
// Pass the graph and build contigs
// Validate contig reads
this.KmerLength = Int32.Parse(kmerLength, (IFormatProvider)null);
this.DanglingLinksThreshold = Int32.Parse(daglingThreshold, (IFormatProvider)null);
this.DanglingLinksPurger = new DanglingLinksPurger(Int32.Parse(daglingThreshold, (IFormatProvider)null));
this.RedundantPathsPurger =
new RedundantPathsPurger(Int32.Parse(redundantThreshold, (IFormatProvider)null));
this.RedundantPathLengthThreshold = Int32.Parse(redundantThreshold, (IFormatProvider)null);
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
this.CreateGraph();
this.UnDangleGraph();
// Build contig.
this.ContigBuilder = new SimplePathContigBuilder();
this.RemoveRedundancy();
IEnumerable<ISequence> contigs = this.BuildContigs();
IList<ISequence> sortedContigs = SortContigsData(contigs.ToList());
ReadContigMapper mapper = new ReadContigMapper();
ReadContigMap maps = mapper.Map(
sortedContigs, sequenceReads, this.KmerLength);
// Find map paired reads.
MatePairMapper mapPairedReads = new MatePairMapper();
ContigMatePairs pairedReads = mapPairedReads.MapContigToMatePairs(sequenceReads, maps);
// Filter contigs based on the orientation.
OrientationBasedMatePairFilter filter = new OrientationBasedMatePairFilter();
ContigMatePairs contigpairedReads = filter.FilterPairedReads(pairedReads, 0);
Assert.AreEqual(expectedContigPairedReadsCount,
contigpairedReads.Values.Count.ToString((IFormatProvider)null));
Dictionary<ISequence, IList<ValidMatePair>> map = null;
IList<ValidMatePair> valid = null;
ISequence firstSeq = sortedContigs[0];
ISequence secondSeq = sortedContigs[1];
// Validate Contig paired reads after filtering contig sequences.
if (isFirstContig)
{
map = contigpairedReads[firstSeq];
valid = SortPairedReads(map[secondSeq], sequenceReads);
}
else
{
map = contigpairedReads[secondSeq];
valid = SortPairedReads(map[firstSeq], sequenceReads);
}
for (int index = 0; index < valid.Count; index++)
{
Assert.IsTrue((expectedForwardReadStartPos[index] ==
valid[index].ForwardReadStartPosition[0].ToString((IFormatProvider)null)
|| (expectedForwardReadStartPos[index] ==
valid[index].ForwardReadStartPosition[1].ToString((IFormatProvider)null))));
if (valid[index].ReverseReadReverseComplementStartPosition.Count > 1)
{
Assert.IsTrue((expectedReverseReadStartPos[index] ==
//.........这里部分代码省略.........
示例7: AddLibraryInformation
/// <summary>
/// Validate Add library information in existing libraries.
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
/// <param name="IsLibraryInfo">Is library info?</param>
internal void AddLibraryInformation(string nodeName, bool IsLibraryInfo)
{
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.FilePathNode);
string expectedPairedReadsCount = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.PairedReadsCountNode);
string[] backwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
Constants.BackwardReadsNode);
string[] forwardReadsNode = utilityObj.xmlUtil.GetTextValues(nodeName,
Constants.ForwardReadsNode);
string expectedLibraray = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.LibraryName);
string expectedStdDeviation = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.StdDeviation);
string mean = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.Mean);
IList<ISequence> sequenceReads = new List<ISequence>();
IList<MatePair> pairedreads = new List<MatePair>();
// Get the input reads
IEnumerable<ISequence> sequences = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
sequences = parser.Parse().ToList();
parser.Close ();
foreach (ISequence seq in sequences)
{
sequenceReads.Add(seq);
}
// Add a new library infomration.
if (IsLibraryInfo)
{
CloneLibraryInformation libraryInfo =
new CloneLibraryInformation();
libraryInfo.LibraryName = expectedLibraray;
libraryInfo.MeanLengthOfInsert = float.Parse(mean, (IFormatProvider)null);
libraryInfo.StandardDeviationOfInsert = float.Parse(expectedStdDeviation, (IFormatProvider)null);
CloneLibrary.Instance.AddLibrary(libraryInfo);
}
else
{
CloneLibrary.Instance.AddLibrary(expectedLibraray,
float.Parse(mean, (IFormatProvider)null), float.Parse(expectedStdDeviation, (IFormatProvider)null));
}
// Convert reads to map paired reads.
MatePairMapper pair = new MatePairMapper();
pairedreads = pair.Map(sequenceReads);
// Validate Map paired reads.
Assert.AreEqual(expectedPairedReadsCount, pairedreads.Count.ToString((IFormatProvider)null));
for (int index = 0; index < pairedreads.Count; index++)
{
Assert.IsTrue(forwardReadsNode.Contains(new string(pairedreads[index].GetForwardRead(sequenceReads).Select(a => (char)a).ToArray())));
Assert.IsTrue(backwardReadsNode.Contains(new string(pairedreads[index].GetReverseRead(sequenceReads).Select(a => (char)a).ToArray())));
Assert.AreEqual(expectedStdDeviation,
pairedreads[index].StandardDeviationOfLibrary.ToString((IFormatProvider)null));
Assert.AreEqual(expectedLibraray, pairedreads[index].Library.ToString((IFormatProvider)null));
Assert.AreEqual(mean, pairedreads[index].MeanLengthOfLibrary.ToString((IFormatProvider)null));
}
ApplicationLog.WriteLine(@"Padena P1 : Map paired reads has been verified successfully");
}
示例8: ValidateSimpleContigBuilderBuild
/// <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;
FastAParser parser = new FastAParser();
parser.Open(filePath);
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();
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");
}
示例9: ValidatePadenaUnDangleGraph
/// <summary>
/// Validate the ParallelDeNovothis unDangleGraph() method which removes the dangling link
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
/// <param name="defaultThreshold">Default Threshold</param>
/// <param name="smallSizeChromosome">Small size chromosome</param>
internal void ValidatePadenaUnDangleGraph(string nodeName, bool defaultThreshold, bool smallSizeChromosome)
{
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.KmerLengthNode);
string expectedNodesCount = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.NodesCountAfterDanglingGraphNode);
string danglingThreshold = null;
if (!defaultThreshold)
danglingThreshold = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.DanglingLinkThresholdNode);
// Get the input reads and build kmers
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Build kmers from step1,graph in step2
this.KmerLength = int.Parse(kmerLength, null);
if (!defaultThreshold)
{
this.DanglingLinksThreshold = int.Parse(danglingThreshold, null);
}
else
{
this.DanglingLinksThreshold = int.Parse(kmerLength, null) + 1;
}
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
this.CreateGraph();
DeBruijnGraph graph = this.Graph;
ApplicationLog.WriteLine("Padena P1 : Step1,2 Completed Successfully");
this.DanglingLinksPurger = new DanglingLinksPurger(this.DanglingLinksThreshold);
this.UnDangleGraph();
ApplicationLog.WriteLine("Padena P1 : Step3 Completed Successfully");
if (smallSizeChromosome)
{
Assert.AreEqual(expectedNodesCount, graph.GetNodes().Count().ToString((IFormatProvider)null));
}
else
{
ValidateGraph(graph, nodeName);
}
ApplicationLog.WriteLine(@"Padena P1 :ParallelDeNovothis.UndangleGraph() validation for Padena step3 completed successfully");
}
示例10: ValidatePadenaRemoveRedundancy
/// <summary>
/// Validate ParallelDeNovothis.RemoveRedundancy() which removes bubbles formed in the graph
/// and validate the graph
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
/// <param name="defaultThreshold">Is Default Threshold?</param>
/// <param name="isMicroorganism">Is micro organsm?</param>
internal void ValidatePadenaRemoveRedundancy(string nodeName, bool defaultThreshold, bool isMicroorganism)
{
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.KmerLengthNode);
string expectedNodesCount = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.ExpectedNodesCountRemoveRedundancy);
string danglingThreshold = null;
string pathlengthThreshold = null;
if (!defaultThreshold)
{
danglingThreshold = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.DanglingLinkThresholdNode);
pathlengthThreshold = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.PathLengthThresholdNode);
}
// Get the input reads and build kmers
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
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
// Validate the graph
if (!defaultThreshold)
{
this.DanglingLinksThreshold = int.Parse(danglingThreshold, (IFormatProvider)null);
this.DanglingLinksPurger =
new DanglingLinksPurger(this.DanglingLinksThreshold);
this.RedundantPathLengthThreshold = int.Parse(pathlengthThreshold, (IFormatProvider)null);
this.RedundantPathsPurger =
new RedundantPathsPurger(this.RedundantPathLengthThreshold);
}
else
{
this.DanglingLinksPurger =
new DanglingLinksPurger(int.Parse(kmerLength, (IFormatProvider)null));
this.RedundantPathsPurger =
new RedundantPathsPurger(int.Parse(kmerLength, (IFormatProvider)null) + 1);
}
this.KmerLength = int.Parse(kmerLength, (IFormatProvider)null);
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
this.CreateGraph();
DeBruijnGraph graph = this.Graph;
ApplicationLog.WriteLine("Padena P1 : Step1,2 Completed Successfully");
this.UnDangleGraph();
ApplicationLog.WriteLine("Padena P1 : Step3 Completed Successfully");
this.RemoveRedundancy();
ApplicationLog.WriteLine("Padena P1 : Step4 Completed Successfully");
if (isMicroorganism)
{
Assert.AreEqual(expectedNodesCount, graph.GetNodes().Count().ToString((IFormatProvider)null));
}
else
{
ValidateGraph(graph, nodeName);
}
ApplicationLog.WriteLine(@"Padena P1 :ParallelDeNovothis.RemoveRedundancy() validation for Padena step4 completed successfully");
}
示例11: ValidatePadenaBuildGraph
/// <summary>
/// Validate graph generated using ParallelDeNovothis.CreateGraph() with kmers
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
/// <param name="isLargeSizeReads">Is large size reads?</param>
internal void ValidatePadenaBuildGraph(string nodeName, bool isLargeSizeReads)
{
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.KmerLengthNode);
string expectedGraphsNodeCount = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.GraphNodesCountNode);
// Get the input reads and build kmers
FastAParser parser = new FastAParser();
parser.Open(filePath);
IEnumerable<ISequence> sequenceReads = parser.Parse().ToList();
parser.Close ();
this.KmerLength = int.Parse(kmerLength, null);
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
this.CreateGraph();
DeBruijnGraph graph = this.Graph;
ApplicationLog.WriteLine("Padena P1 : Step1,2 Completed Successfully");
if (isLargeSizeReads)
Assert.AreEqual(Int32.Parse(expectedGraphsNodeCount, null), graph.GetNodes().Count());
else
ValidateGraph(graph, nodeName);
ApplicationLog.WriteLine(@"Padena P1 : ParallelDeNovothis CreateGraph() validation for Padena step2 completed successfully");
}
示例12: ValidatePadenaBuildKmers
/// <summary>
/// Validate ParallelDeNovothis step1 Build kmers
/// </summary>
/// <param name="nodeName">xml node for test data</param>
/// <param name="isSmallSize">Is file small size?</param>
internal void ValidatePadenaBuildKmers(string nodeName, bool isSmallSize)
{
// Read all the input sequences from xml config file
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.KmerLengthNode);
string expectedKmersCount = utilityObj.xmlUtil.GetTextValue(nodeName, Constants.ExpectedKmersCount);
// Set kmerLength
this.KmerLength = int.Parse(kmerLength, (IFormatProvider)null);
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser();
parser.Open(filePath);
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Set all the input reads and execute build kmers
this.SequenceReads.Clear();
this.SetSequenceReads(sequenceReads.ToList());
IEnumerable<KmersOfSequence> lstKmers =
(new SequenceToKmerBuilder()).Build(this.SequenceReads, this.KmerLength);
if (isSmallSize)
{
Assert.AreEqual(expectedKmersCount, lstKmers.Count().ToString((IFormatProvider)null));
}
else
{
ValidateKmersList(new List<KmersOfSequence>(lstKmers), sequenceReads.ToList(), nodeName);
}
ApplicationLog.WriteLine(@"Padena P1 : Validation of Build with all input reads using ParallelDeNovothis sequence completed successfully");
}
示例13: ValidateKmerBuilderBuildWithSequence
/// <summary>
/// Validate SequenceRangeToKmerBuilder Build() which build kmers
/// using one base sequence
/// </summary>
/// <param name="nodeName">xml node name used for different testcases</param>
internal void ValidateKmerBuilderBuildWithSequence(string nodeName)
{
string filePath = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.KmerLengthNode);
// Get the input reads
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser ();
parser.Open (filePath);
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Pass each input read and kmerLength
// Add all the generated kmers to kmer list
SequenceToKmerBuilder builder = new SequenceToKmerBuilder();
IList<KmersOfSequence> lstKmers = new List<KmersOfSequence>();
foreach (ISequence sequence in sequenceReads)
{
lstKmers.Add(builder.Build(sequence, int.Parse(kmerLength, (IFormatProvider)null)));
}
// Validate all the kmers
ValidateKmersList(lstKmers, sequenceReads.ToList(), nodeName);
ApplicationLog.WriteLine(
@"Padena BVT : Validation of Build with each input read sequence
completed successfully");
}
示例14: ValidateKmerBuilderBuild
/// <summary>
/// Validate SequenceRangeToKmerBuilder Build() method which build kmers
/// </summary>
/// <param name="nodeName">xml node name for test data</param>
internal void ValidateKmerBuilderBuild(string nodeName)
{
string filePath = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(
nodeName, Constants.KmerLengthNode);
// Get the input reads
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser ();
parser.Open( filePath.Replace("\\", System.IO.Path.DirectorySeparatorChar.ToString()));
sequenceReads = parser.Parse().ToList();
parser.Close ();
// Pass all the input reads and kmerLength to generate kmers
SequenceToKmerBuilder builder = new SequenceToKmerBuilder();
IEnumerable<KmersOfSequence> lstKmers = builder.Build(sequenceReads,
int.Parse(kmerLength, (IFormatProvider)null));
// Validate kmers list
ValidateKmersList(new List<KmersOfSequence>(lstKmers),
new List<ISequence>(sequenceReads), nodeName);
ApplicationLog.WriteLine(
@"Padena BVT : Validation of Build with all input reads
sequence completed successfully");
}
示例15: ValidateDe2AssemblerBuildKmers
/// <summary>
/// Validate ParallelDeNovoAssembler step1 Build kmers
/// </summary>
/// <param name="nodeName">xml node for test data</param>
internal void ValidateDe2AssemblerBuildKmers(string nodeName)
{
// Read all the input sequences from xml config file
string filePath = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.FilePathNode);
string kmerLength = utilityObj.xmlUtil.GetTextValue(nodeName,
Constants.KmerLengthNode);
// set kmerLength
this.KmerLength = int.Parse(kmerLength, (IFormatProvider)null);
IEnumerable<ISequence> sequenceReads = null;
FastAParser parser = new FastAParser ();
parser.Open( filePath.Replace("\\", System.IO.Path.DirectorySeparatorChar.ToString()));
sequenceReads = parser.Parse().ToList();
parser.Close ();
this.SequenceReads.Clear(); // set all the input reads and execute build kmers
this.SetSequenceReads(sequenceReads.ToList());
IEnumerable<KmersOfSequence> lstKmers =
(new SequenceToKmerBuilder()).Build(this.SequenceReads,
this.KmerLength);
ValidateKmersList(new List<KmersOfSequence>(lstKmers),
new List<ISequence>(sequenceReads), nodeName);
ApplicationLog.WriteLine(
@"Padena BVT : Validation of Build with all input reads using
ParallelDeNovoAssembler sequence completed successfully");
}