{\r
afile = new PfamFile(inFile, type);\r
}\r
-\r
+ else if (format.equals("JnetFile"))\r
+ {\r
+ afile = new JPredFile(inFile, type);\r
+ ((JPredFile)afile).removeNonSequences();\r
+ }\r
\r
return afile.getSeqsAsArray();\r
}\r
\r
break;\r
}\r
+ else if (data.indexOf(":")<data.indexOf(",")) // && data.indexOf(",")<data.indexOf(",", data.indexOf(",")))\r
+ {\r
+ // file looks like a concise JNet file\r
+ reply="JnetFile";\r
+ break;\r
+ }\r
}\r
\r
reader.close();\r
*/\r
package jalview.io;\r
\r
-import jalview.datamodel.*;\r
-\r
import java.io.*;\r
-\r
import java.util.*;\r
\r
+import jalview.datamodel.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
}\r
}\r
}\r
-\r
+ /* leave it to the parser user to actually check this.\r
if (noSeqs < 1)\r
{\r
throw new IOException(\r
"JpredFile Parser: No sequence in the prediction!");\r
- }\r
+ }*/\r
\r
maxLength = seq_entries.elementAt(0).toString().length();\r
\r
e.printStackTrace();\r
}\r
}\r
+ Vector annotSeqs=null;\r
+ /**\r
+ * removeNonSequences\r
+ */\r
+ public void removeNonSequences()\r
+ {\r
+ if (annotSeqs!=null)\r
+ return;\r
+ annotSeqs = new Vector();\r
+ Vector newseqs = new Vector();\r
+ int i=0;\r
+ int j=seqs.size();\r
+ for (; i<QuerySeqPosition; i++)\r
+ annotSeqs.add(seqs.get(i));\r
+ // check that no stray annotations have been added at the end.\r
+ {\r
+ SequenceI sq = (SequenceI) seqs.get(j-1);\r
+ if (sq.getName().toUpperCase().startsWith("JPRED")) {\r
+ annotSeqs.add(sq);\r
+ seqs.remove(--j);\r
+ }\r
+ }\r
+ for (; i<j; i++)\r
+ newseqs.add(seqs.get(i));\r
+\r
+ seqs.clear();\r
+ seqs = newseqs;\r
+ }\r
}\r
\r
\r