JAL-3691 automatic insertion of Locale.ROOT to toUpperCase() and toLowerCase() and...
[jalview.git] / src / jalview / io / JnetAnnotationMaker.java
index f97cd96..27fc869 100755 (executable)
@@ -20,6 +20,8 @@
  */
 package jalview.io;
 
+import java.util.Locale;
+
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
@@ -59,17 +61,19 @@ public class JnetAnnotationMaker
     // in the future we could search for the query
     // sequence in the alignment before calling this function.
     SequenceI seqRef = al.getSequenceAt(firstSeq);
-    int width = preds[0].getSequence().length;
+    int width = preds[0].getLength();
     int[] gapmap = al.getSequenceAt(firstSeq).gapMap();
     if ((delMap != null && delMap.length > width)
             || (delMap == null && gapmap.length != width))
     {
-      throw (new Exception(MessageManager.formatMessage("exception.number_of_residues_in_query_sequence_differ_from_prediction", new String[]{
-                 (delMap == null ? "" : MessageManager.getString("label.mapped")),
-                 al.getSequenceAt(firstSeq).getName(),
-                 al.getSequenceAt(firstSeq).getSequenceAsString(),
-                 Integer.valueOf(width).toString()
-      })));
+      throw (new Exception(MessageManager.formatMessage(
+              "exception.number_of_residues_in_query_sequence_differ_from_prediction",
+              new String[]
+              { (delMap == null ? ""
+                      : MessageManager.getString("label.mapped")),
+                  al.getSequenceAt(firstSeq).getName(),
+                  al.getSequenceAt(firstSeq).getSequenceAsString(),
+                  Integer.valueOf(width).toString() })));
     }
 
     AlignmentAnnotation annot;
@@ -86,24 +90,25 @@ public class JnetAnnotationMaker
 
     while (i < preds.length)
     {
-      String id = preds[i].getName().toUpperCase();
+      String id = preds[i].getName().toUpperCase(Locale.ROOT);
 
       if (id.startsWith("LUPAS") || id.startsWith("JNET")
               || id.startsWith("JPRED"))
       {
         if (id.startsWith("JNETSOL"))
         {
-          float amnt = (id.endsWith("25") ? 3f : id.endsWith("5") ? 6f : 9f);
+          float amnt = (id.endsWith("25") ? 3f
+                  : id.endsWith("5") ? 6f : 9f);
           for (int spos = 0; spos < width; spos++)
           {
             int sposw = (delMap == null) ? gapmap[spos]
-                    : delMap[gapmap[spos]];
+                    : gapmap[delMap[spos]];
             if (firstsol)
             {
               sol[sposw] = new Annotation(0f);
             }
             if (preds[i].getCharAt(spos) == 'B'
-                    && (sol[spos].value == 0f || sol[spos].value < amnt))
+                    && (sol[sposw].value == 0f || sol[sposw].value < amnt))
             {
               sol[sposw].value = amnt;
             }
@@ -145,7 +150,7 @@ public class JnetAnnotationMaker
             {
               for (int j = 0; j < width; j++)
               {
-                float value = new Float(preds[i].getCharAt(j) + "")
+                float value = Float.valueOf(preds[i].getCharAt(j) + "")
                         .floatValue();
                 annotations[gapmap[j]] = new Annotation(
                         preds[i].getCharAt(j) + "", "",
@@ -156,7 +161,7 @@ public class JnetAnnotationMaker
             {
               for (int j = 0; j < width; j++)
               {
-                float value = new Float(preds[i].getCharAt(j) + "")
+                float value = Float.valueOf(preds[i].getCharAt(j) + "")
                         .floatValue();
                 annotations[gapmap[delMap[j]]] = new Annotation(
                         preds[i].getCharAt(j) + "", "",
@@ -187,13 +192,13 @@ public class JnetAnnotationMaker
           if (id.equals("JNETCONF"))
           {
             annot = new AlignmentAnnotation(preds[i].getName(),
-                    "JNet Output", annotations, 0f, 10f,
+                    "JPred Output", annotations, 0f, 10f,
                     AlignmentAnnotation.BAR_GRAPH);
           }
           else
           {
             annot = new AlignmentAnnotation(preds[i].getName(),
-                    "JNet Output", annotations);
+                    "JPred Output", annotations);
           }
 
           if (seqRef != null)
@@ -217,8 +222,7 @@ public class JnetAnnotationMaker
     if (!firstsol)
     {
       // add the solvent accessibility
-      annot = new AlignmentAnnotation(
-              "Jnet Burial",
+      annot = new 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, 0f, 9f, AlignmentAnnotation.BAR_GRAPH);
 
@@ -229,8 +233,8 @@ public class JnetAnnotationMaker
         seqRef.addAlignmentAnnotation(annot);
       }
       al.addAnnotation(annot);
-      al.setAnnotationIndex(annot, al.getAlignmentAnnotation().length
-              - existingAnnotations - 1);
+      al.setAnnotationIndex(annot,
+              al.getAlignmentAnnotation().length - existingAnnotations - 1);
     }
     // Hashtable scores = prediction.getScores();