Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / jalview / io / JnetAnnotationMaker.js
index f39d55b..e2f51a5 100644 (file)
@@ -1,90 +1,90 @@
-Clazz.declarePackage ("jalview.io");\r
-Clazz.load (null, "jalview.io.JnetAnnotationMaker", ["jalview.datamodel.AlignmentAnnotation", "$.Annotation", "jalview.util.MessageManager", "java.lang.Exception", "$.Float"], function () {\r
-c$ = Clazz.declareType (jalview.io, "JnetAnnotationMaker");\r
-c$.add_annotation = Clazz.defineMethod (c$, "add_annotation", \r
-function (prediction, al, firstSeq, noMsa) {\r
-jalview.io.JnetAnnotationMaker.add_annotation (prediction, al, firstSeq, noMsa, Clazz.castNullAs ("Array"));\r
-}, "jalview.io.AlignFile,jalview.datamodel.AlignmentI,~N,~B");\r
-c$.add_annotation = Clazz.defineMethod (c$, "add_annotation", \r
-function (prediction, al, firstSeq, noMsa, delMap) {\r
-var i = 0;\r
-var preds = prediction.getSeqsAsArray ();\r
-var seqRef = al.getSequenceAt (firstSeq);\r
-var width = preds[0].getSequence ().length;\r
-var gapmap = al.getSequenceAt (firstSeq).gapMap ();\r
-if ((delMap != null && delMap.length > width) || (delMap == null && gapmap.length != width)) {\r
-throw ( new Exception (jalview.util.MessageManager.formatMessage ("exception.number_of_residues_in_query_sequence_differ_from_prediction",  Clazz.newArray (-1, [(delMap == null ? "" : jalview.util.MessageManager.getString ("label.mapped")), al.getSequenceAt (firstSeq).getName (), al.getSequenceAt (firstSeq).getSequenceAsString (), Integer.$valueOf (width).toString ()]))));\r
-}var annot;\r
-var annotations = null;\r
-var existingAnnotations = 0;\r
-if (al.getAlignmentAnnotation () != null) {\r
-existingAnnotations = al.getAlignmentAnnotation ().length;\r
-}var sol =  new Array (al.getWidth ());\r
-var firstsol = true;\r
-while (i < preds.length) {\r
-var id = preds[i].getName ().toUpperCase ();\r
-if (id.startsWith ("LUPAS") || id.startsWith ("JNET") || id.startsWith ("JPRED")) {\r
-if (id.startsWith ("JNETSOL")) {\r
-var amnt = (id.endsWith ("25") ? 3 : id.endsWith ("5") ? 6 : 9);\r
-for (var spos = 0; spos < width; spos++) {\r
-var sposw = (delMap == null) ? gapmap[spos] : gapmap[delMap[spos]];\r
-if (firstsol) {\r
-sol[sposw] =  new jalview.datamodel.Annotation (0);\r
-}if (preds[i].getCharAt (spos) == 'B' && (sol[sposw].value == 0 || sol[sposw].value < amnt)) {\r
-sol[sposw].value = amnt;\r
-}}\r
-firstsol = false;\r
-} else {\r
-annotations =  new Array (al.getWidth ());\r
-if (id.equals ("JNETPRED") || id.equals ("JNETPSSM") || id.equals ("JNETFREQ") || id.equals ("JNETHMM") || id.equals ("JNETALIGN") || id.equals ("JPRED")) {\r
-if (delMap == null) {\r
-for (var j = 0; j < width; j++) {\r
-annotations[gapmap[j]] =  new jalview.datamodel.Annotation ("", "", preds[i].getCharAt (j), 0);\r
-}\r
-} else {\r
-for (var j = 0; j < width; j++) {\r
-annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation ("", "", preds[i].getCharAt (j), 0);\r
-}\r
-}} else if (id.equals ("JNETCONF")) {\r
-if (delMap == null) {\r
-for (var j = 0; j < width; j++) {\r
-var value =  new Float (preds[i].getCharAt (j) + "").floatValue ();\r
-annotations[gapmap[j]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", preds[i].getCharAt (j), value);\r
-}\r
-} else {\r
-for (var j = 0; j < width; j++) {\r
-var value =  new Float (preds[i].getCharAt (j) + "").floatValue ();\r
-annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", preds[i].getCharAt (j), value);\r
-}\r
-}} else {\r
-if (delMap == null) {\r
-for (var j = 0; j < width; j++) {\r
-annotations[gapmap[j]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", ' ', 0);\r
-}\r
-} else {\r
-for (var j = 0; j < width; j++) {\r
-annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", ' ', 0);\r
-}\r
-}}if (id.equals ("JNETCONF")) {\r
-annot =  new jalview.datamodel.AlignmentAnnotation (preds[i].getName (), "JNet Output", annotations, 0, 10, 1);\r
-} else {\r
-annot =  new jalview.datamodel.AlignmentAnnotation (preds[i].getName (), "JNet Output", annotations);\r
-}if (seqRef != null) {\r
-annot.createSequenceMapping (seqRef, 1, true);\r
-seqRef.addAlignmentAnnotation (annot);\r
-}al.addAnnotation (annot);\r
-al.setAnnotationIndex (annot, al.getAlignmentAnnotation ().length - existingAnnotations - 1);\r
-}if (noMsa) {\r
-al.deleteSequence (preds[i]);\r
-}}i++;\r
-}\r
-if (!firstsol) {\r
-annot =  new jalview.datamodel.AlignmentAnnotation ("Jnet Burial", "<html>Prediction of Solvent Accessibility<br/>levels are<ul><li>0 - Exposed</li><li>3 - 25% or more S.A. accessible</li><li>6 - 5% or more S.A. accessible</li><li>9 - Buried (<5% exposed)</li></ul>", sol, 0, 9, 1);\r
-annot.validateRangeAndDisplay ();\r
-if (seqRef != null) {\r
-annot.createSequenceMapping (seqRef, 1, true);\r
-seqRef.addAlignmentAnnotation (annot);\r
-}al.addAnnotation (annot);\r
-al.setAnnotationIndex (annot, al.getAlignmentAnnotation ().length - existingAnnotations - 1);\r
-}}, "jalview.io.AlignFile,jalview.datamodel.AlignmentI,~N,~B,~A");\r
-});\r
+Clazz.declarePackage ("jalview.io");
+Clazz.load (null, "jalview.io.JnetAnnotationMaker", ["jalview.datamodel.AlignmentAnnotation", "$.Annotation", "jalview.util.MessageManager", "java.lang.Exception", "$.Float"], function () {
+c$ = Clazz.declareType (jalview.io, "JnetAnnotationMaker");
+c$.add_annotation = Clazz.defineMethod (c$, "add_annotation", 
+function (prediction, al, firstSeq, noMsa) {
+jalview.io.JnetAnnotationMaker.add_annotation (prediction, al, firstSeq, noMsa, Clazz.castNullAs ("Array"));
+}, "jalview.io.AlignFile,jalview.datamodel.AlignmentI,~N,~B");
+c$.add_annotation = Clazz.defineMethod (c$, "add_annotation", 
+function (prediction, al, firstSeq, noMsa, delMap) {
+var i = 0;
+var preds = prediction.getSeqsAsArray ();
+var seqRef = al.getSequenceAt (firstSeq);
+var width = preds[0].getSequence ().length;
+var gapmap = al.getSequenceAt (firstSeq).gapMap ();
+if ((delMap != null && delMap.length > width) || (delMap == null && gapmap.length != width)) {
+throw ( new Exception (jalview.util.MessageManager.formatMessage ("exception.number_of_residues_in_query_sequence_differ_from_prediction",  Clazz.newArray (-1, [(delMap == null ? "" : jalview.util.MessageManager.getString ("label.mapped")), al.getSequenceAt (firstSeq).getName (), al.getSequenceAt (firstSeq).getSequenceAsString (), Integer.$valueOf (width).toString ()]))));
+}var annot;
+var annotations = null;
+var existingAnnotations = 0;
+if (al.getAlignmentAnnotation () != null) {
+existingAnnotations = al.getAlignmentAnnotation ().length;
+}var sol =  new Array (al.getWidth ());
+var firstsol = true;
+while (i < preds.length) {
+var id = preds[i].getName ().toUpperCase ();
+if (id.startsWith ("LUPAS") || id.startsWith ("JNET") || id.startsWith ("JPRED")) {
+if (id.startsWith ("JNETSOL")) {
+var amnt = (id.endsWith ("25") ? 3 : id.endsWith ("5") ? 6 : 9);
+for (var spos = 0; spos < width; spos++) {
+var sposw = (delMap == null) ? gapmap[spos] : gapmap[delMap[spos]];
+if (firstsol) {
+sol[sposw] =  new jalview.datamodel.Annotation (0);
+}if (preds[i].getCharAt (spos) == 'B' && (sol[sposw].value == 0 || sol[sposw].value < amnt)) {
+sol[sposw].value = amnt;
+}}
+firstsol = false;
+} else {
+annotations =  new Array (al.getWidth ());
+if (id.equals ("JNETPRED") || id.equals ("JNETPSSM") || id.equals ("JNETFREQ") || id.equals ("JNETHMM") || id.equals ("JNETALIGN") || id.equals ("JPRED")) {
+if (delMap == null) {
+for (var j = 0; j < width; j++) {
+annotations[gapmap[j]] =  new jalview.datamodel.Annotation ("", "", preds[i].getCharAt (j), 0);
+}
+} else {
+for (var j = 0; j < width; j++) {
+annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation ("", "", preds[i].getCharAt (j), 0);
+}
+}} else if (id.equals ("JNETCONF")) {
+if (delMap == null) {
+for (var j = 0; j < width; j++) {
+var value =  new Float (preds[i].getCharAt (j) + "").floatValue ();
+annotations[gapmap[j]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", preds[i].getCharAt (j), value);
+}
+} else {
+for (var j = 0; j < width; j++) {
+var value =  new Float (preds[i].getCharAt (j) + "").floatValue ();
+annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", preds[i].getCharAt (j), value);
+}
+}} else {
+if (delMap == null) {
+for (var j = 0; j < width; j++) {
+annotations[gapmap[j]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", ' ', 0);
+}
+} else {
+for (var j = 0; j < width; j++) {
+annotations[gapmap[delMap[j]]] =  new jalview.datamodel.Annotation (preds[i].getCharAt (j) + "", "", ' ', 0);
+}
+}}if (id.equals ("JNETCONF")) {
+annot =  new jalview.datamodel.AlignmentAnnotation (preds[i].getName (), "JNet Output", annotations, 0, 10, 1);
+} else {
+annot =  new jalview.datamodel.AlignmentAnnotation (preds[i].getName (), "JNet Output", annotations);
+}if (seqRef != null) {
+annot.createSequenceMapping (seqRef, 1, true);
+seqRef.addAlignmentAnnotation (annot);
+}al.addAnnotation (annot);
+al.setAnnotationIndex (annot, al.getAlignmentAnnotation ().length - existingAnnotations - 1);
+}if (noMsa) {
+al.deleteSequence (preds[i]);
+}}i++;
+}
+if (!firstsol) {
+annot =  new jalview.datamodel.AlignmentAnnotation ("Jnet Burial", "<html>Prediction of Solvent Accessibility<br/>levels are<ul><li>0 - Exposed</li><li>3 - 25% or more S.A. accessible</li><li>6 - 5% or more S.A. accessible</li><li>9 - Buried (<5% exposed)</li></ul>", sol, 0, 9, 1);
+annot.validateRangeAndDisplay ();
+if (seqRef != null) {
+annot.createSequenceMapping (seqRef, 1, true);
+seqRef.addAlignmentAnnotation (annot);
+}al.addAnnotation (annot);
+al.setAnnotationIndex (annot, al.getAlignmentAnnotation ().length - existingAnnotations - 1);
+}}, "jalview.io.AlignFile,jalview.datamodel.AlignmentI,~N,~B,~A");
+});