X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FScoreMatrix.java;fp=src%2Fjalview%2Fschemes%2FScoreMatrix.java;h=d82f54c68dad59cfac976a86ec2c9f6ed2e1eb1b;hb=d5bcc3830eab04e6db816e1c2ad8fce1dc189612;hp=5e5fa8d389e4ca7c16df6973f8886fc754c94481;hpb=3ebdd4e28382e38a181aae1eed71549f603f9025;p=jalview.git diff --git a/src/jalview/schemes/ScoreMatrix.java b/src/jalview/schemes/ScoreMatrix.java index 5e5fa8d..d82f54c 100644 --- a/src/jalview/schemes/ScoreMatrix.java +++ b/src/jalview/schemes/ScoreMatrix.java @@ -21,10 +21,10 @@ package jalview.schemes; import jalview.analysis.scoremodels.PairwiseSeqScoreModel; -import jalview.api.analysis.ScoreModelI; +import jalview.math.Matrix; +import jalview.math.MatrixI; -public class ScoreMatrix extends PairwiseSeqScoreModel implements - ScoreModelI +public class ScoreMatrix extends PairwiseSeqScoreModel { String name; @@ -79,19 +79,21 @@ public class ScoreMatrix extends PairwiseSeqScoreModel implements } /** + * Answers the score for substituting first char in A1 with first char in A2 * * @param A1 * @param A2 - * @return score for substituting first char in A1 with first char in A2 + * @return */ public int getPairwiseScore(String A1, String A2) { return getPairwiseScore(A1.charAt(0), A2.charAt(0)); } + @Override public int getPairwiseScore(char c, char d) { - int pog = 0; + int score = 0; try { @@ -99,19 +101,19 @@ public class ScoreMatrix extends PairwiseSeqScoreModel implements : ResidueProperties.nucleotideIndex[c]; int b = (type == 0) ? ResidueProperties.aaIndex[d] : ResidueProperties.nucleotideIndex[d]; - - pog = matrix[a][b]; + score = matrix[a][b]; } catch (Exception e) { // System.out.println("Unknown residue in " + A1 + " " + A2); } - return pog; + return score; } /** * pretty print the matrix */ + @Override public String toString() { return outputMatrix(false); @@ -170,4 +172,47 @@ public class ScoreMatrix extends PairwiseSeqScoreModel implements } return sb.toString(); } + + /** + * Computes an NxN matrix where N is the number of sequences, and entry [i, j] + * is sequence[i] pairwise multiplied with sequence[j], as a sum of scores + * computed using the current score matrix. For example + *