Formatting
[jalview.git] / src / jalview / io / AnnotationFile.java
index 8ec234d..1b7b72a 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
  * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
  *\r
  * This program is free software; you can redistribute it and/or\r
  * modify it under the terms of the GNU General Public License\r
 package jalview.io;\r
 \r
 import java.io.*;\r
-import jalview.datamodel.*;\r
+import java.net.*;\r
 import java.util.*;\r
-import java.net.URL;\r
-import jalview.schemes.*;\r
-import jalview.analysis.Conservation;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
 \r
 public class AnnotationFile\r
 {\r
   StringBuffer text = new StringBuffer(\r
-        "JALVIEW_ANNOTATION\n"\r
-        +"# Created: "\r
-      +new java.util.Date()+"\n\n");\r
+      "JALVIEW_ANNOTATION\n"\r
+      + "# Created: "\r
+      + new java.util.Date() + "\n\n");\r
 \r
-  public String printAnnotations(AlignmentAnnotation [] annotations,\r
-                                Vector groups)\r
+  public String printAnnotations(AlignmentAnnotation[] annotations,\r
+                                 Vector groups)\r
   {\r
-    if(annotations!=null)\r
+    if (annotations != null)\r
     {\r
       AlignmentAnnotation row;\r
       String comma;\r
@@ -55,14 +55,18 @@ public class AnnotationFile
         row = annotations[i];\r
 \r
         if (!row.visible)\r
+        {\r
           continue;\r
+        }\r
 \r
         color = null;\r
 \r
         if (row.sequenceRef == null)\r
         {\r
           if (seqref != null)\r
+          {\r
             text.append("\nSEQUENCE_REF\tALIGNMENT\n");\r
+          }\r
 \r
           seqref = null;\r
         }\r
@@ -80,11 +84,16 @@ public class AnnotationFile
         else\r
         {\r
           if (row.graph == AlignmentAnnotation.BAR_GRAPH)\r
+          {\r
             text.append("BAR_GRAPH\t");\r
+          }\r
           else if (row.graph == AlignmentAnnotation.LINE_GRAPH)\r
+          {\r
             text.append("LINE_GRAPH\t");\r
+          }\r
 \r
           if (row.getThreshold() != null)\r
+          {\r
             graphLine.append("GRAPHLINE\t"\r
                              + row.label + "\t"\r
                              + row.getThreshold().value + "\t"\r
@@ -92,27 +101,36 @@ public class AnnotationFile
                              + jalview.util.Format.getHexString(\r
                                  row.getThreshold().colour) + "\n"\r
                 );\r
+          }\r
 \r
           if (row.graphGroup > -1)\r
           {\r
             String key = String.valueOf(row.graphGroup);\r
             if (graphGroup.containsKey(key))\r
+            {\r
               graphGroup.put(key, graphGroup.get(key)\r
                              + "\t" + row.label);\r
+            }\r
             else\r
+            {\r
               graphGroup.put(key, row.label);\r
+            }\r
           }\r
         }\r
 \r
         text.append(row.label + "\t");\r
         if (row.description != null)\r
+        {\r
           text.append(row.description + "\t");\r
+        }\r
 \r
         for (int j = 0; j < row.annotations.length; j++)\r
         {\r
           if (seqref != null &&\r
               jalview.util.Comparison.isGap(seqref.getCharAt(j)))\r
+          {\r
             continue;\r
+          }\r
 \r
           if (row.annotations[j] != null)\r
           {\r
@@ -133,7 +151,9 @@ public class AnnotationFile
             {\r
               color = row.annotations[j].colour;\r
               if (row.annotations[j].value != 0f)\r
+              {\r
                 text.append(comma + row.annotations[j].value);\r
+              }\r
             }\r
           }\r
           text.append("|");\r
@@ -165,8 +185,7 @@ public class AnnotationFile
       }\r
     }\r
 \r
-\r
-    if(groups!=null)\r
+    if (groups != null)\r
     {\r
       printGroups(groups);\r
     }\r
@@ -174,7 +193,6 @@ public class AnnotationFile
     return text.toString();\r
   }\r
 \r
