Merge branch 'bug/Jal-1696_disable-pdb_id-field-settings' into Release_2_8_3_Branch
[jalview.git] / src / jalview / io / StockholmFile.java
index 96c462c..6490d28 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -978,6 +978,7 @@ public class StockholmFile extends AlignFile
             {
               feature = ds.getSequenceFeatures()[0].type;
             }
+            // ?bug - feature may still have previous loop value
             String key = type2id(feature);
 
             if (key == null)
@@ -1027,13 +1028,21 @@ public class StockholmFile extends AlignFile
         }
         else
         {
-          label = (key = type2id(aa.label.toLowerCase())) + "_cons";
+          key = type2id(aa.label.toLowerCase());
+          if (key == null)
+          {
+            label = aa.label;
+          }
+          else
+          {
+            label = key + "_cons";
+          }
         }
-
         if (label == null)
         {
           label = aa.label;
         }
+        label = label.replace(" ", "_");
 
         out.append(new Format("%-" + maxid + "s").form("#=GC " + label
                 + " "));
@@ -1067,7 +1076,7 @@ public class StockholmFile extends AlignFile
     String ch = (annot == null) ? ((sequenceI == null) ? "-" : Character
             .toString(sequenceI.getCharAt(k)))
             : annot.displayCharacter;
-    if (key.equals("SS"))
+    if (key != null && key.equals("SS"))
     {
       if (annot == null)
       {