added (and enabled) switch to store gff source string as sequencefeature.group rather...
authorjprocter <Jim Procter>
Mon, 15 Dec 2008 10:35:09 +0000 (10:35 +0000)
committerjprocter <Jim Procter>
Mon, 15 Dec 2008 10:35:09 +0000 (10:35 +0000)
src/jalview/io/FeaturesFile.java

index 5058e5f..17ff88f 100755 (executable)
@@ -36,6 +36,11 @@ import jalview.schemes.*;
 public class FeaturesFile extends AlignFile\r
 {\r
   /**\r
+   * work around for GFF interpretation bug where source string becomes description rather than a group\r
+   */\r
+  private boolean doGffSource = true;\r
+\r
+  /**\r
    * Creates a new FeaturesFile object.\r
    */\r
   public FeaturesFile()\r
@@ -161,17 +166,34 @@ public class FeaturesFile extends AlignFile
             if (seq != null)\r
             {\r
               desc = st.nextToken();\r
+              String group=null;\r
+              if (doGffSource && desc.indexOf(' ')==-1) {\r
+                // could also be a source term rather than description line\r
+                group = new String(desc);\r
+              }\r
               type = st.nextToken();\r
               try\r
               {\r
-                start = Integer.parseInt(st.nextToken());\r
+                String stt = st.nextToken();\r
+                if (stt.length()==0 || stt.equals("-"))\r
+                {\r
+                  start = 0;\r
+                } else {\r
+                start = Integer.parseInt(stt);\r
+                }\r
               } catch (NumberFormatException ex)\r
               {\r
                 start = 0;\r
               }\r
               try\r
               {\r
-                end = Integer.parseInt(st.nextToken());\r
+                String stt = st.nextToken();\r
+                if (stt.length()==0 || stt.equals("-"))\r
+                {\r
+                  end = -1;\r
+                } else {\r
+                  end = Integer.parseInt(stt);\r
+                }\r
               } catch (NumberFormatException ex)\r
               {\r
                 end = -1;\r
@@ -184,7 +206,7 @@ public class FeaturesFile extends AlignFile
                 score = 0;\r
               }\r
 \r
-              sf = new SequenceFeature(type, desc, start, end, score, null);\r
+              sf = new SequenceFeature(type, desc, start, end, score, group);\r
 \r
               try\r
               {\r