use 1 & -1 if start/end not specified
authoramwaterhouse <Andrew Waterhouse>
Fri, 29 Jul 2005 09:53:09 +0000 (09:53 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 29 Jul 2005 09:53:09 +0000 (09:53 +0000)
src/jalview/io/BLCFile.java
src/jalview/io/ClustalFile.java
src/jalview/io/MSFfile.java
src/jalview/io/PIRFile.java
src/jalview/io/PfamFile.java
src/jalview/io/PileUpfile.java

index 074e6ce..ab41f08 100755 (executable)
@@ -155,8 +155,8 @@ public class BLCFile extends AlignFile
                         else\r
                         {\r
                             ids.addElement(line.substring(abracket + 1));\r
-                            starts.addElement("0");\r
-                            ends.addElement("0");\r
+                            starts.addElement("1");\r
+                            ends.addElement("-1");\r
                         }\r
                     }\r
                 }\r
index 74cb2d0..71e86b3 100755 (executable)
@@ -121,7 +121,7 @@ public class ClustalFile
       //Add sequences to the hash\r
       for (i = 0; i < headers.size(); i++)\r
       {\r
-        int start = -1;\r
+        int start = 1;\r
         int end = -1;\r
 \r
         if (seqhash.get(headers.elementAt(i)) != null)\r
@@ -134,8 +134,6 @@ public class ClustalFile
           }\r
 \r
           String head = headers.elementAt(i).toString();\r
-          start = 1;\r
-          end = seqhash.get(headers.elementAt(i)).toString().length();\r
 \r
           if (head.indexOf("/") > 0)\r
           {\r
index 5f81215..8e452e6 100755 (executable)
@@ -151,7 +151,7 @@ public class MSFfile extends AlignFile
                 String seq = seqhash.get(head).toString();\r
 \r
                 int start = 1;\r
-                int end = seq.length();\r
+                int end =  -1;\r
 \r
                 if (maxLength < head.length())\r
                 {\r
index a15a4cb..0a24601 100755 (executable)
@@ -56,19 +56,33 @@ public class PIRFile
 \r
       while ( (line = nextLine()) != null)\r
       {\r
-        try\r
+        if(line.length()==0)\r
         {\r
-          id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
-          line = line.substring(line.indexOf("/") + 1);\r
-          start = line.substring(0, line.indexOf("-"));\r
-          end = line.substring(line.indexOf("-") + 1);\r
+          //System.out.println("blank line");\r
+          continue;\r
         }\r
-        catch (Exception ex)\r
+\r
+        id = "No id";\r
+        start = "1";\r
+        end = "-1";\r
+\r
+        try\r
         {\r
-          id = "No id";\r
-          start = "0";\r
-          end = "0";\r
+          int slashIndex = line.indexOf("/");\r
+          if(slashIndex!=-1)\r
+          {\r
+            id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
+            line = line.substring(line.indexOf("/") + 1);\r
+            start = line.substring(0, line.indexOf("-"));\r
+            end = line.substring(line.indexOf("-") + 1);\r
+          }\r
+          else\r
+          {\r
+            id = line.substring(line.indexOf(";")+1);\r
+          }\r
         }\r
+        catch (Exception ex)\r
+        {    }// Default id, start and end unchanged\r
 \r
         sequence = new StringBuffer();\r
 \r
@@ -76,24 +90,29 @@ public class PIRFile
 \r
         boolean starFound = false;\r
 \r
-        do\r
+        while(!starFound)\r
         {\r
           line = nextLine();\r
           sequence.append(line);\r
 \r
+          if (line == null)\r
+            break;\r
+\r
           if (line.indexOf("*") > -1)\r
           {\r
             starFound = true;\r
           }\r
         }\r
-        while (!starFound);\r
 \r
-        sequence.setLength(sequence.length() - 1);\r
+        if(sequence.length()>0)\r
+        {\r
+          sequence.setLength(sequence.length() - 1);\r
 \r
-        Sequence newSeq = new Sequence(id, sequence.toString(),\r
-                                       Integer.parseInt(start),\r
-                                       Integer.parseInt(end));\r
-        seqs.addElement(newSeq);\r
+          Sequence newSeq = new Sequence(id, sequence.toString(),\r
+                                         Integer.parseInt(start),\r
+                                         Integer.parseInt(end));\r
+          seqs.addElement(newSeq);\r
+        }\r
       }\r
     }\r
     catch (Exception ex)\r
index a6c7a4f..9a6ca54 100755 (executable)
@@ -115,7 +115,7 @@ public class PfamFile
 \r
         String head = headers.elementAt(i).toString();\r
         int start = 1;\r
-        int end = seqhash.get(headers.elementAt(i)).toString().length();\r
+        int end = -1;\r
 \r
         if (head.indexOf("/") > 0)\r
         {\r
@@ -133,11 +133,6 @@ public class PfamFile
               start = Integer.valueOf(st.nextToken()).intValue();\r
               end = Integer.valueOf(st.nextToken()).intValue();\r
             }\r
-            else\r
-            {\r
-              start = -1;\r
-              end = -1;\r
-            }\r
           }\r
           else\r
           {\r
@@ -151,22 +146,11 @@ public class PfamFile
 \r
         Sequence newSeq = null;\r
 \r
-        if ( (start != -1) && (end != -1))\r
-        {\r
-          newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                seqhash.get(headers.elementAt(i).toString())\r
-                                .toString(), start, end);\r
-          seqs.addElement(newSeq);\r
-        }\r
-        else\r
-        {\r
-          newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                seqhash.get(headers.elementAt(i).toString())\r
-                                .toString(), 1,\r
-                                seqhash.get(headers.elementAt(i).toString())\r
-                                .toString().length());\r
-          seqs.addElement(newSeq);\r
-        }\r
+        newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                              seqhash.get(headers.elementAt(i).toString())\r
+                              .toString(), start, end);\r
+        seqs.addElement(newSeq);\r
+\r
 \r
         if (!isValidProteinSequence(newSeq.getSequence()))\r
         {\r
index c200c5e..728d1c6 100755 (executable)
@@ -131,7 +131,7 @@ public class PileUpfile
         String seq = seqhash.get(head).toString();\r
 \r
         int start = 1;\r
-        int end = seq.length();\r
+        int end = -1;\r
 \r
         if (maxLength < head.length())\r
         {\r