Formatting
[jalview.git] / src / jalview / io / AMSAFile.java
index 4f21875..1f3fca0 100644 (file)
@@ -1,85 +1,96 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2006 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
-* as published by the Free Software Foundation; either version 2\r
-* of the License, or (at your option) any later version.\r
-*\r
-* This program is distributed in the hope that it will be useful,\r
-* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-* GNU General Public License for more details.\r
-*\r
-* You should have received a copy of the GNU General Public License\r
-* along with this program; if not, write to the Free Software\r
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
-*/\r
+ * Jalview - A Sequence Alignment Editor and Viewer\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
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
 \r
-public class AMSAFile extends jalview.io.FastaFile\r
+public class AMSAFile\r
+    extends jalview.io.FastaFile\r
 {\r
 \r
-   AlignmentI al;\r
-    /**\r
-     * Creates a new AMSAFile object for output.\r
-     */\r
-    public AMSAFile(AlignmentI al)\r
-    {\r
-      this.al = al;\r
-    }\r
+  AlignmentI al;\r
+  /**\r
+   * Creates a new AMSAFile object for output.\r
+   */\r
+  public AMSAFile(AlignmentI al)\r
+  {\r
+    this.al = al;\r
+  }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @return DOCUMENT ME!\r
-     */\r
-    public String print()\r
-    {\r
-      super.print(getSeqsAsArray());\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @return DOCUMENT ME!\r
+   */\r
+  public String print()\r
+  {\r
+    super.print(getSeqsAsArray());\r
 \r
-      AlignmentAnnotation aa;\r
-      if (al.getAlignmentAnnotation() != null)\r
+    AlignmentAnnotation aa;\r
+    if (al.getAlignmentAnnotation() != null)\r
+    {\r
+      for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
       {\r
-        for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
+        aa = al.getAlignmentAnnotation()[i];\r
+        if (aa.autoCalculated || !aa.visible)\r
         {\r
-          aa = al.getAlignmentAnnotation()[i];\r
-          if (aa.autoCalculated || !aa.visible)\r
-            continue;\r
+          continue;\r
+        }\r
 \r
-          out.append(">#_" + aa.label);\r
-          if (aa.description != null)\r
-            out.append(" " + aa.description);\r
+        out.append(">#_" + aa.label);\r
+        if (aa.description != null)\r
+        {\r
+          out.append(" " + aa.description);\r
+        }\r
 \r
-          out.append("\n");\r
+        out.append("\n");\r
 \r
-          int nochunks = (aa.annotations.length / len) + 1;\r
+        int nochunks = (aa.annotations.length / len) + 1;\r
 \r
-          for (int j = 0; j < nochunks; j++)\r
+        for (int j = 0; j < nochunks; j++)\r
+        {\r
+          int start = j * len;\r
+          int end = start + len;\r
+          if (end > aa.annotations.length)\r
           {\r
-            int start = j * len;\r
-            int end = start + len;\r
-            if (end > aa.annotations.length)\r
-              end = aa.annotations.length;\r
+            end = aa.annotations.length;\r
+          }\r
 \r
-            String ch;\r
-            for (int k = start; k < end; k++)\r
+          String ch;\r
+          for (int k = start; k < end; k++)\r
+          {\r
+            if (aa.annotations[k] == null)\r
+            {\r
+              ch = " ";\r
+            }\r
+            else\r
             {\r
-              if (aa.annotations[k] == null)\r
-                ch = " ";\r
-              else\r
-                ch = aa.annotations[k].displayCharacter;\r
+              ch = aa.annotations[k].displayCharacter;\r
+            }\r
 \r
-              out.append(ch);\r
+            out.append(ch);\r
 \r
-            }\r
-            out.append("\n");\r
           }\r
+          out.append("\n");\r
         }\r
       }\r
-      return out.toString();\r
     }\r
+    return out.toString();\r
+  }\r
 }\r