JAL-1641 refactored out view settings from Desktop.java
[jalview.git] / src / jalview / io / AppletFormatAdapter.java
index 39b0819..649aad3 100755 (executable)
@@ -429,6 +429,7 @@ public class AppletFormatAdapter
           afile = new FastaFile(">UNKNOWN\n" + inFile, "Paste");
           Alignment al = new Alignment(afile.getSeqsAsArray());
           afile.addAnnotations(al);
+          afile.addSeqGroups(al);
           return al;
 
         } catch (Exception ex)
@@ -539,7 +540,22 @@ public class AppletFormatAdapter
       }
        else if (format.equalsIgnoreCase(JSONFile.FILE_DESC))
        {
-       afile = new JSONFile();
+        afile = new JSONFile();
+        // Add groups to AlignFile
+        afile.seqGroups = alignment.getGroups();
+
+        // Add non auto calculated annotation to AlignFile
+        for (AlignmentAnnotation annot : alignment.getAlignmentAnnotation())
+        {
+          if (annot != null && !annot.autoCalculated)
+          {
+            if (annot.label.equals("PDB.CATempFactor"))
+            {
+              continue;
+            }
+            afile.annotations.add(annot);
+          }
+        }
        }
       else if (format.equalsIgnoreCase("RNAML"))
       {
@@ -554,17 +570,7 @@ public class AppletFormatAdapter
       afile.addJVSuffix(jvsuffix);
 
       afile.setSeqs(alignment.getSequencesArray());
-      afile.addSeqGroups(alignment);
-
-      // Add non auto calculated annotation to AlignFile
-      for (AlignmentAnnotation annot : alignment.getAlignmentAnnotation())
-      {
-        if (!annot.autoCalculated)
-        {
-          afile.annotations.add(annot);
-        }
 
-      }
 
       String afileresp = afile.print();
       if (afile.hasWarningMessage())