-\r
   public void printGroups(Vector sequenceGroups)\r
   {\r
     SequenceGroup sg;\r
@@ -183,47 +201,60 @@ public class AnnotationFile
       sg = (SequenceGroup) sequenceGroups.elementAt(i);\r
       text.append("SEQUENCE_GROUP\t"\r
                   + sg.getName() + "\t"\r
-                  + (sg.getStartRes()+1) + "\t"\r
-                  + (sg.getEndRes()+1)  + "\t" + "-1\t");\r
-      for(int s=0; s<sg.getSize(); s++)\r
+                  + (sg.getStartRes() + 1) + "\t"\r
+                  + (sg.getEndRes() + 1) + "\t" + "-1\t");\r
+      for (int s = 0; s < sg.getSize(); s++)\r
       {\r
-        text.append(sg.getSequenceAt(s).getName()+"\t");\r
+        text.append(sg.getSequenceAt(s).getName() + "\t");\r
       }\r
 \r
-      text.append("\nPROPERTIES\t"+sg.getName()+"\t");\r
+      text.append("\nPROPERTIES\t" + sg.getName() + "\t");\r
 \r
-      if(sg.getDescription()!=null)\r
-        text.append("description="+sg.getDescription()+"\t");\r
-      if(sg.cs!=null)\r
+      if (sg.getDescription() != null)\r
       {\r
-        text.append("colour="+ColourSchemeProperty.getColourName(sg.cs)+"\t");\r
-        if(sg.cs.getThreshold()!=0)\r
-          text.append("pidThreshold="+sg.cs.getThreshold());\r
-        if(sg.cs.conservationApplied())\r
-          text.append("consThreshold="+sg.cs.getConservationInc()+"\t");\r
+        text.append("description=" + sg.getDescription() + "\t");\r
       }\r
-      text.append("outlineColour="+\r
-                  jalview.util.Format.getHexString(sg.getOutlineColour())+"\t");\r
+      if (sg.cs != null)\r
+      {\r
+        text.append("colour=" + ColourSchemeProperty.getColourName(sg.cs) +\r
+                    "\t");\r
+        if (sg.cs.getThreshold() != 0)\r
+        {\r
+          text.append("pidThreshold=" + sg.cs.getThreshold());\r
+        }\r
+        if (sg.cs.conservationApplied())\r
+        {\r
+          text.append("consThreshold=" + sg.cs.getConservationInc() + "\t");\r
+        }\r
+      }\r
+      text.append("outlineColour=" +\r
+                  jalview.util.Format.getHexString(sg.getOutlineColour()) +\r
+                  "\t");\r
 \r
       text.append("displayBoxes=" + sg.getDisplayBoxes() + "\t");\r
       text.append("displayText=" + sg.getDisplayText() + "\t");\r
       text.append("colourText=" + sg.getColourText() + "\t");\r
 \r
       if (sg.textColour != java.awt.Color.black)\r
+      {\r
         text.append("textCol1=" +\r
                     jalview.util.Format.getHexString(sg.textColour) + "\t");\r
+      }\r
       if (sg.textColour2 != java.awt.Color.white)\r
+      {\r
         text.append("textCol2=" +\r
                     jalview.util.Format.getHexString(sg.textColour2) + "\t");\r
-      if(sg.thresholdTextColour!=0)\r
-      text.append("textColThreshold="+sg.thresholdTextColour);\r
+      }\r
+      if (sg.thresholdTextColour != 0)\r
+      {\r
+        text.append("textColThreshold=" + sg.thresholdTextColour);\r
+      }\r
 \r
       text.append("\n\n");\r
 \r
     }\r
   }\r
 \r
-\r
   SequenceI refSeq = null;\r
   public boolean readAnnotationFile(AlignmentI al,\r
                                     String file,\r
@@ -241,7 +272,7 @@ public class AnnotationFile
         URL url = new URL(file);\r
         in = new BufferedReader(new InputStreamReader(url.openStream()));\r
       }\r
-     else if (protocol.equals(AppletFormatAdapter.PASTE))\r
+      else if (protocol.equals(AppletFormatAdapter.PASTE))\r
       {\r
         in = new BufferedReader(new StringReader(file));\r
       }\r
@@ -252,14 +283,16 @@ public class AnnotationFile
         {\r
           in = new BufferedReader(new java.io.InputStreamReader(is));\r
         }\r
