Dont load trees if copying Viewport
[jalview.git] / src / jalview / io / FastaFile.java
index 37c96f6..6e3ced8 100755 (executable)
@@ -1,6 +1,6 @@
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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
@@ -41,16 +41,6 @@ public class FastaFile extends AlignFile
     /**\r
      * Creates a new FastaFile object.\r
      *\r
-     * @param inStr DOCUMENT ME!\r
-     */\r
-    public FastaFile(String inStr)\r
-    {\r
-        super(inStr);\r
-    }\r
-\r
-    /**\r
-     * Creates a new FastaFile object.\r
-     *\r
      * @param inFile DOCUMENT ME!\r
      * @param type DOCUMENT ME!\r
      *\r
@@ -76,12 +66,20 @@ public class FastaFile extends AlignFile
 \r
         while ((line = nextLine()) != null)\r
         {\r
+            line = line.trim();\r
             if (line.length() > 0)\r
             {\r
                 if (line.charAt(0)=='>')\r
                 {\r
                     if (count != 0)\r
                     {\r
+                      if (!isValidProteinSequence(sb.toString()))\r
+                      {\r
+                        throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r
+                                              +" : "+seq.getName()\r
+                                              +" : "+invalidCharacter);\r
+                      }\r
+\r
                        seq.setSequence(sb.toString());\r
                        seqs.addElement(seq);\r
                     }\r
@@ -100,9 +98,11 @@ public class FastaFile extends AlignFile
 \r
         if (count > 0)\r
         {\r
-            if (!isValidProteinSequence(sb.toString().toUpperCase()))\r
+            if (!isValidProteinSequence(sb.toString()))\r
             {\r
-                throw new IOException("Invalid protein sequence");\r
+                throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r
+                                      +" : "+seq.getName()\r
+                                      +" : "+invalidCharacter);\r
             }\r
 \r
             seq.setSequence(sb.toString());\r