/// <summary> /// Build Suffix Tree using reference sequence. /// This method using Kurtz algorithm to build the Suffix Tree /// </summary> /// <param name="referenceSequence">Reference sequence number</param> /// <returns>Suffix Tree</returns> protected override SequenceSuffixTree BuildSuffixTree(ISequence referenceSequence) { ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); SequenceSuffixTree suffixTree = suffixTreeBuilder.BuildSuffixTree(referenceSequence); return(suffixTree); }
public void TestStreamingInSegmentedSequence() { string sequenceString = "AAATTGGC"; Sequence sequence = new Sequence(Alphabets.Protein, sequenceString); SegmentedSequence segmentedSequece = new SegmentedSequence(sequence); sequenceString = "ANANA"; sequence = new Sequence(Alphabets.Protein, sequenceString); segmentedSequece.Sequences.Add(sequence); ISuffixTreeBuilder kurtzSuffixTreeBuilder = new KurtzSuffixTreeBuilder(); ApplicationLog.WriteLine("Begin SuffixTree Test for string '{0}'", segmentedSequece.ToString()); SequenceSuffixTree kurtzSuffixTree = kurtzSuffixTreeBuilder.BuildSuffixTree(segmentedSequece); string queryString = "AATTNANAGGC"; Sequence querySequence = new Sequence(Alphabets.Protein, queryString); ApplicationLog.WriteLine("Query string : {0}. Minimum Length of MUM : 3.", queryString); ApplicationLog.WriteTime("Start Time.", DateTime.Now.ToString()); IList <MaxUniqueMatch> MUMs = kurtzSuffixTreeBuilder.FindMatches(kurtzSuffixTree, querySequence, 3); ApplicationLog.WriteTime("End Time.", DateTime.Now.ToString()); // Verify the count of MUMs found Assert.AreEqual(3, MUMs.Count); }
/// <summary> /// Traverse the suffix tree using query sequence and return list of MUMs /// </summary> /// <param name="suffixTree">Suffix tree</param> /// <param name="sequence">Query sequence</param> /// <param name="lengthOfMUM">Minimum length of MUM</param> /// <returns>List of MUMs</returns> protected override IList <MaxUniqueMatch> Streaming( SequenceSuffixTree suffixTree, ISequence sequence, long lengthOfMUM) { ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); return(suffixTreeBuilder.FindMatches(suffixTree, sequence, lengthOfMUM)); }
/// <summary> /// Generates list of MUMs for each query sequence. /// This returns the MUMs that are generated. /// If 'performLIS' is true, MUMs are sorted and processed /// using Longest Increasing Subsequence (LIS). If 'performLIS' /// is false, MUMs are returned immediately after streaming. /// </summary> /// <param name="referenceSequence">Reference sequence</param> /// <param name="querySequenceList">List of query sequences</param> /// <param name="performLIS">Boolean indicating whether Longest Increasing /// Subsequence (LIS) modules is run on MUMs before returning</param> /// <returns>List of MUMs for each query sequence</returns> public override IDictionary <ISequence, IList <MaxUniqueMatch> > GetMUMs( ISequence referenceSequence, IList <ISequence> querySequenceList, bool performLIS) { GetMUMsValidate(referenceSequence, querySequenceList); // Initializations IDictionary <ISequence, IList <MaxUniqueMatch> > queryMums = new Dictionary <ISequence, IList <MaxUniqueMatch> >(); // Step1 : building suffix trees using reference sequence SequenceSuffixTree suffixTree = BuildSuffixTree(referenceSequence); // On each query sequence aligned with reference sequence //foreach (ISequence sequence in querySequenceList) Parallel.ForEach(querySequenceList, sequence => { bool isQuerySequence = true; IList <MaxUniqueMatch> mumList; if (sequence.Equals(referenceSequence)) { isQuerySequence = false; } if (isQuerySequence) { // Step2 : streaming process is performed with the query sequence mumList = Streaming(suffixTree, sequence, LengthOfMUM); if (performLIS) { // Step3(a) : sorted mum list based on reference sequence mumList = SortMum(mumList); if (mumList.Count > 0) { // Step3(b) : LIS using greedy cover algorithm mumList = CollectLongestIncreasingSubsequence(mumList); } else { mumList = null; } } lock (queryMums) { queryMums.Add(sequence, mumList); } } }); return(queryMums); }
/// <summary> /// Validates most of the build suffix tree test cases with varying parameters. /// </summary> /// <param name="nodeName">Node name which needs to be read for execution.</param> /// <param name="isFilePath">Is file path?</param> void ValidateBuildSuffixTreeGeneralTestCases(string nodeName, bool isFilePath) { ISequence referenceSeqs = null; string[] referenceSequences = null; if (isFilePath) { // Gets the reference sequence from the configurtion file string filePath = _utilityObj._xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsNotNull(filePath); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "NUCmer BVT : Successfully validated the File Path '{0}'.", filePath)); using (FastaParser parser = new FastaParser()) { IList <ISequence> referenceSeqList = parser.Parse(filePath); referenceSeqs = new SegmentedSequence(referenceSeqList); } } else { // Gets the reference & search sequences from the configurtion file referenceSequences = _utilityObj._xmlUtil.GetTextValues(nodeName, Constants.ReferenceSequencesNode); IAlphabet seqAlphabet = Utility.GetAlphabet(_utilityObj._xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); List <ISequence> refSeqList = new List <ISequence>(); for (int i = 0; i < referenceSequences.Length; i++) { ISequence referSeq = new Sequence(seqAlphabet, referenceSequences[i]); refSeqList.Add(referSeq); } referenceSeqs = new SegmentedSequence(refSeqList); } // Builds the suffix for the reference sequence passed. ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); SequenceSuffixTree suffixTree = suffixTreeBuilder.BuildSuffixTree(referenceSeqs); // Validates the edges for a given sequence. ApplicationLog.WriteLine("NUCmer BVT : Validating the Edges"); Assert.IsTrue(ValidateEdges(suffixTree, nodeName, isFilePath)); Console.WriteLine( "NUCmer BVT : Successfully validated the all the Edges for the sequence specified."); ApplicationLog.WriteLine( "NUCmer BVT : Successfully validated the all the Edges for the sequence specified."); }
/// <summary> /// Validates most of the build suffix tree test cases with varying parameters. /// </summary> /// <param name="nodeName">Node name which needs to be read for execution.</param> /// <param name="isFilePath">Is file path?</param> void ValidateBuildSuffixTreeGeneralTestCases(string nodeName, bool isFilePath) { ISequence referenceSeq = null; string referenceSequence = string.Empty; if (isFilePath) { // Gets the reference sequence from the configurtion file string filePath = _utilityObj._xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsNotNull(filePath); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "MUMmer BVT : Successfully validated the File Path '{0}'.", filePath)); using (FastaParser parser = new FastaParser()) { IList <ISequence> referenceSeqs = parser.Parse(filePath); referenceSeq = referenceSeqs[0]; referenceSequence = referenceSeq.ToString(); } } else { // Gets the reference sequence from the configurtion file referenceSequence = _utilityObj._xmlUtil.GetTextValue(nodeName, Constants.SequenceNode); referenceSeq = new Sequence(Utility.GetAlphabet(_utilityObj._xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)), referenceSequence); } // Builds the suffix for the reference sequence passed. ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); SequenceSuffixTree suffixTree = suffixTreeBuilder.BuildSuffixTree(referenceSeq); // Validates the edges for a given sequence. ApplicationLog.WriteLine("MUMmer BVT : Validating the Edges"); Assert.IsTrue(ValidateEdges(suffixTree, nodeName)); Console.WriteLine(string.Format((IFormatProvider)null, "MUMmer BVT : Successfully validated the all the Edges for the sequence '{0}'.", referenceSequence)); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "MUMmer BVT : Successfully validated the all the Edges for the sequence '{0}'.", referenceSequence)); Assert.AreEqual(suffixTree.Sequence.ToString(), referenceSequence); Console.WriteLine(string.Format((IFormatProvider)null, "MUMmer BVT : Successfully validated the Suffix Tree properties for the sequence '{0}'.", referenceSequence)); ApplicationLog.WriteLine(string.Format((IFormatProvider)null, "MUMmer BVT : Successfully validated the Suffix Tree properties for the sequence '{0}'.", referenceSequence)); }
/// <summary> /// Validates the edges for the suffix tree and the node name specified. /// </summary> /// <param name="suffixTree">Suffix Tree.</param> /// <param name="nodeName">Node name which needs to be read for validation</param> /// <returns>True, if successfully validated.</returns> static bool ValidateEdges(SequenceSuffixTree suffixTree, string nodeName) { Dictionary <int, Edge> ed = suffixTree.Edges; string[] actualStrtIndexes = new string[ed.Count]; string[] actualEndIndexes = new string[ed.Count]; int j = 0; foreach (int col in ed.Keys) { Edge a = ed[col]; actualStrtIndexes[j] = a.StartIndex.ToString(); actualEndIndexes[j] = a.EndIndex.ToString(); j++; } // Gets the sorted edge list for the actual Edge list List <Edge> actualEdgeList = GetSortedEdges(actualStrtIndexes, actualEndIndexes); // Gets all the edges to be validated as in xml. string[] startIndexes = Utility._xmlUtil.GetTextValue(nodeName, Constants.EdgeStartIndexesNode).Split(','); string[] endIndexes = Utility._xmlUtil.GetTextValue(nodeName, Constants.EdgeEndIndexesNode).Split(','); // Gets the sorted edge list for the expected Edge list List <Edge> expectedEdgeList = GetSortedEdges(startIndexes, endIndexes); Console.WriteLine(string.Format(null, "MUMmer BVT : Total Edges Found is : '{0}'", ed.Keys.Count.ToString((IFormatProvider)null))); ApplicationLog.WriteLine(string.Format(null, "MUMmer BVT : Total Edges Found is : '{0}'", ed.Keys.Count.ToString((IFormatProvider)null))); // Loops through all the edges and validates the same. for (int i = 0; i < expectedEdgeList.Count; i++) { if (!(actualEdgeList[i].StartIndex == expectedEdgeList[i].StartIndex) && (actualEdgeList[i].EndIndex == expectedEdgeList[i].EndIndex)) { Console.WriteLine(string.Format(null, "MUMmer BVT : Edges not matching at index '{0}'", i.ToString())); ApplicationLog.WriteLine(string.Format(null, "MUMmer BVT : Edges not matching at index '{0}'", i.ToString())); return(false); } i++; } return(true); }
public void TestSequence() { string sequenceString = "BANANA"; Sequence sequence = new Sequence(Alphabets.Protein, sequenceString); ISuffixTreeBuilder kurtzSuffixTreeBuilder = new KurtzSuffixTreeBuilder(); ApplicationLog.WriteLine("Begin SuffixTree Test for string '{0}'", sequenceString); ApplicationLog.WriteTime("Start Time.", DateTime.Now.ToString()); SequenceSuffixTree kurtzSuffixTree = kurtzSuffixTreeBuilder.BuildSuffixTree(sequence); ApplicationLog.WriteTime("End Time.", DateTime.Now.ToString()); // Verify the edges in Suffix Tree Assert.AreEqual(10, kurtzSuffixTree.Edges.Count); // Verify the sequence in Suffix Tree Assert.AreEqual(kurtzSuffixTree.Sequence.ToString(), sequenceString); }
/// <summary> /// This method is considered as main execute method which defines the /// step by step algorithm. Drived class flows the defined flow by this /// method. /// </summary> /// <param name="referenceSequenceList">reference sequence</param> /// <param name="querySequenceList">list of input sequences</param> /// <returns>A list of sequence alignment</returns> private IList <IPairwiseSequenceAlignment> Alignment( IList <ISequence> referenceSequenceList, IList <ISequence> querySequenceList) { // Initializations if (referenceSequenceList.Count > 0) { if (ConsensusResolver == null) { ConsensusResolver = new SimpleConsensusResolver(referenceSequenceList[0].Alphabet); } else { ConsensusResolver.SequenceAlphabet = referenceSequenceList[0].Alphabet; } } IList <IPairwiseSequenceAlignment> results = new List <IPairwiseSequenceAlignment>(); IPairwiseSequenceAlignment sequenceAlignment = null; IList <DeltaAlignment> deltaAlignments = null; IList <PairwiseAlignedSequence> alignments = null; ISequence referenceSequence = null; // Validate the input Validate(referenceSequenceList, querySequenceList); // Step:1 concat all the sequences into one sequence if (referenceSequenceList.Count > 1) { referenceSequence = ConcatSequence(referenceSequenceList); } else { referenceSequence = referenceSequenceList[0]; } // Getting refernce sequence _referenceSequence = referenceSequence; // Step2 : building suffix trees using reference sequence _suffixTree = BuildSuffixTree(_referenceSequence); // On each query sequence aligned with reference sequence foreach (ISequence sequence in querySequenceList) { if (sequence.Equals(referenceSequence)) { continue; } sequenceAlignment = new PairwiseSequenceAlignment(referenceSequence, sequence); // Step3 : streaming process is performed with the query sequence _mumList = Streaming(_suffixTree, sequence, LengthOfMUM); if (_mumList.Count > 0) { // Step 5 : Get the list of Clusters _clusterList = GetClusters(_mumList); // Step 7: Process Clusters and get delta deltaAlignments = ProcessCluster( referenceSequenceList, _clusterList); // Step 8: Convert delta alignments to sequence alignments alignments = ConvertDeltaToAlignment(deltaAlignments); if (alignments.Count > 0) { foreach (PairwiseAlignedSequence align in alignments) { // Calculate the score of alignment align.Score = CalculateScore( align.FirstSequence, align.SecondSequence); // Make Consensus align.Consensus = MakeConsensus( align.FirstSequence, align.SecondSequence); sequenceAlignment.PairwiseAlignedSequences.Add(align); } } } results.Add(sequenceAlignment); } return(results); }
/// <summary> /// Traverse the suffix tree using query sequence and return list of matches /// </summary> /// <param name="suffixTree">Suffix tree</param> /// <param name="sequence">Query sequence</param> /// <param name="lengthOfMUM">Minimum length of MUM</param> /// <returns>List of matches</returns> protected abstract IList <MaxUniqueMatch> Streaming( SequenceSuffixTree suffixTree, ISequence sequence, long lengthOfMUM);
/// <summary> /// This method is considered as main execute method which defines the /// step by step algorithm. Drived class flows the defined flow by this /// method. Store generated MUMs in properties MUMs, SortedMUMs. /// Alignment first finds MUMs for all the query sequence, and then /// runs pairwise algorithm on gaps to produce alignments. /// </summary> /// <param name="referenceSequence">reference sequence</param> /// <param name="querySequenceList">list of input sequences</param> /// <returns>A list of sequence alignments</returns> private IList <IPairwiseSequenceAlignment> AlignmentWithAccumulatedMUMs( ISequence referenceSequence, IList <ISequence> querySequenceList) { // Get MUMs IDictionary <ISequence, IList <MaxUniqueMatch> > queryMums = new Dictionary <ISequence, IList <MaxUniqueMatch> >(); _mums = new Dictionary <ISequence, IList <MaxUniqueMatch> >(); _finalMums = new Dictionary <ISequence, IList <MaxUniqueMatch> >(); if (Validate(referenceSequence, querySequenceList)) { IList <MaxUniqueMatch> mumList; // Step1 : building suffix trees using reference sequence SequenceSuffixTree suffixTree = BuildSuffixTree(referenceSequence); // On each query sequence aligned with reference sequence foreach (ISequence sequence in querySequenceList) { if (sequence.Equals(referenceSequence)) { continue; } // Step2 : streaming process is performed with the query sequence mumList = Streaming(suffixTree, sequence, LengthOfMUM); _mums.Add(sequence, mumList); // Step3(a) : sorted mum list based on reference sequence mumList = SortMum(mumList); if (mumList.Count > 0) { // Step3(b) : LIS using greedy cover algorithm mumList = CollectLongestIncreasingSubsequence(mumList); } else { mumList = null; } _finalMums.Add(sequence, mumList); } } IList <IPairwiseSequenceAlignment> results = new List <IPairwiseSequenceAlignment>(); IPairwiseSequenceAlignment alignment = null; if (MUMs != null && FinalMUMs != null) { // Getting refernce sequence _referenceSequence = referenceSequence; // On each query sequence aligned with reference sequence foreach (var finalMum in FinalMUMs) { var sequence = finalMum.Key; _mumList = MUMs[sequence]; _finalMumList = finalMum.Value; alignment = new PairwiseSequenceAlignment(referenceSequence, sequence); if (_mumList.Count > 0) { if (_finalMumList.Count > 0) { // Step 4 : get all the gaps in each sequence and call // pairwise alignment alignment.PairwiseAlignedSequences.Add(ProcessGaps(referenceSequence, sequence)); } results.Add(alignment); } else { IList <IPairwiseSequenceAlignment> sequenceAlignment = RunPairWise( referenceSequence, sequence); foreach (IPairwiseSequenceAlignment pairwiseAlignment in sequenceAlignment) { results.Add(pairwiseAlignment); } } } } return(results); }
/// <summary> /// This method is considered as main execute method which defines the /// step by step algorithm. Drived class flows the defined flow by this /// method. Does not store MUMs, processes MUMs and gaps to find /// alignment directly. /// </summary> /// <param name="referenceSequence">reference sequence</param> /// <param name="querySequenceList">list of input sequences</param> /// <returns>A list of sequence alignments</returns> private IList <IPairwiseSequenceAlignment> AlignmentWithoutAccumulatedMUMs( ISequence referenceSequence, IList <ISequence> querySequenceList) { IList <IPairwiseSequenceAlignment> results = new List <IPairwiseSequenceAlignment>(); IPairwiseSequenceAlignment alignment = null; if (Validate(referenceSequence, querySequenceList)) { // Safety check for public methods to ensure that null // inputs are handled. if (referenceSequence == null || querySequenceList == null) { return(null); } // Getting refernce sequence _referenceSequence = referenceSequence; // Step1 : building suffix trees using reference sequence _suffixTree = BuildSuffixTree(_referenceSequence); // On each query sequence aligned with reference sequence foreach (ISequence sequence in querySequenceList) { if (sequence.Equals(referenceSequence)) { continue; } alignment = new PairwiseSequenceAlignment(referenceSequence, sequence); // Step2 : streaming process is performed with the query sequence _mumList = Streaming(_suffixTree, sequence, LengthOfMUM); // Step3(a) : sorted mum list based on reference sequence _sortedMumList = SortMum(_mumList); if (_sortedMumList.Count > 0) { // Step3(b) : LIS using greedy cover algorithm _finalMumList = CollectLongestIncreasingSubsequence(_sortedMumList); if (_finalMumList.Count > 0) { // Step 4 : get all the gaps in each sequence and call // pairwise alignment alignment.PairwiseAlignedSequences.Add(ProcessGaps(referenceSequence, sequence)); } results.Add(alignment); } else { IList <IPairwiseSequenceAlignment> sequenceAlignment = RunPairWise( referenceSequence, sequence); foreach (IPairwiseSequenceAlignment pairwiseAlignment in sequenceAlignment) { results.Add(pairwiseAlignment); } } } } return(results); }
/// <summary> /// Validates most of the find matches suffix tree test cases with varying parameters. /// </summary> /// <param name="nodeName">Node name which needs to be read for execution.</param> /// <param name="isFilePath">Is File Path?</param> /// <param name="additionalParam">LIS action type enum</param> static void ValidateFindMatchSuffixGeneralTestCases(string nodeName, bool isFilePath, AdditionalParameters additionalParam) { ISequence referenceSeqs = null; ISequence searchSeqs = null; string[] referenceSequences = null; string[] searchSequences = null; if (isFilePath) { // Gets the reference sequence from the FastA file string filePath = Utility._xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsNotNull(filePath); ApplicationLog.WriteLine(string.Format(null, "NUCmer BVT : Successfully validated the File Path '{0}'.", filePath)); FastaParser parser = new FastaParser(); IList <ISequence> referenceSeqList = parser.Parse(filePath); referenceSeqs = new SegmentedSequence(referenceSeqList); // Gets the query sequence from the FastA file string queryFilePath = Utility._xmlUtil.GetTextValue(nodeName, Constants.SearchSequenceFilePathNode); Assert.IsNotNull(queryFilePath); ApplicationLog.WriteLine(string.Format(null, "NUCmer BVT : Successfully validated the File Path '{0}'.", queryFilePath)); FastaParser queryParser = new FastaParser(); IList <ISequence> querySeqList = queryParser.Parse(queryFilePath); searchSeqs = new SegmentedSequence(querySeqList); } else { // Gets the reference & search sequences from the configurtion file referenceSequences = Utility._xmlUtil.GetTextValues(nodeName, Constants.ReferenceSequencesNode); searchSequences = Utility._xmlUtil.GetTextValues(nodeName, Constants.SearchSequencesNode); IAlphabet seqAlphabet = Utility.GetAlphabet(Utility._xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode)); List <ISequence> refSeqList = new List <ISequence>(); List <ISequence> searchSeqList = new List <ISequence>(); for (int i = 0; i < referenceSequences.Length; i++) { ISequence referSeq = new Sequence(seqAlphabet, referenceSequences[i]); refSeqList.Add(referSeq); } referenceSeqs = new SegmentedSequence(refSeqList); for (int i = 0; i < searchSequences.Length; i++) { ISequence searchSeq = new Sequence(seqAlphabet, searchSequences[i]); searchSeqList.Add(searchSeq); } searchSeqs = new SegmentedSequence(searchSeqList); } string mumLength = Utility._xmlUtil.GetTextValue(nodeName, Constants.MUMLengthNode); // Builds the suffix for the reference sequence passed. ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); SequenceSuffixTree suffixTree = suffixTreeBuilder.BuildSuffixTree(referenceSeqs); IList <MaxUniqueMatch> matches = suffixTreeBuilder.FindMatches(suffixTree, searchSeqs, long.Parse(mumLength, null)); switch (additionalParam) { case AdditionalParameters.FindUniqueMatches: // Validates the Unique Matches. ApplicationLog.WriteLine("NUCmer BVT : Validating the Unique Matches"); Assert.IsTrue(ValidateUniqueMatches(matches, nodeName, additionalParam, isFilePath)); Console.WriteLine( "NUCmer BVT : Successfully validated the all the unique matches for the sequences."); break; case AdditionalParameters.PerformClusterBuilder: // Validates the Unique Matches. ApplicationLog.WriteLine( "NUCmer BVT : Validating the Unique Matches using Cluster Builder"); Assert.IsTrue(ValidateUniqueMatches(matches, nodeName, additionalParam, isFilePath)); Console.WriteLine( "NUCmer BVT : Successfully validated the all the cluster builder matches for the sequences."); break; default: break; } ApplicationLog.WriteLine( "NUCmer BVT : Successfully validated the all the unique matches for the sequences."); }
/// <summary> /// Validates most of the find matches suffix tree test cases with varying parameters. /// </summary> /// <param name="nodeName">Node name which needs to be read for execution.</param> /// <param name="isFilePath">Is File Path?</param> /// <param name="LISActionType">LIS action type enum</param> static void ValidateFindMatchSuffixGeneralTestCases(string nodeName, bool isFilePath, LISParameters LISActionType) { ISequence referenceSeq = null; ISequence querySeq = null; string referenceSequence = string.Empty; string querySequence = string.Empty; if (isFilePath) { // Gets the reference sequence from the configurtion file string filePath = Utility._xmlUtil.GetTextValue(nodeName, Constants.FilePathNode); Assert.IsNotNull(filePath); ApplicationLog.WriteLine(string.Format(null, "MUMmer BVT : Successfully validated the File Path '{0}'.", filePath)); FastaParser parser = new FastaParser(); IList <ISequence> referenceSeqs = parser.Parse(filePath); referenceSeq = referenceSeqs[0]; referenceSequence = referenceSeq.ToString(); // Gets the reference sequence from the configurtion file string queryFilePath = Utility._xmlUtil.GetTextValue(nodeName, Constants.SearchSequenceFilePathNode); Assert.IsNotNull(queryFilePath); ApplicationLog.WriteLine(string.Format(null, "MUMmer BVT : Successfully validated the Search File Path '{0}'.", queryFilePath)); FastaParser queryParser = new FastaParser(); IList <ISequence> querySeqs = queryParser.Parse(queryFilePath); querySeq = querySeqs[0]; querySequence = querySeq.ToString(); } else { // Gets the reference sequence from the configurtion file referenceSequence = Utility._xmlUtil.GetTextValue(nodeName, Constants.SequenceNode); string seqAlp = Utility._xmlUtil.GetTextValue(nodeName, Constants.AlphabetNameNode); referenceSeq = new Sequence(Utility.GetAlphabet(seqAlp), referenceSequence); querySequence = Utility._xmlUtil.GetTextValue(nodeName, Constants.SearchSequenceNode); seqAlp = Utility._xmlUtil.GetTextValue(nodeName, Constants.SearchSequenceAlphabetNode); querySeq = new Sequence(Utility.GetAlphabet(seqAlp), querySequence); } string mumLength = Utility._xmlUtil.GetTextValue(nodeName, Constants.MUMLengthNode); // Builds the suffix for the reference sequence passed. ISuffixTreeBuilder suffixTreeBuilder = new KurtzSuffixTreeBuilder(); SequenceSuffixTree suffixTree = suffixTreeBuilder.BuildSuffixTree(referenceSeq); IList <MaxUniqueMatch> matches = suffixTreeBuilder.FindMatches(suffixTree, querySeq, long.Parse(mumLength, null)); switch (LISActionType) { case LISParameters.FindUniqueMatches: // Validates the Unique Matches. ApplicationLog.WriteLine("MUMmer BVT : Validating the Unique Matches"); Assert.IsTrue(ValidateUniqueMatches(matches, nodeName, LISActionType)); break; case LISParameters.PerformLIS: // Validates the Unique Matches. ApplicationLog.WriteLine("MUMmer BVT : Validating the Unique Matches using LIS"); LongestIncreasingSubsequence lisObj = new LongestIncreasingSubsequence(); IList <MaxUniqueMatch> lisMatches = lisObj.GetLongestSequence(matches); Assert.IsTrue(ValidateUniqueMatches(lisMatches, nodeName, LISActionType)); break; default: break; } Console.WriteLine(string.Format(null, "MUMmer BVT : Successfully validated the all the unique matches for the sequence '{0}' and '{1}'.", referenceSequence, querySequence)); ApplicationLog.WriteLine(string.Format(null, "MUMmer BVT : Successfully validated the all the unique matches for the sequence '{0}' and '{1}'.", referenceSequence, querySequence)); }