1 package jalview.schemes;
3 import static org.testng.Assert.assertEquals;
5 import org.testng.annotations.Test;
7 public class ScoreMatrixTest
9 @Test(groups = "Functional")
10 public void testSymmetric()
12 verifySymmetric(ResidueProperties.getScoreMatrix("BLOSUM62"));
13 verifySymmetric(ResidueProperties.getScoreMatrix("PAM250"));
14 verifySymmetric(ResidueProperties.getScoreMatrix("DNA"));
17 private void verifySymmetric(ScoreMatrix sm)
19 int[][] m = sm.getMatrix();
21 for (int row = 0; row < rows; row++)
23 assertEquals(m[row].length, rows);
24 for (int col = 0; col < rows; col++)
26 // if (m[row][col] != m[col][row])
28 // System.out.println(String.format("%s [%d, %d] [%s, %s]",
29 // sm.getName(), m[row][col], m[col][row],
30 // ResidueProperties.aa[row],
31 // ResidueProperties.aa[col]));
33 assertEquals(m[row][col], m[col][row], String.format("%s [%s, %s]",
34 sm.getName(), ResidueProperties.aa[row],
35 ResidueProperties.aa[col]));
40 * also check the score matrix is sized for
41 * the number of symbols scored, plus gap
43 assertEquals(rows, (sm.isDNA() ? ResidueProperties.maxNucleotideIndex
44 : ResidueProperties.maxProteinIndex) + 1);