[1648] | 1 | package de.ugoe.cs.autoquest.tasktrees.alignment.algorithms; |
---|
| 2 | |
---|
| 3 | import static org.junit.Assert.*; |
---|
| 4 | |
---|
| 5 | import org.junit.Test; |
---|
| 6 | |
---|
[1649] | 7 | import de.ugoe.cs.autoquest.tasktrees.alignment.matrix.DummySubstitutionMatrix; |
---|
| 8 | |
---|
[1648] | 9 | public class SmithWatermanRepeatedTest { |
---|
| 10 | |
---|
| 11 | @Test |
---|
| 12 | public void testGetMaxScore() { |
---|
[1649] | 13 | int[] seq1 = new int[]{0,1,2,3,4,5,6,7,8,9}; |
---|
| 14 | int[] seq2 = new int[]{0,1,2,3,4,5,6,7,8,9}; |
---|
| 15 | |
---|
| 16 | NumberSequence ns1 = new NumberSequence(10); |
---|
| 17 | NumberSequence ns2 = new NumberSequence(10); |
---|
| 18 | |
---|
| 19 | ns1.setSequence(seq1); |
---|
| 20 | ns2.setSequence(seq2); |
---|
| 21 | |
---|
| 22 | DummySubstitutionMatrix submat = new DummySubstitutionMatrix(); |
---|
| 23 | |
---|
| 24 | AlignmentAlgorithm testalignment1 = AlignmentAlgorithmFactory |
---|
| 25 | .create(); |
---|
| 26 | testalignment1.align(ns1, ns2,submat,5); |
---|
| 27 | |
---|
| 28 | assertTrue(testalignment1.getMaxScore()==10); |
---|
[1648] | 29 | } |
---|
| 30 | |
---|
| 31 | @Test |
---|
| 32 | public void testGetAlignmentScore() { |
---|
[1649] | 33 | int[] seq1 = new int[]{0,1,2,3,4,5,6,7,8,9}; |
---|
| 34 | int[] seq2 = new int[]{0,1,2,3,4,5,6,7,8,9}; |
---|
| 35 | |
---|
| 36 | NumberSequence ns1 = new NumberSequence(10); |
---|
| 37 | NumberSequence ns2 = new NumberSequence(10); |
---|
| 38 | |
---|
| 39 | ns1.setSequence(seq1); |
---|
| 40 | ns2.setSequence(seq2); |
---|
| 41 | |
---|
| 42 | DummySubstitutionMatrix submat = new DummySubstitutionMatrix(); |
---|
| 43 | |
---|
| 44 | AlignmentAlgorithm testalignment1 = AlignmentAlgorithmFactory |
---|
| 45 | .create(); |
---|
| 46 | testalignment1.align(ns1, ns2,submat,5); |
---|
| 47 | assertTrue(testalignment1.getAlignmentScore()==5); |
---|
[1648] | 48 | } |
---|
| 49 | |
---|
| 50 | @Test |
---|
| 51 | public void testGetMatches() { |
---|
[1649] | 52 | int[] seq1 = new int[]{0,1,2,3,4,5,6,7,8,9}; |
---|
| 53 | int[] seq2 = new int[]{3,4,5,6,7}; |
---|
| 54 | |
---|
| 55 | NumberSequence ns1 = new NumberSequence(10); |
---|
| 56 | NumberSequence ns2 = new NumberSequence(10); |
---|
| 57 | |
---|
| 58 | ns1.setSequence(seq1); |
---|
| 59 | ns2.setSequence(seq2); |
---|
| 60 | |
---|
| 61 | DummySubstitutionMatrix submat = new DummySubstitutionMatrix(); |
---|
| 62 | |
---|
| 63 | AlignmentAlgorithm testalignment1 = AlignmentAlgorithmFactory |
---|
| 64 | .create(); |
---|
| 65 | testalignment1.align(ns1, ns2,submat,4); |
---|
| 66 | testalignment1.printDPMatrix(); |
---|
| 67 | testalignment1.printAlignment(); |
---|
| 68 | |
---|
| 69 | //testalignment1.getMatches().get(0).getFirstSequence().printSequence(); |
---|
| 70 | //testalignment1.getMatches().get(0).getSecondSequence().printSequence(); |
---|
| 71 | |
---|
[1648] | 72 | } |
---|
| 73 | |
---|
| 74 | |
---|
[1649] | 75 | //TODO: Need a better substitution matrix to do proper testing |
---|
[1648] | 76 | @Test |
---|
| 77 | public void testAlign() { |
---|
[1649] | 78 | int[] seq1 = new int[]{0,1,2, 3, 4, 5,6,7,8,9}; |
---|
| 79 | int[] seq2 = new int[]{0,1,2,10,11,12,6,7,8,9}; |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | NumberSequence ns1 = new NumberSequence(10); |
---|
| 83 | NumberSequence ns2 = new NumberSequence(10); |
---|
| 84 | |
---|
| 85 | ns1.setSequence(seq1); |
---|
| 86 | ns2.setSequence(seq2); |
---|
| 87 | |
---|
| 88 | DummySubstitutionMatrix submat = new DummySubstitutionMatrix(); |
---|
| 89 | |
---|
| 90 | AlignmentAlgorithm testalignment1 = AlignmentAlgorithmFactory |
---|
| 91 | .create(); |
---|
| 92 | testalignment1.align(ns1, ns2,submat,3); |
---|
| 93 | //assertTrue(testalignment1.getAlignmentScore()==7); |
---|
| 94 | |
---|
| 95 | } |
---|
[1648] | 96 | |
---|
| 97 | } |
---|