From ea1d4d6aea6e27d9acb776763260ab1abc700ed0 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Wed, 16 Sep 2015 14:53:11 +0100 Subject: [PATCH] JAL-1881 Bugfix for annotation import from BioJS --- src/jalview/io/BioJsHTMLOutput.java | 8 ++------ src/jalview/io/JSONFile.java | 9 ++++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java index 9b9be60..1f4c53a 100644 --- a/src/jalview/io/BioJsHTMLOutput.java +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -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( diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index a0a8cb1..0c0f395 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -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; -- 1.7.10.2