1 Clazz.declarePackage ("jalview.datamodel");
2 Clazz.load (["jalview.datamodel.Sequence", "java.lang.Exception"], "jalview.datamodel.BinarySequence", ["jalview.schemes.ResidueProperties"], function () {
3 c$ = Clazz.decorateAsClass (function () {
4 if (!Clazz.isClassDefined ("jalview.datamodel.BinarySequence.InvalidSequenceTypeException")) {
5 jalview.datamodel.BinarySequence.$BinarySequence$InvalidSequenceTypeException$ ();
10 Clazz.instantialize (this, arguments);
11 }, jalview.datamodel, "BinarySequence", jalview.datamodel.Sequence);
12 Clazz.makeConstructor (c$,
14 Clazz.superConstructor (this, jalview.datamodel.BinarySequence, ["", s, 0, s.length]);
17 Clazz.defineMethod (c$, "initMatrixGetNoRes",
19 var nores = (this.isNa) ? 10 : 23;
20 this.dbinary = Clazz.newDoubleArray (this.getSequence ().length * nores, 0);
21 for (var i = 0; i < this.dbinary.length; i++) {
22 this.dbinary[i] = 0.0;
25 }, $fz.isPrivate = true, $fz));
26 Clazz.defineMethod (c$, "getSymbolmatrix",
28 return (this.isNa) ? jalview.schemes.ResidueProperties.nucleotideIndex : jalview.schemes.ResidueProperties.aaIndex;
29 }, $fz.isPrivate = true, $fz));
30 Clazz.defineMethod (c$, "encode",
32 var nores = this.initMatrixGetNoRes ();
33 var sindex = this.getSymbolmatrix ();
34 for (var i = 0; i < this.getSequence ().length; i++) {
35 var aanum = nores - 1;
37 aanum = sindex[this.getCharAt (i).charCodeAt (0)];
39 if (Clazz.exceptionOf (e, NullPointerException)) {
47 }this.dbinary[(i * nores) + aanum] = 1.0;
50 Clazz.defineMethod (c$, "matrixEncode",
52 if (this.isNa != matrix.isDNA ()) {
53 throw Clazz.innerTypeInstance (jalview.datamodel.BinarySequence.InvalidSequenceTypeException, this, null, "matrix " + matrix.getClass ().getCanonicalName () + " is not a valid matrix for " + (this.isNa ? "nucleotide" : "protein") + "sequences");
54 }this.matrixEncode (matrix.isDNA () ? jalview.schemes.ResidueProperties.nucleotideIndex : jalview.schemes.ResidueProperties.aaIndex, matrix.getMatrix ());
55 }, "jalview.schemes.ScoreMatrix");
56 Clazz.defineMethod (c$, "matrixEncode",
57 ($fz = function (aaIndex, matrix) {
58 var nores = this.initMatrixGetNoRes ();
59 for (var i = 0, iSize = this.getSequence ().length; i < iSize; i++) {
60 var aanum = nores - 1;
62 aanum = aaIndex[this.getCharAt (i).charCodeAt (0)];
64 if (Clazz.exceptionOf (e, NullPointerException)) {
72 }for (var j = 0; j < nores; j++) {
73 this.dbinary[(i * nores) + j] = matrix[aanum][j];
76 }, $fz.isPrivate = true, $fz), "~A,~A");
77 Clazz.defineMethod (c$, "toBinaryString",
80 for (var i = 0; i < this.binary.length; i++) {
81 out += ( new Integer (this.binary[i])).toString ();
82 if (i < (this.binary.length - 1)) {
87 Clazz.defineMethod (c$, "getDBinary",
91 c$.$BinarySequence$InvalidSequenceTypeException$ = function () {
93 c$ = Clazz.decorateAsClass (function () {
94 Clazz.prepareCallback (this, arguments);
95 Clazz.instantialize (this, arguments);
96 }, jalview.datamodel.BinarySequence, "InvalidSequenceTypeException", Exception);