2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
\r
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
\r
5 * This file is part of Jalview.
\r
7 * Jalview is free software: you can redistribute it and/or
\r
8 * modify it under the terms of the GNU General Public License
\r
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
\r
11 * Jalview is distributed in the hope that it will be useful, but
\r
12 * WITHOUT ANY WARRANTY; without even the implied warranty
\r
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
\r
14 * PURPOSE. See the GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
\r
18 package jalview.schemes;
\r
20 public class ScoreMatrix
\r
25 * reference to integer score matrix
\r
30 * 0 for Protein Score matrix. 1 for dna score matrix
\r
34 ScoreMatrix(String name, int[][] matrix, int type)
\r
36 this.matrix = matrix;
\r
40 public boolean isDNA()
\r
45 public boolean isProtein()
\r
50 public int[][] getMatrix()
\r
59 * @return score for substituting first char in A1 with first char in A2
\r
61 public int getPairwiseScore(String A1, String A2)
\r
63 return getPairwiseScore(A1.charAt(0), A2.charAt(0));
\r
66 public int getPairwiseScore(char c, char d)
\r
72 int a = (type == 0) ? ResidueProperties.aaIndex[c]
\r
73 : ResidueProperties.nucleotideIndex[c];
\r
74 int b = (type == 0) ? ResidueProperties.aaIndex[d]
\r
75 : ResidueProperties.nucleotideIndex[d];
\r
78 } catch (Exception e)
\r
80 // System.out.println("Unknown residue in " + A1 + " " + A2);
\r