Merge branch 'JABAWS_Release_2_5' into develop
[jabaws.git] / testsrc / compbio / data / sequence / SequenceUtilTester.java
index e9acca7..9468cda 100644 (file)
@@ -1,15 +1,21 @@
-/*\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
+/* Copyright (c) 2009 Peter Troshin\r
+ * Copyright (c) 2013 Alexander Sherstnev\r
+ * \r
+ *  JAva Bioinformatics Analysis Web Services (JABAWS) \r
+ *  @version: 2.5\r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under \r
+ * 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
+ * \r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt \r
+ * \r
+ * Any republication or derived work distributed in source code form must include \r
+ * this copyright and license notice.\r
  */\r
 package compbio.data.sequence;\r
 \r
@@ -35,7 +41,6 @@ import java.util.Set;
 import org.testng.annotations.Test;\r
 \r
 import compbio.metadata.AllTestSuit;\r
-import compbio.runner.disorder.Disembl;\r
 \r
 public class SequenceUtilTester {\r
 \r
@@ -128,7 +133,36 @@ public class SequenceUtilTester {
                }\r
        }\r
 \r
-       // This method tests the loading of horizontally formatted Jronn output file\r
+       // Potential Bug :- Sequence names are shortened to 2-3 letters\r
+       @Test\r
+       public void testReadFastaWriteClustal() {\r
+               \r
+               try {\r
+                       FileInputStream fio = new FileInputStream(\r
+                                       AllTestSuit.TEST_DATA_PATH + "TO1381.fasta");\r
+                       assertNotNull(fio);\r
+                       List<FastaSequence> fseqs = SequenceUtil.readFasta(fio);\r
+                       assertNotNull(fseqs);\r
+                       fio.close();\r
+                       \r
+                       char gapChar = '-';\r
+                       FileOutputStream fou = new FileOutputStream(\r
+                                       AllTestSuit.TEST_DATA_PATH + "TO1381.aln.written");\r
+                       SequenceUtil.writeClustal(fou, fseqs, gapChar);\r
+                       fou.close();\r
+                       \r
+               } catch (FileNotFoundException e) {\r
+                       e.printStackTrace();\r
+                       fail(e.getLocalizedMessage());\r
+               } catch (IOException e) {\r
+                       e.printStackTrace();\r
+                       fail(e.getLocalizedMessage());\r
+               }\r
+       }\r
+\r
+       /**\r
+        * This test tests the loading of horizontally formatted Jronn output file\r
+        */\r
        @Test\r
        public void LoadJronnFile() {\r
 \r
@@ -389,3 +423,4 @@ public class SequenceUtilTester {
                }\r
        }\r
 }\r
+\r