-    }\r
+      }\r
 \r
       String line, label, description, token;\r
       int graphStyle, index;\r
       int refSeqIndex = 1;\r
       int existingAnnotations = 0;\r
-      if(al.getAlignmentAnnotation()!=null)\r
-       existingAnnotations = al.getAlignmentAnnotation().length;\r
+      if (al.getAlignmentAnnotation() != null)\r
+      {\r
+        existingAnnotations = al.getAlignmentAnnotation().length;\r
+      }\r
 \r
       int alWidth = al.getWidth();\r
 \r
@@ -271,8 +304,10 @@ public class AnnotationFile
       boolean jvAnnotationFile = false;\r
       while ( (line = in.readLine()) != null)\r
       {\r
-        if (line.indexOf("#") == 0 )\r
+        if (line.indexOf("#") == 0)\r
+        {\r
           continue;\r
+        }\r
 \r
         if (line.indexOf("JALVIEW_ANNOTATION") > -1)\r
         {\r
@@ -281,7 +316,7 @@ public class AnnotationFile
         }\r
       }\r
 \r
-      if(!jvAnnotationFile)\r
+      if (!jvAnnotationFile)\r
       {\r
         in.close();\r
         return false;\r
@@ -289,20 +324,22 @@ public class AnnotationFile
 \r
       while ( (line = in.readLine()) != null)\r
       {\r
-        if(line.indexOf("#")==0\r
-           || line.indexOf("JALVIEW_ANNOTATION")>-1\r
-           || line.length()==0)\r
+        if (line.indexOf("#") == 0\r
+            || line.indexOf("JALVIEW_ANNOTATION") > -1\r
+            || line.length() == 0)\r
+        {\r
           continue;\r
+        }\r
 \r
         st = new StringTokenizer(line, "\t");\r
         token = st.nextToken();\r
-        if(token.equalsIgnoreCase("COLOUR"))\r
+        if (token.equalsIgnoreCase("COLOUR"))\r
         {\r
           colourAnnotations(al, st.nextToken(), st.nextToken());\r
           continue;\r
         }\r
 \r
-        else if(token.equalsIgnoreCase("COMBINE") )\r
+        else if (token.equalsIgnoreCase("COMBINE"))\r
         {\r
           combineAnnotations(al, st);\r
           continue;\r
@@ -314,46 +351,50 @@ public class AnnotationFile
           continue;\r
         }\r
 \r
-\r
-        else if(token.equalsIgnoreCase("SEQUENCE_REF") )\r
+        else if (token.equalsIgnoreCase("SEQUENCE_REF"))\r
         {\r
           refSeq = al.findName(st.nextToken());\r
-          try{\r
+          try\r
+          {\r
             refSeqIndex = Integer.parseInt(st.nextToken());\r
-            if(refSeqIndex<1)\r
+            if (refSeqIndex < 1)\r
             {\r
               refSeqIndex = 1;\r
-              System.out.println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");\r
+              System.out.println(\r
+                  "WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");\r
             }\r
           }\r
-          catch(Exception ex)\r
+          catch (Exception ex)\r
           {\r
             refSeqIndex = 1;\r
           }\r
 \r
-          continue;\r
+          continue ;\r
         }\r
 \r
-        else if(token.equalsIgnoreCase("SEQUENCE_GROUP"))\r
+        else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))\r
         {\r
           addGroup(al, st);\r
           continue;\r
         }\r
 \r
-        else if(token.equalsIgnoreCase("PROPERTIES"))\r
+        else if (token.equalsIgnoreCase("PROPERTIES"))\r
         {\r
           addProperties(al, st);\r
           continue;\r
         }\r
 \r
-\r
         graphStyle = AlignmentAnnotation.getGraphValueFromString(token);\r
         label = st.nextToken();\r
 \r
-        if(st.countTokens()>1)\r
+        if (st.countTokens() > 1)\r
+        {\r
           description = st.nextToken();\r
+        }\r
         else\r
+        {\r
           description = null;\r
+        }\r
 \r
         line = st.nextToken();\r
 \r
@@ -363,14 +404,15 @@ public class AnnotationFile
         index = 0;\r
         boolean emptyColumn = true;\r
 \r
-\r
-        while (st.hasMoreElements() && index<alWidth)\r
+        while (st.hasMoreElements() && index < alWidth)\r
         {\r
           token = st.nextToken().trim();\r
-          if(token.equals("|"))\r
+          if (token.equals("|"))\r
           {\r
-            if(emptyColumn)\r
+            if (emptyColumn)\r
+            {\r
               index++;\r
+            }\r
 \r
             emptyColumn = true;\r
           }\r
@@ -381,28 +423,31 @@ public class AnnotationFile
           }\r
         }\r
 \r
