resolve 1:many mappings from feature sequence ID to alignment sequence(s) with same ID
authorjprocter <Jim Procter>
Fri, 18 Jul 2008 15:05:30 +0000 (15:05 +0000)
committerjprocter <Jim Procter>
Fri, 18 Jul 2008 15:05:30 +0000 (15:05 +0000)
src/jalview/io/FeaturesFile.java

index 03a7a83..3e0314a 100755 (executable)
@@ -148,7 +148,7 @@ public class FeaturesFile extends AlignFile
           }\r
           continue;\r
         }\r
-\r
+        String seqId="";\r
         while (st.hasMoreElements())\r
         {\r
 \r
@@ -156,8 +156,8 @@ public class FeaturesFile extends AlignFile
           {\r
             // Still possible this is an old Jalview file,\r
             // which does not have type colours at the beginning\r
-            token = st.nextToken();\r
-            seq = align.findName(token, true);\r
+            seqId = token = st.nextToken();\r
+            seq = align.findName(seqId, true);\r
             if (seq != null)\r
             {\r
               desc = st.nextToken();\r
@@ -205,7 +205,10 @@ public class FeaturesFile extends AlignFile
               }\r
 \r
               seq.addSequenceFeature(sf);\r
-\r
+              while ((seq=align.findName(seq, seqId, true))!=null)\r
+              {\r
+                seq.addSequenceFeature(new SequenceFeature(sf));\r
+              }\r
               break;\r
             }\r
           }\r
@@ -231,11 +234,12 @@ public class FeaturesFile extends AlignFile
 \r
           if (!token.equals("ID_NOT_SPECIFIED"))\r
           {\r
-            seq = align.findName(token, true);\r
+            seq = align.findName(seqId=token, true);\r
             st.nextToken();\r
           }\r
           else\r
           {\r
+            seqId=null;\r
             try\r
             {\r
               index = Integer.parseInt(st.nextToken());\r
@@ -266,8 +270,6 @@ public class FeaturesFile extends AlignFile
 \r
           sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
 \r
-          seq.addSequenceFeature(sf);\r
-\r
           if (groupLink != null && removeHTML)\r
           {\r
             sf.addLink(groupLink);\r
@@ -281,6 +283,12 @@ public class FeaturesFile extends AlignFile
 \r
           parseDescriptionHTML(sf, removeHTML);\r
 \r
+          seq.addSequenceFeature(sf);\r
+\r
+          while (seqId!=null && (seq=align.findName(seq, seqId, false))!=null)\r
+          {\r
+            seq.addSequenceFeature(new SequenceFeature(sf));\r
+          }\r
           // If we got here, its not a GFFFile\r
           GFFFile = false;\r
         }\r