+ while ((data = reader.readLine()) != null)\r
+ {\r
+ data = data.toUpperCase();\r
+\r
+ if ((data.indexOf("#") == 0) || (data.length() < 1))\r
+ {\r
+ continue;\r
+ }\r
+\r
+ if (data.indexOf("PILEUP") > -1)\r
+ {\r
+ reply = "PileUp";\r
+\r
+ break;\r
+ }\r
+\r
+ if ((data.indexOf("//") == 0) ||\r
+ ((data.indexOf("!!") > -1) &&\r
+ (data.indexOf("!!") < data.indexOf(\r
+ "_MULTIPLE_ALIGNMENT "))))\r
+ {\r
+ reply = "MSF";\r
+\r
+ break;\r
+ }\r
+ else if (data.indexOf("CLUSTAL") > -1)\r
+ {\r
+ reply = "CLUSTAL";\r
+\r
+ break;\r
+ }\r
+ else if ((data.indexOf(">P1;") > -1) ||\r
+ (data.indexOf(">DL;") > -1))\r
+ {\r
+ reply = "PIR";\r
+\r
+ break;\r
+ }\r
+ else if (data.indexOf(">") > -1)\r
+ {\r
+ // could be BLC file, read next line to confirm\r
+ data = reader.readLine();\r
+\r
+ if (data.indexOf(">") > -1 || data.indexOf("*") >-1 )\r
+ {\r
+ reply = "BLC";\r
+ }\r
+ else\r
+ {\r
+ reply = "FASTA";\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
+ catch (Exception ex)\r
+ {\r
+ System.err.println("File Identification failed!\n" + ex);\r
+ return error;\r
+ }\r
+ return reply;\r
+ }\r