-       annotation = new AlignmentAnnotation(label,\r
-                                          description,\r
-                                          annotations,\r
-                                          0,\r
-                                          0,\r
-                                          graphStyle);\r
+        annotation = new AlignmentAnnotation(label,\r
+                                             description,\r
+                                             annotations,\r
+                                             0,\r
+                                             0,\r
+                                             graphStyle);\r
 \r
-       if(refSeq!=null)\r
-       {\r
-         annotation.createSequenceMapping(refSeq, refSeqIndex, false);\r
-         refSeq.addAlignmentAnnotation(annotation);\r
-       }\r
+        if (refSeq != null)\r
+        {\r
+          annotation.createSequenceMapping(refSeq, refSeqIndex, false);\r
+          refSeq.addAlignmentAnnotation(annotation);\r
+        }\r
 \r
-       al.addAnnotation(annotation);\r
+        al.addAnnotation(annotation);\r
 \r
-       al.setAnnotationIndex(annotation,  al.getAlignmentAnnotation().length - existingAnnotations-1);\r
+        al.setAnnotationIndex(annotation,\r
+                              al.getAlignmentAnnotation().length - existingAnnotations -\r
+                              1);\r
       }\r
 \r
-    }catch(Exception ex)\r
+    }\r
+    catch (Exception ex)\r
     {\r
       ex.printStackTrace();\r
-      System.out.println("Problem reading annotation file: "+ex);\r
+      System.out.println("Problem reading annotation file: " + ex);\r
       return false;\r
     }\r
     return true;\r
@@ -410,45 +455,56 @@ public class AnnotationFile
 \r
   Annotation parseAnnotation(String string)\r
   {\r
-    String desc = null, displayChar="";\r
+    String desc = null, displayChar = "";\r
     char ss = ' '; // secondaryStructure\r
     float value = 0;\r
     boolean parsedValue = false;\r
     StringTokenizer st = new StringTokenizer(string, ",");\r
     String token;\r
-    while(st.hasMoreTokens())\r
+    while (st.hasMoreTokens())\r
     {\r
       token = st.nextToken().trim();\r
-      if(token.length()==0)\r
+      if (token.length() == 0)\r
+      {\r
         continue;\r
+      }\r
 \r
-      if(!parsedValue)\r
+      if (!parsedValue)\r
       {\r
-        try{\r
+        try\r
+        {\r
           displayChar = token;\r
           value = new Float(token).floatValue();\r
           parsedValue = true;\r
           continue;\r
-        }catch(NumberFormatException ex){}\r
+        }\r
+        catch (NumberFormatException ex)\r
+        {}\r
       }\r
 \r
-      if(token.equals("H") || token.equals("E"))\r
+      if (token.equals("H") || token.equals("E"))\r
       {\r
         // Either this character represents a helix or sheet\r
         // or an integer which can be displayed\r
         ss = token.charAt(0);\r
-        if(displayChar.equals(token.substring(0,1)))\r
+        if (displayChar.equals(token.substring(0, 1)))\r
+        {\r
           displayChar = "";\r
+        }\r
       }\r
-      else if(desc==null)\r
+      else if (desc == null)\r
+      {\r
         desc = token;\r
+      }\r
 \r
     }\r
 \r
-    if(desc == null)\r
-      desc = value+"";\r
+    if (desc == null)\r
+    {\r
+      desc = value + "";\r
+    }\r
 \r
-    if(displayChar.length()>1 && desc.length()==1)\r
+    if (displayChar.length() > 1 && desc.length() == 1)\r
     {\r
       String tmp = displayChar;\r
       displayChar = desc;\r
@@ -462,15 +518,17 @@ public class AnnotationFile
   {\r
     UserColourScheme ucs = new UserColourScheme(colour);\r
     Annotation[] annotations;\r
-    for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+    for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
     {\r
-      if(al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))\r
+      if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))\r
       {\r
         annotations = al.getAlignmentAnnotation()[i].annotations;\r
-        for(int j=0; j<annotations.length; j++)\r
+        for (int j = 0; j < annotations.length; j++)\r
         {\r
-          if(annotations[j]!=null)\r
+          if (annotations[j] != null)\r
+          {\r
             annotations[j].colour = ucs.findColour('A');\r
+          }\r
         }\r
       }\r
     }\r
