+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2005 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
+\r
package jalview.io;\r
\r
import jalview.datamodel.*;\r
headers.addElement(id);\r
}\r
\r
- tempseq.append(str.nextToken());\r
+ if(str.hasMoreTokens())\r
+ tempseq.append(str.nextToken());\r
}\r
}\r
}\r
}\r
} catch (IOException e) {\r
System.err.println("Exception parsing clustal file " + e);\r
- e.stacktrace();\r
+ e.printStackTrace();\r
}\r
\r
if (flag) {\r
return print(getSeqsAsArray());\r
}\r
public static String print(SequenceI[] s) {\r
+\r
StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
\r
int max = 0;\r
int start = i*len;\r
int end = start + len;\r
\r
- if (end < s[j].getSequence().length() && start < s[j].getSequence().length() ) {\r
- out.append(s[j].getSequence().substring(start,end) + "\n");\r
- } else {\r
- if (start < s[j].getSequence().length()) {\r
- out.append(s[j].getSequence().substring(start) + "\n");\r
- }\r
+ if (end < s[j].getSequence().length() && start < s[j].getSequence().length() )\r
+ out.append(s[j].getSequence().substring(start,end));\r
+ else\r
+ {\r
+ if (start < s[j].getSequence().length())\r
+ out.append(s[j].getSequence().substring(start));\r
}\r
+ out.append("\n");\r
j++;\r
}\r
out.append("\n");\r
\r
}\r
+\r
return out.toString();\r
}\r
\r