JAL-3692 parse multiline CDS location correctly
[jalview.git] / src / jalview / io / EmblFlatFile.java
index 900aef8..bfae4ed 100644 (file)
@@ -118,6 +118,7 @@ public class EmblFlatFile extends AlignFile // FileParse
    * 
    * @throws IOException
    */
+  @Override
   public void parse() throws IOException
   {
     String line = nextLine();
@@ -322,11 +323,14 @@ public class EmblFlatFile extends AlignFile // FileParse
       return nextLine();
     }
 
+    /*
+     * parse location - which may be over more than one line e.g. EAW51554
+     */
     CdsData data = new CdsData();
-    data.cdsLocation = tokens[2];
-    // TODO location can be over >1 line e.g. EAW51554
+    StringBuilder sb = new StringBuilder().append(tokens[2]);
+    line = parseFeatureQualifier(sb, "CDS");
+    data.cdsLocation = sb.toString();
 
-    line = nextLine();
     while (line != null)
     {
       if (!line.startsWith("FT    ")) // 4 spaces
@@ -359,7 +363,7 @@ public class EmblFlatFile extends AlignFile // FileParse
       String qualifier = line.substring(slashPos + 1, eqPos);
       String value = line.substring(eqPos + 1);
       value = removeQuotes(value);
-      StringBuilder sb = new StringBuilder().append(value);
+      sb = new StringBuilder().append(value);
       line = parseFeatureQualifier(sb, qualifier);
       String featureValue = sb.toString();
 
@@ -427,7 +431,7 @@ public class EmblFlatFile extends AlignFile // FileParse
    */
   static String removeQuotes(String value)
   {
-    if (value == null) 
+    if (value == null)
     {
       return null;
     }
@@ -493,7 +497,8 @@ public class EmblFlatFile extends AlignFile // FileParse
        * heuristic rule: most multi-line value (e.g. /product) are text,
        * so add a space for word boundary at a new line; not for translation
        */
-      if (!"translation".equals(qualifierName))
+      if (!"translation".equals(qualifierName)
+              && !"CDS".equals(qualifierName))
       {
         sb.append(" ");
       }