@@ -481,21 +539,21 @@ public class AnnotationFile
     int graphGroup = -1;\r
     String group = st.nextToken();\r
     //First make sure we are not overwriting the graphIndex\r
-    for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+    for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
     {\r
-      if(al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
+      if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
       {\r
-        graphGroup = al.getAlignmentAnnotation()[i].graphGroup +1;\r
+        graphGroup = al.getAlignmentAnnotation()[i].graphGroup + 1;\r
         al.getAlignmentAnnotation()[i].graphGroup = graphGroup;\r
         break;\r
       }\r
     }\r
 \r
     //Now update groups\r
-    while(st.hasMoreTokens())\r
+    while (st.hasMoreTokens())\r
     {\r
       group = st.nextToken();\r
-      for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+      for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
       {\r
         if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
         {\r
@@ -520,12 +578,14 @@ public class AnnotationFile
       }\r
     }\r
 \r
-    if(annotation==null)\r
+    if (annotation == null)\r
+    {\r
       return;\r
+    }\r
     float value = new Float(st.nextToken()).floatValue();\r
-    String label = st.hasMoreTokens() ?  st.nextToken() : null;\r
+    String label = st.hasMoreTokens() ? st.nextToken() : null;\r
     java.awt.Color colour = null;\r
-    if(st.hasMoreTokens())\r
+    if (st.hasMoreTokens())\r
     {\r
       UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
       colour = ucs.findColour('A');\r
@@ -538,11 +598,11 @@ public class AnnotationFile
   {\r
     SequenceGroup sg = new SequenceGroup();\r
     sg.setName(st.nextToken());\r
-    sg.setStartRes(Integer.parseInt(st.nextToken())-1);\r
-    sg.setEndRes(Integer.parseInt(st.nextToken())-1);\r
+    sg.setStartRes(Integer.parseInt(st.nextToken()) - 1);\r
+    sg.setEndRes(Integer.parseInt(st.nextToken()) - 1);\r
 \r
     String index = st.nextToken();\r
-    if(index.equals("-1"))\r
+    if (index.equals("-1"))\r
     {\r
       while (st.hasMoreElements())\r
       {\r
@@ -571,23 +631,27 @@ public class AnnotationFile
           int end = (Integer.parseInt(st3.nextToken()));\r
 \r
           if (end > start)\r
+          {\r
             for (int i = start; i <= end; i++)\r
-              sg.addSequence(al.getSequenceAt(i-1), false);\r
+            {\r
+              sg.addSequence(al.getSequenceAt(i - 1), false);\r
+            }\r
+          }\r
         }\r
         else\r
         {\r
-          sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp)-1 ), false);\r
+          sg.addSequence(al.getSequenceAt(Integer.parseInt(tmp) - 1), false);\r
         }\r
       }\r
     }\r
 \r
-    if(refSeq!=null)\r
+    if (refSeq != null)\r
     {\r
-      sg.setStartRes( refSeq.findIndex( sg.getStartRes()+1 )-1 );\r
-      sg.setEndRes(   refSeq.findIndex( sg.getEndRes() +1) -1 );\r
+      sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);\r
+      sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);\r
     }\r
 \r
-    if(sg.getSize()>0)\r
+    if (sg.getSize() > 0)\r
     {\r
       al.addGroup(sg);\r
     }\r
@@ -599,35 +663,45 @@ public class AnnotationFile
     //So far we have only added groups to the annotationHash,\r
     //the idea is in the future properties can be added to\r
     //alignments, other annotations etc\r
-    if(al.getGroups()==null)\r
+    if (al.getGroups() == null)\r
+    {\r
       return;\r
+    }\r
     SequenceGroup sg = null;\r
 \r
     String name = st.nextToken();\r
 \r
     Vector groups = al.getGroups();\r
