X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fschemes%2FScoreMatrix.js;h=401ab4190133a6c5efddf0a6ba4a0e4324b17110;hp=a12c842e7f6644e7ad242f4216c0ddb9441d41ae;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/schemes/ScoreMatrix.js b/bin/jalview/schemes/ScoreMatrix.js index a12c842..401ab41 100644 --- a/bin/jalview/schemes/ScoreMatrix.js +++ b/bin/jalview/schemes/ScoreMatrix.js @@ -1,86 +1,86 @@ -Clazz.declarePackage ("jalview.schemes"); -Clazz.load (["jalview.analysis.scoremodels.PairwiseSeqScoreModel", "jalview.api.analysis.ScoreModelI"], "jalview.schemes.ScoreMatrix", ["jalview.schemes.ResidueProperties", "java.lang.StringBuffer"], function () { -c$ = Clazz.decorateAsClass (function () { -this.name = null; -this.matrix = null; -this.type = 0; -Clazz.instantialize (this, arguments); -}, jalview.schemes, "ScoreMatrix", jalview.analysis.scoremodels.PairwiseSeqScoreModel, jalview.api.analysis.ScoreModelI); -Clazz.overrideMethod (c$, "getName", -function () { -return this.name; -}); -Clazz.makeConstructor (c$, -function (name, matrix, type) { -Clazz.superConstructor (this, jalview.schemes.ScoreMatrix, []); -this.matrix = matrix; -this.type = type; -this.name = name; -}, "~S,~A,~N"); -Clazz.overrideMethod (c$, "isDNA", -function () { -return this.type == 1; -}); -Clazz.overrideMethod (c$, "isProtein", -function () { -return this.type == 0; -}); -Clazz.overrideMethod (c$, "getMatrix", -function () { -return this.matrix; -}); -Clazz.defineMethod (c$, "getPairwiseScore", -function (A1, A2) { -return this.getPairwiseScore (A1.charAt (0), A2.charAt (0)); -}, "~S,~S"); -Clazz.defineMethod (c$, "getPairwiseScore", -function (c, d) { -var pog = 0; -try { -var a = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[c.charCodeAt (0)]; -var b = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[d.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[d.charCodeAt (0)]; -pog = this.matrix[a][b]; -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -} else { -throw e; -} -} -return pog; -}, "~S,~S"); -Clazz.overrideMethod (c$, "toString", -function () { -return this.outputMatrix (false); -}); -Clazz.defineMethod (c$, "outputMatrix", -function (html) { -var sb = new StringBuffer (); -var symbols = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex : jalview.schemes.ResidueProperties.nucleotideIndex; -var symMax = (this.type == 0) ? 23 : 10; -var header = true; -if (html) { -sb.append (""); -}for (var sym = 'A'; sym <= 'Z'; sym = String.fromCharCode (sym.charCodeAt (0) + 1)) { -if (symbols[sym.charCodeAt (0)] >= 0 && symbols[sym.charCodeAt (0)] < symMax) { -if (header) { -sb.append (html ? "" : ""); -for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) { -if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) { -sb.append ((html ? "" : "")); -}} -header = false; -sb.append (html ? "\n" : "\n"); -}if (html) { -sb.append (""); -}sb.append ((html ? "" : "")); -for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) { -if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) { -sb.append ((html ? "" : "")); -}} -sb.append (html ? "\n" : "\n"); -}} -if (html) { -sb.append ("
 " : "\t") + sym2 + (html ? " 
" : "") + sym + (html ? "" : "\t") + this.matrix[symbols[sym.charCodeAt (0)]][symbols[sym2.charCodeAt (0)]] + (html ? "
"); -}return sb.toString (); -}, "~B"); -}); +Clazz.declarePackage ("jalview.schemes"); +Clazz.load (["jalview.analysis.scoremodels.PairwiseSeqScoreModel", "jalview.api.analysis.ScoreModelI"], "jalview.schemes.ScoreMatrix", ["jalview.schemes.ResidueProperties", "java.lang.StringBuffer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.name = null; +this.matrix = null; +this.type = 0; +Clazz.instantialize (this, arguments); +}, jalview.schemes, "ScoreMatrix", jalview.analysis.scoremodels.PairwiseSeqScoreModel, jalview.api.analysis.ScoreModelI); +Clazz.overrideMethod (c$, "getName", +function () { +return this.name; +}); +Clazz.makeConstructor (c$, +function (name, matrix, type) { +Clazz.superConstructor (this, jalview.schemes.ScoreMatrix, []); +this.matrix = matrix; +this.type = type; +this.name = name; +}, "~S,~A,~N"); +Clazz.overrideMethod (c$, "isDNA", +function () { +return this.type == 1; +}); +Clazz.overrideMethod (c$, "isProtein", +function () { +return this.type == 0; +}); +Clazz.overrideMethod (c$, "getMatrix", +function () { +return this.matrix; +}); +Clazz.defineMethod (c$, "getPairwiseScore", +function (A1, A2) { +return this.getPairwiseScore (A1.charAt (0), A2.charAt (0)); +}, "~S,~S"); +Clazz.defineMethod (c$, "getPairwiseScore", +function (c, d) { +var pog = 0; +try { +var a = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[c.charCodeAt (0)]; +var b = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex[d.charCodeAt (0)] : jalview.schemes.ResidueProperties.nucleotideIndex[d.charCodeAt (0)]; +pog = this.matrix[a][b]; +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +} else { +throw e; +} +} +return pog; +}, "~S,~S"); +Clazz.overrideMethod (c$, "toString", +function () { +return this.outputMatrix (false); +}); +Clazz.defineMethod (c$, "outputMatrix", +function (html) { +var sb = new StringBuffer (); +var symbols = (this.type == 0) ? jalview.schemes.ResidueProperties.aaIndex : jalview.schemes.ResidueProperties.nucleotideIndex; +var symMax = (this.type == 0) ? 23 : 10; +var header = true; +if (html) { +sb.append (""); +}for (var sym = 'A'; sym <= 'Z'; sym = String.fromCharCode (sym.charCodeAt (0) + 1)) { +if (symbols[sym.charCodeAt (0)] >= 0 && symbols[sym.charCodeAt (0)] < symMax) { +if (header) { +sb.append (html ? "" : ""); +for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) { +if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) { +sb.append ((html ? "" : "")); +}} +header = false; +sb.append (html ? "\n" : "\n"); +}if (html) { +sb.append (""); +}sb.append ((html ? "" : "")); +for (var sym2 = 'A'; sym2 <= 'Z'; sym2 = String.fromCharCode (sym2.charCodeAt (0) + 1)) { +if (symbols[sym2.charCodeAt (0)] >= 0 && symbols[sym2.charCodeAt (0)] < symMax) { +sb.append ((html ? "" : "")); +}} +sb.append (html ? "\n" : "\n"); +}} +if (html) { +sb.append ("
 " : "\t") + sym2 + (html ? " 
" : "") + sym + (html ? "" : "\t") + this.matrix[symbols[sym.charCodeAt (0)]][symbols[sym2.charCodeAt (0)]] + (html ? "
"); +}return sb.toString (); +}, "~B"); +});