1 Clazz.declarePackage ("jalview.schemes");
2 Clazz.load (["jalview.analysis.scoremodels.PairwiseSeqScoreModel", "jalview.api.analysis.ScoreModelI"], "jalview.schemes.ScoreMatrix", ["jalview.schemes.ResidueProperties", "java.lang.StringBuffer"], function () {
3 c$ = Clazz.decorateAsClass (function () {
7 Clazz.instantialize (this, arguments);
8 }, jalview.schemes, "ScoreMatrix", jalview.analysis.scoremodels.PairwiseSeqScoreModel, jalview.api.analysis.ScoreModelI);
9 Clazz.overrideMethod (c$, "getName",
13 Clazz.makeConstructor (c$,
14 function (name, matrix, type) {
15 Clazz.superConstructor (this, jalview.schemes.ScoreMatrix, []);
20 Clazz.overrideMethod (c$, "isDNA",
22 return this.type == 1;
24 Clazz.overrideMethod (c$, "isProtein",
26 return this.type == 0;
28 Clazz.overrideMethod (c$, "getMatrix",
32 Clazz.defineMethod (c$, "getPairwiseScore",
34 return this.getPairwiseScore (A1.charAt (0), A2.charAt (0));
36 Clazz.defineMethod (c$, "getPairwiseScore",
40 var a = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[c.charCodeAt (0)];
41 var b = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[d.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[d.charCodeAt (0)];
42 pog = this.matrix[a][b];
44 if (Clazz.exceptionOf (e, Exception)) {
51 Clazz.overrideMethod (c$, "toString",
53 return this.outputMatrix (false);
55 Clazz.defineMethod (c$, "outputMatrix",
57 var sb = new StringBuffer ();
58 var symbols = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex : jalview.schemes.ResidueProperties.nucleotideIndex;
59 var symMax = (this.type == 0) ? 23 : 10;
62 sb.append ("<table border=\"1\">");
63 }for (var sym = 'A'; sym <= 'Z'; sym = String.fromCharCode (sym.charCodeAt (0) + 1)) {
64 if (symbols[sym.charCodeAt (0)] >= 0 && symbols[sym.charCodeAt (0)] < symMax) {
66 sb.append (html ? "<tr><td></td>" : "");
67 for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) {
68 if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) {
69 sb.append ((html ? "<td> " : "\t") + sym2 + (html ? " </td>" : ""));
72 sb.append (html ? "</tr>\n" : "\n");
75 }sb.append ((html ? "<td>" : "") + sym + (html ? "</td>" : ""));
76 for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) {
77 if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) {
78 sb.append ((html ? "<td>" : "\t") + this.matrix[symbols[sym.charCodeAt (0)]][symbols[sym2.charCodeAt (0)]] + (html ? "</td>" : ""));
80 sb.append (html ? "</tr>\n" : "\n");
83 sb.append ("</table>");
84 }return sb.toString ();