-    for(int i=0; i<groups.size(); i++)\r
+    for (int i = 0; i < groups.size(); i++)\r
     {\r
-      sg = (SequenceGroup)groups.elementAt(i);\r
-      if(sg.getName().equals(name))\r
+      sg = (SequenceGroup) groups.elementAt(i);\r
+      if (sg.getName().equals(name))\r
+      {\r
         break;\r
+      }\r
       else\r
+      {\r
         sg = null;\r
+      }\r
     }\r
 \r
-    if(sg!=null)\r
+    if (sg != null)\r
     {\r
       String keyValue, key, value;\r
-      while(st.hasMoreTokens())\r
+      while (st.hasMoreTokens())\r
       {\r
         keyValue = st.nextToken();\r
-        key = keyValue.substring(0,keyValue.indexOf("="));\r
-        value=keyValue.substring(keyValue.indexOf("=")+1);\r
+        key = keyValue.substring(0, keyValue.indexOf("="));\r
+        value = keyValue.substring(keyValue.indexOf("=") + 1);\r
 \r
-        if(key.equalsIgnoreCase("description"))\r
+        if (key.equalsIgnoreCase("description"))\r
+        {\r
           sg.setDescription(value);\r
-        else if(key.equalsIgnoreCase("colour"))\r
+        }\r
+        else if (key.equalsIgnoreCase("colour"))\r
+        {\r
           sg.cs = ColourSchemeProperty.getColour(al, value);\r
+        }\r
         else if (key.equalsIgnoreCase("pidThreshold"))\r
         {\r
           sg.cs.setThreshold(Integer.parseInt(value), true);\r
@@ -637,39 +711,47 @@ public class AnnotationFile
         {\r
           sg.cs.setConservationInc(Integer.parseInt(value));\r
           Conservation c = new Conservation("Group",\r
-                    ResidueProperties.propHash, 3,\r
-                    sg.getSequences(null),\r
-                    sg.getStartRes(),\r
-                    sg.getEndRes() + 1);\r
+                                            ResidueProperties.propHash, 3,\r
+                                            sg.getSequences(null),\r
+                                            sg.getStartRes(),\r
+                                            sg.getEndRes() + 1);\r
 \r
-            c.calculate();\r
-            c.verdict(false, 25);\r
+          c.calculate();\r
+          c.verdict(false, 25);\r
 \r
-            sg.cs.setConservation(c);\r
+          sg.cs.setConservation(c);\r
 \r
         }\r
         else if (key.equalsIgnoreCase("outlineColour"))\r
-         {\r
-           sg.setOutlineColour(new UserColourScheme(value).findColour('A'));\r
-         }\r
+        {\r
+          sg.setOutlineColour(new UserColourScheme(value).findColour('A'));\r
+        }\r
         else if (key.equalsIgnoreCase("displayBoxes"))\r
-         sg.setDisplayBoxes( Boolean.valueOf(value).booleanValue() );\r
+        {\r
+          sg.setDisplayBoxes(Boolean.valueOf(value).booleanValue());\r
+        }\r
         else if (key.equalsIgnoreCase("displayText"))\r
-         sg.setDisplayText( Boolean.valueOf(value).booleanValue() );\r
+        {\r
+          sg.setDisplayText(Boolean.valueOf(value).booleanValue());\r
+        }\r
         else if (key.equalsIgnoreCase("colourText"))\r
-         sg.setColourText( Boolean.valueOf(value).booleanValue() );\r
+        {\r
+          sg.setColourText(Boolean.valueOf(value).booleanValue());\r
+        }\r
         else if (key.equalsIgnoreCase("textCol1"))\r
-         {\r
-           sg.textColour = new UserColourScheme(value).findColour('A');\r
-         }\r
+        {\r
+          sg.textColour = new UserColourScheme(value).findColour('A');\r
+        }\r
         else if (key.equalsIgnoreCase("textCol2"))\r
         {\r
           sg.textColour2 = new UserColourScheme(value).findColour('A');\r
         }\r
         else if (key.equalsIgnoreCase("textColThreshold"))\r
-         sg.thresholdTextColour = Integer.parseInt(value);\r
+        {\r
+          sg.thresholdTextColour = Integer.parseInt(value);\r
+        }\r
 \r
-       sg.recalcConservation();\r
+        sg.recalcConservation();\r
       }\r
     }\r
   }\r