JAL-2643 updated threshold on threshold value focus lost
[jalview.git] / src / jalview / io / FeaturesFile.java
index afc00ee..e1fccaf 100755 (executable)
@@ -373,20 +373,23 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
       Color colour = ColorUtils.createColourFromName(ft);
       featureColours.put(ft, new FeatureColour(colour));
     }
-    SequenceFeature sf = new SequenceFeature(ft, desc, "", startPos,
-            endPos, featureGroup);
+    SequenceFeature sf = null;
     if (gffColumns.length > 6)
     {
       float score = Float.NaN;
       try
       {
         score = new Float(gffColumns[6]).floatValue();
-        // update colourgradient bounds if allowed to
       } catch (NumberFormatException ex)
       {
-        // leave as NaN
+        sf = new SequenceFeature(ft, desc, startPos, endPos, featureGroup);
       }
-      sf.setScore(score);
+      sf = new SequenceFeature(ft, desc, startPos, endPos, score,
+              featureGroup);
+    }
+    else
+    {
+      sf = new SequenceFeature(ft, desc, startPos, endPos, featureGroup);
     }
 
     parseDescriptionHTML(sf, removeHTML);
@@ -542,12 +545,15 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
             .toArray(new String[visible.keySet().size()]);
 
     /*
-     * sort groups alphabetically, and ensure that null group is output last
+     * sort groups alphabetically, and ensure that features with a
+     * null or empty group are output after those in named groups
      */
     List<String> sortedGroups = new ArrayList<String>(visibleFeatureGroups);
     sortedGroups.remove(null);
+    sortedGroups.remove("");
     Collections.sort(sortedGroups);
     sortedGroups.add(null);
+    sortedGroups.add("");
 
     boolean foundSome = false;
 
@@ -570,7 +576,8 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
 
     for (String group : sortedGroups)
     {
-      if (group != null)
+      boolean isNamedGroup = (group != null && !"".equals(group));
+      if (isNamedGroup)
       {
         out.append(newline);
         out.append("STARTGROUP").append(TAB);
@@ -598,7 +605,7 @@ public class FeaturesFile extends AlignFile implements FeaturesSourceI
         }
       }
 
-      if (group != null)
+      if (isNamedGroup)
       {
         out.append("ENDGROUP").append(TAB);
         out.append(group);