public void TestMUMmerAlignerMultipleMum() { string reference = "ATGCGCATCCCCTT"; string search = "GCGCCCCCTA"; Sequence referenceSeq = null; Sequence searchSeq = null; referenceSeq = new Sequence(Alphabets.DNA, reference); searchSeq = new Sequence(Alphabets.DNA, search); List <ISequence> searchSeqs = new List <ISequence>(); searchSeqs.Add(searchSeq); MUMmerAligner mummer = new MUMmerAligner(); mummer.LengthOfMUM = 4; mummer.PairWiseAlgorithm = new NeedlemanWunschAligner(); IList <IPairwiseSequenceAlignment> result = mummer.AlignSimple(referenceSeq, searchSeqs); // Check if output is not null Assert.AreNotEqual(null, result); IList <IPairwiseSequenceAlignment> expectedOutput = new List <IPairwiseSequenceAlignment>(); IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence(); alignedSeq.FirstSequence = new Sequence(Alphabets.DNA, "ATGCGCATCCCCTT"); alignedSeq.SecondSequence = new Sequence(Alphabets.DNA, "--GCGC--CCCCTA"); alignedSeq.Consensus = new Sequence(AmbiguousDnaAlphabet.Instance, "ATGCGCATCCCCTW"); alignedSeq.Score = -11; alignedSeq.FirstOffset = 0; alignedSeq.SecondOffset = 2; align.PairwiseAlignedSequences.Add(alignedSeq); expectedOutput.Add(align); Assert.IsTrue(CompareAlignment(result, expectedOutput)); }
public void TestMUMmer3MultipleMumWithCustomMatrix() { string reference = "ATGCGCATCCCCTT"; string search = "GCGCCCCCTA"; Sequence referenceSeq = null; Sequence searchSeq = null; referenceSeq = new Sequence(Alphabets.DNA, reference); searchSeq = new Sequence(Alphabets.DNA, search); List <ISequence> searchSeqs = new List <ISequence>(); searchSeqs.Add(searchSeq); int[,] customMatrix = new int[256, 256]; customMatrix[(byte)'A', (byte)'A'] = 3; customMatrix[(byte)'A', (byte)'T'] = -2; customMatrix[(byte)'A', (byte)'G'] = -2; customMatrix[(byte)'A', (byte)'c'] = -2; customMatrix[(byte)'G', (byte)'G'] = 3; customMatrix[(byte)'G', (byte)'A'] = -2; customMatrix[(byte)'G', (byte)'T'] = -2; customMatrix[(byte)'G', (byte)'C'] = -2; customMatrix[(byte)'T', (byte)'T'] = 3; customMatrix[(byte)'T', (byte)'A'] = -2; customMatrix[(byte)'T', (byte)'G'] = -2; customMatrix[(byte)'T', (byte)'C'] = -2; customMatrix[(byte)'C', (byte)'C'] = 3; customMatrix[(byte)'C', (byte)'T'] = -2; customMatrix[(byte)'C', (byte)'A'] = -2; customMatrix[(byte)'C', (byte)'G'] = -2; DiagonalSimilarityMatrix matrix = new DiagonalSimilarityMatrix(3, -2); int gapOpenCost = -6; MUMmerAligner mummer = new MUMmerAligner(); mummer.LengthOfMUM = 4; mummer.PairWiseAlgorithm = new NeedlemanWunschAligner(); mummer.SimilarityMatrix = matrix; mummer.GapOpenCost = gapOpenCost; mummer.GapExtensionCost = -2; IList <IPairwiseSequenceAlignment> result = mummer.AlignSimple(referenceSeq, searchSeqs); // Check if output is not null Assert.AreNotEqual(null, result); IList <IPairwiseSequenceAlignment> expectedOutput = new List <IPairwiseSequenceAlignment>(); IPairwiseSequenceAlignment align = new PairwiseSequenceAlignment(); PairwiseAlignedSequence alignedSeq = new PairwiseAlignedSequence(); alignedSeq.FirstSequence = new Sequence(Alphabets.DNA, "ATGCGCATCCCCTT"); alignedSeq.SecondSequence = new Sequence(Alphabets.DNA, "--GCGC--CCCCTA"); alignedSeq.Consensus = new Sequence(AmbiguousDnaAlphabet.Instance, "ATGCGCATCCCCTW"); alignedSeq.Score = 1; alignedSeq.FirstOffset = 0; alignedSeq.SecondOffset = 2; align.PairwiseAlignedSequences.Add(alignedSeq); expectedOutput.Add(align); Assert.IsTrue(CompareAlignment(result, expectedOutput)); }