Javadoc fixes
[jabaws.git] / datamodel / compbio / data / sequence / ClustalAlignmentUtil.java
index b6076a4..fc44c44 100644 (file)
@@ -1,15 +1,19 @@
-/*\r
- * Copyright (c) 2009 Peter Troshin JAva Bioinformatics Analysis Web Services\r
- * (JABAWS) @version: 1.0 This library is free software; you can redistribute it\r
- * and/or modify it under the terms of the Apache License version 2 as published\r
- * by the Apache Software Foundation This library is distributed in the hope\r
- * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * Apache License for more details. A copy of the license is in\r
- * apache_license.txt. It is also available here:\r
- * @see: http://www.apache.org/licenses/LICENSE-2.0.txt Any republication or\r
- * derived work distributed in source code form must include this copyright and\r
- * license notice.\r
+/* Copyright (c) 2009 Peter Troshin\r
+ *  \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * \r
+ *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ *  Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ *  License for more details.\r
+ * \r
+ *  A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
  */\r
 \r
 package compbio.data.sequence;\r
@@ -20,9 +24,7 @@ import java.io.FileInputStream;
 import java.io.IOException;\r
 import java.io.InputStream;\r
 import java.io.InputStreamReader;\r
-import java.io.OutputStream;\r
-import java.io.OutputStreamWriter;\r
-import java.io.PrintWriter;\r
+import java.io.Writer;\r
 import java.util.ArrayList;\r
 import java.util.Arrays;\r
 import java.util.HashMap;\r
@@ -36,7 +38,7 @@ import java.util.logging.Logger;
  * \r
  * @author Petr Troshin based on jimp class\r
  * \r
- *         Date September 2009\r
+ * @version 1.0 September 2009\r
  * \r
  */\r
 public final class ClustalAlignmentUtil {\r
@@ -198,17 +200,15 @@ public final class ClustalAlignmentUtil {
         * consensus. Potential bug - records 60 chars length alignment where\r
         * Clustal would have recorded 50 chars.\r
         * \r
-        * @param outStream\r
+        * @param out\r
         * \r
         * @param alignment\r
         * @throws IOException\r
         */\r
-       public static void writeClustalAlignment(final OutputStream outStream,\r
+       public static void writeClustalAlignment(final Writer out,\r
                        final Alignment alignment) throws IOException {\r
                List<FastaSequence> seqs = alignment.getSequences();\r
 \r
-               PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream));\r
-\r
                out.write("CLUSTAL\n\n\n");\r
 \r
                int max = 0;\r
@@ -245,9 +245,10 @@ public final class ClustalAlignmentUtil {
                                // display at most 30 characters in the name, keep the names\r
                                // 6 spaces away from the alignment for longest sequence names,\r
                                // and more than this for shorter names\r
-                               out.format("%-" + maxidLength + "s" + spacer,\r
+                               out.write(String.format(\r
+                                               "%-" + maxidLength + "s" + spacer,\r
                                                (name.length() > maxNameLength ? name.substring(0,\r
-                                                               maxidLength) : name));\r
+                                                               maxidLength) : name)));\r
                                int start = i * oneLineAlignmentLength;\r
                                int end = start + oneLineAlignmentLength;\r
 \r