Parsing updates
authoramwaterhouse <Andrew Waterhouse>
Wed, 26 Oct 2005 16:22:50 +0000 (16:22 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 26 Oct 2005 16:22:50 +0000 (16:22 +0000)
src/jalview/io/AlignFile.java
src/jalview/io/FastaFile.java

index 630dc6c..c41666e 100755 (executable)
@@ -171,6 +171,7 @@ public abstract class AlignFile extends FileParse
      */\r
     Sequence parseId(String id)\r
     {\r
+      id = id.trim();\r
       Sequence seq = new Sequence("","");\r
       int space = id.indexOf(" ");\r
       if(space>-1)\r
@@ -183,9 +184,12 @@ public abstract class AlignFile extends FileParse
       StringTokenizer st;\r
       st = new StringTokenizer(id, "|");\r
 \r
-      while (st.countTokens()>2)\r
+      while (st.countTokens()>1)\r
       {\r
-        seq.addDBRef( new DBRefEntry( st.nextToken(), "0", st.nextToken()));\r
+        String a = st.nextToken();\r
+        String b = st.nextToken();\r
+        System.out.print(a+" "+b+" ");\r
+        seq.addDBRef( new DBRefEntry( a, "0", b));\r
       }\r
 \r
       if(st.hasMoreTokens())\r
index f1ce1fc..37c96f6 100755 (executable)
@@ -18,8 +18,6 @@
 */\r
 package jalview.io;\r
 \r
-import jalview.analysis.*;\r
-\r
 import jalview.datamodel.*;\r
 \r
 import java.io.*;\r
@@ -80,19 +78,16 @@ public class FastaFile extends AlignFile
         {\r
             if (line.length() > 0)\r
             {\r
-                // Do we have an id line?\r
-                // JBPNote - this code needs to be standardised to EBI/whatever for the\r
-                // >dbref/dbref/dbref|refid1|refid2|refid3 'human-readable' style of naming (should it really exist)\r
                 if (line.charAt(0)=='>')\r
                 {\r
-                    seq = parseId(line.substring(1));\r
-\r
                     if (count != 0)\r
                     {\r
                        seq.setSequence(sb.toString());\r
                        seqs.addElement(seq);\r
                     }\r
 \r
+                    seq = parseId(line.substring(1));\r
+\r
                     count++;\r
                     sb = new StringBuffer();\r
                 }\r