\r
import java.io.*;\r
\r
+import java.util.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
public void parse() throws IOException\r
{\r
StringBuffer sb = new StringBuffer();\r
- int count = 0;\r
+ boolean firstLine = true;\r
\r
String line;\r
Sequence seq = null;\r
\r
+ boolean annotation = false;\r
+\r
while ((line = nextLine()) != null)\r
{\r
line = line.trim();\r
if (line.length() > 0)\r
{\r
- if (line.charAt(0)=='>')\r
+ if (line.charAt(0)=='>')\r
{\r
- if (count != 0)\r
+ if (line.startsWith(">#_"))\r
+ {\r
+ if (annotation)\r
{\r
- if (!isValidProteinSequence(sb.toString().toCharArray()))\r
+ Annotation[] anots = new Annotation[sb.length()];\r
+ for (int i = 0; i < sb.length(); i++)\r
+ {\r
+ anots[i] = new Annotation(sb.substring(i, i+1),\r
+ null,\r
+ ' ', 0);\r
+ }\r
+ AlignmentAnnotation aa = new AlignmentAnnotation(\r
+ seq.getName().substring(2), seq.getDescription(),\r
+ anots);\r
+\r
+ annotations.add(aa);\r
+ }\r
+ annotation = true;\r
+ }\r
+ else\r
+ annotation = false;\r
+\r
+ if (!firstLine)\r
+ {\r
+ if (!annotation && !isValidProteinSequence(sb.toString().toCharArray()))\r
{\r
throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r
+" : "+seq.getName()\r
}\r
\r
seq.setSequence(sb.toString());\r
- seqs.addElement(seq);\r
+\r
+ if (!annotation)\r
+ seqs.addElement(seq);\r
}\r
\r
seq = parseId(line.substring(1));\r
+ firstLine = false;\r
\r
- count++;\r
sb = new StringBuffer();\r
}\r
else\r
}\r
}\r
\r
- if (count > 0)\r
+ if (annotation)\r
+ {\r
+ Annotation[] anots = new Annotation[sb.length()];\r
+ for (int i = 0; i < sb.length(); i++)\r
+ {\r
+ anots[i] = new Annotation(sb.substring(i, i + 1),\r
+ null,\r
+ ' ', 0);\r
+ }\r
+ AlignmentAnnotation aa = new AlignmentAnnotation(\r
+ seq.getName().substring(2), seq.getDescription(),\r
+ anots);\r
+\r
+ annotations.add(aa);\r
+ }\r
+\r
+ else if (!firstLine)\r
{\r
+\r
if (!isValidProteinSequence(sb.toString().toCharArray()))\r
{\r
throw new IOException(AppletFormatAdapter.INVALID_CHARACTERS\r