- while ((line = nextLine()) != null)\r
- {\r
- StringTokenizer str = new StringTokenizer(line);\r
-\r
- while (str.hasMoreTokens())\r
- {\r
- String inStr = str.nextToken();\r
-\r
- //If line has header information add to the headers vector\r
- if (inStr.indexOf("Name:") != -1)\r
- {\r
- key = str.nextToken();\r
- headers.addElement(key);\r
- }\r
-\r
- //if line has // set SeqFlag to 1 so we know sequences are coming\r
- if (inStr.indexOf("//") != -1)\r
- {\r
- seqFlag = true;\r
- }\r
-\r
- //Process lines as sequence lines if seqFlag is set\r
- if ((inStr.indexOf("//") == -1) && (seqFlag == true))\r
- {\r
- //seqeunce id is the first field\r
- key = inStr;\r
-\r
- StringBuffer tempseq;\r
-\r
- //Get sequence from hash if it exists\r
- if (seqhash.containsKey(key))\r
- {\r
- tempseq = (StringBuffer) seqhash.get(key);\r
- }\r
- else\r
- {\r
- tempseq = new StringBuffer();\r
- seqhash.put(key, tempseq);\r
- }\r
-\r
- //loop through the rest of the words\r
- while (str.hasMoreTokens())\r
- {\r
- //append the word to the sequence\r
- tempseq.append(str.nextToken());\r
- }\r
- }\r
- }\r
- }\r
- }\r
- catch (IOException e)\r
- {\r
- System.err.println("Exception parsing MSFFile " + e);\r
- e.printStackTrace();\r
- }\r
-\r
- this.noSeqs = headers.size();\r
-\r
- //Add sequences to the hash\r
- for (i = 0; i < headers.size(); i++)\r
- {\r
- if (seqhash.get(headers.elementAt(i)) != null)\r
- {\r
- String head = headers.elementAt(i).toString();\r
- String seq = seqhash.get(head).toString();\r
-\r
- int start = -1;\r
- int end = -1;\r
-\r
- if (maxLength < head.length())\r
- {\r
- maxLength = head.length();\r
- }\r
-\r
- if (head.indexOf("/") > 0)\r
- {\r
- StringTokenizer st = new StringTokenizer(head, "/");\r
-\r
- if (st.countTokens() == 2)\r
- {\r
- head = st.nextToken();\r
-\r
- String tmp = st.nextToken();\r
- st = new StringTokenizer(tmp, "-");\r