JAL-1881 Bugfix for annotation import from BioJS
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 16 Sep 2015 13:53:11 +0000 (14:53 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Wed, 16 Sep 2015 13:53:11 +0000 (14:53 +0100)
src/jalview/io/BioJsHTMLOutput.java
src/jalview/io/JSONFile.java

index 9b9be60..1f4c53a 100644 (file)
@@ -115,11 +115,7 @@ public class BioJsHTMLOutput
       AlignmentExportData exportData = jalview.gui.AlignFrame
               .getAlignmentForExport(JSONFile.FILE_DESC,
                       ap.getAlignViewport(), exportSettings);
-      if (exportData.getSettings().isCancelled())
-      {
-        return;
-      }
-      String jalviewAlignmentJson = new FormatAdapter(ap,
+      String bioJSON = new FormatAdapter(ap,
               exportData.getSettings()).formatSequences(JSONFile.FILE_DESC,
               exportData.getAlignment(), exportData.getOmitHidden(),
               exportData.getStartEndPostions(), ap.getAlignViewport()
@@ -127,7 +123,7 @@ public class BioJsHTMLOutput
 
       String bioJSTemplateString = getBioJsTemplateAsString();
       String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString
-              .replaceAll("#sequenceData#", jalviewAlignmentJson)
+              .replaceAll("#sequenceData#", bioJSON)
               .toString();
 
       PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(
index a0a8cb1..0c0f395 100644 (file)
@@ -503,8 +503,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
                     .valueOf(annot.get("value").toString());
             String desc = annot.get("description") == null ? null : annot
                     .get("description").toString();
-
-            char ss = annot.get("secondaryStructure") == null ? ' ' : annot
+            char ss = annot.get("secondaryStructure") == null
+                    || annot.get("secondaryStructure").toString()
+                            .equalsIgnoreCase("u0000") ? ' ' : annot
                     .get("secondaryStructure").toString().charAt(0);
             String displayChar = annot.get("displayCharacter") == null ? ""
                     : annot.get("displayCharacter").toString();
@@ -606,7 +607,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper
             .values())
     {
-      if (cs.getBioJsName().equalsIgnoreCase(bioJsColourSchemeName))
+      if (cs.getBioJsName().equalsIgnoreCase(bioJsColourSchemeName)
+              || cs.getJalviewName()
+                      .equalsIgnoreCase(bioJsColourSchemeName))
       {
         jalviewColor = cs.getJvColourScheme();
         break;