public static final String BJS_TEMPLATE_GIT_REPO = jalview.bin.Cache
.getDefault(
"biojs_template_git_repo",
- "https://raw.githubusercontent.com/tcofoegbu/bjs-template/master/package.json");;
+ "https://raw.githubusercontent.com/tcofoegbu/bjs-template/master/package.json");
public BioJsHTMLOutput(AlignmentPanel ap,
FeatureRenderer fr1)
import jalview.api.FeaturesDisplayedI;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.Annotation;
+import jalview.datamodel.HiddenSequences;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.json.binding.v1.AlignmentAnnotationPojo;
import jalview.json.binding.v1.AlignmentPojo;
+import jalview.json.binding.v1.AlignmentPojo.JalviewBioJsColorSchemeMapper;
import jalview.json.binding.v1.AnnotationPojo;
-import jalview.json.binding.v1.JalviewSettingsPojo;
-import jalview.json.binding.v1.JalviewSettingsPojo.JalviewBioJsColorSchemeMapper;
import jalview.json.binding.v1.SequenceFeaturesPojo;
import jalview.json.binding.v1.SequenceGrpPojo;
import jalview.json.binding.v1.SequencePojo;
{
private ColourSchemeI colourScheme;
- private String jalviewVersion;
+ private String version = "2.9";
- private String webStartLaunchServletUrl;
+ private String webstartUrl = "www.jalview.org/services/launchApp";
+
+ private String application = "Jalview";
public static final String FILE_EXT = "json";
if (jsonExportSettings.isExportJalviewSettings())
{
- jalviewVersion = "";
- webStartLaunchServletUrl = "www.jalview.org/services/launchApp";
-
- JalviewSettingsPojo jvSettings = new JalviewSettingsPojo();
- jvSettings.setGlobalColorScheme(globalColorScheme);
- jvSettings.setJalviewVersion(jalviewVersion);
- jvSettings.setWebStartUrl(webStartLaunchServletUrl);
- jvSettings.setShowSeqFeatures(showSeqFeatures);
- jsonAlignmentPojo.setJalviewSettings(jvSettings);
+ jsonAlignmentPojo.setGlobalColorScheme(globalColorScheme);
+ jsonAlignmentPojo.getAppSettings().put("application", application);
+ jsonAlignmentPojo.getAppSettings().put("version", version);
+ jsonAlignmentPojo.getAppSettings().put("webStartUrl", webstartUrl);
+ jsonAlignmentPojo.getAppSettings().put("showSeqFeatures",
+ String.valueOf(showSeqFeatures));
+
+ String[] hiddenSections = exportHiddenSections();
+ if (hiddenSections != null)
+ {
+ jsonAlignmentPojo.getAppSettings().put("hiddenCols",
+ String.valueOf(hiddenSections[0]));
+ jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
+ String.valueOf(hiddenSections[1]));
+ }
}
if (jsonExportSettings.isExportAnnotations())
return jsonOutput;
}
+ public String[] exportHiddenSections()
+ {
+ String[] hiddenSections = new String[2];
+ if (getViewport() == null)
+ {
+ return null;
+ }
+
+ System.out.println("--- Hidden Sections ---");
+ // hidden column business
+ if (getViewport().hasHiddenColumns())
+ {
+ System.out.print("Hidden Cols : ");
+ List<int[]> hiddenCols = getViewport().getColumnSelection()
+ .getHiddenColumns();
+ StringBuilder hiddenColsBuilder = new StringBuilder();
+ for (int[] range : hiddenCols)
+ {
+ hiddenColsBuilder.append(";").append(range[0]).append("-")
+ .append(range[1]);
+ }
+
+ hiddenColsBuilder.deleteCharAt(0);
+ hiddenSections[0] = hiddenColsBuilder.toString();
+ System.out.println(hiddenSections[0]);
+ }
+
+ // hidden rows/seqs business
+ HiddenSequences hiddenSeqsObj = getViewport().getAlignment()
+ .getHiddenSequences();
+ if (hiddenSeqsObj == null)
+ {
+ return hiddenSections;
+ }
+
+ SequenceI[] hiddenSeqs = hiddenSeqsObj.hiddenSequences;
+ System.out.print("Hidden Seqs : ");
+ StringBuilder hiddenSeqsBuilder = new StringBuilder();
+ for (SequenceI hiddenSeq : hiddenSeqs)
+ {
+ if (hiddenSeq != null)
+ {
+ hiddenSeqsBuilder.append(";").append(hiddenSeq.hashCode());
+ }
+ }
+ if (hiddenSeqsBuilder.length() > 0)
+ {
+ hiddenSeqsBuilder.deleteCharAt(0);
+ }
+ hiddenSections[1] = hiddenSeqsBuilder.toString();
+ System.out.println(hiddenSections[1]);
+ return hiddenSections;
+ }
+
public static List<SequenceFeaturesPojo> sequenceFeatureToJsonPojo(
List<SequenceI> seqs, FeatureRenderer fr)
{
JSONArray seqGrpJsonArray = (JSONArray) alignmentJsonObj
.get("seqGroups");
JSONObject jvSettingsJsonObj = (JSONObject) alignmentJsonObj
- .get("jalviewSettings");
+ .get("appSettings");
if (jvSettingsJsonObj != null)
{
package jalview.json.binding.v1;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ColourSchemeI;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.PurinePyrimidineColourScheme;
+import jalview.schemes.RNAInteractionColourScheme;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
public class AlignmentPojo
private List<SequenceFeaturesPojo> seqFeatures = new ArrayList<SequenceFeaturesPojo>();
- private JalviewSettingsPojo jalviewSettings;
+ HashMap<String, String> appSettings = new HashMap<String, String>();
public AlignmentPojo()
{
this.seqs = seqs;
}
- public JalviewSettingsPojo getJalviewSettings()
+ public HashMap<String, String> getAppSettings()
{
- return jalviewSettings;
+ return appSettings;
}
- public void setJalviewSettings(JalviewSettingsPojo jalviewSettings)
+ public void setAppSettings(HashMap<String, String> appSettings)
{
- this.jalviewSettings = jalviewSettings;
+ this.appSettings = appSettings;
}
public List<AlignmentAnnotationPojo> getAlignAnnotation()
{
return svid;
}
+
+ public void setGlobalColorScheme(String globalColorScheme)
+ {
+ for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper
+ .values())
+ {
+ if (cs.getJalviewName().equals(globalColorScheme))
+ {
+ // this.globalColorScheme = cs.getBioJsName();
+ this.appSettings.put("globalColorScheme", cs.getBioJsName());
+ break;
+ }
+ }
+ }
+
+ public enum JalviewBioJsColorSchemeMapper
+ {
+ USER_DEFINED("User Defined", "user defined", null), NONE("None", "foo",
+ null), CLUSTAL("Clustal", "clustal", null), ZAPPO("Zappo",
+ "zappo", new ZappoColourScheme()), TAYLOR("Taylor", "taylor",
+ new TaylorColourScheme()), NUCLEOTIDE("Nucleotide",
+ "nucleotide", new NucleotideColourScheme()), PURINE_PYRIMIDINE(
+ "Purine/Pyrimidine", "purine",
+ new PurinePyrimidineColourScheme()), HELIX_PROPENCITY(
+ "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY(
+ "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY(
+ "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX(
+ "Buried Index", "buried", new BuriedColourScheme()), HYDROPHOBIC(
+ "Hydrophobic", "hydro", new HydrophobicColourScheme()),
+
+ // The color types below are not yet supported by BioJs MSA viewer
+ T_COFFE_SCORES("T-Coffee Scores", "T-Coffee Scores", null), RNA_INT_TYPE(
+ "RNA Interaction type", "RNA Interaction type",
+ new RNAInteractionColourScheme()), BLOSUM62("Blosum62",
+ "Blosum62", new Blosum62ColourScheme()), RNA_HELICES(
+ "RNA Helices", "RNA Helices", null), PERCENTAGE_IDENTITY(
+ "% Identity", "pid", new PIDColourScheme());
+
+ private String jalviewName;
+
+ private String bioJsName;
+
+ private ColourSchemeI jvColourScheme;
+
+ private JalviewBioJsColorSchemeMapper(String jalviewName,
+ String bioJsName, ColourSchemeI jvColourScheme)
+ {
+ this.jalviewName = jalviewName;
+ this.bioJsName = bioJsName;
+ this.setJvColourScheme(jvColourScheme);
+ }
+
+ public String getJalviewName()
+ {
+ return jalviewName;
+ }
+
+ public String getBioJsName()
+ {
+ return bioJsName;
+ }
+
+ public ColourSchemeI getJvColourScheme()
+ {
+ return jvColourScheme;
+ }
+
+ public void setJvColourScheme(ColourSchemeI jvColourScheme)
+ {
+ this.jvColourScheme = jvColourScheme;
+ }
+
+ }
+
}
--- /dev/null
+package jalview.json.binding.v1;
+
+
+public class AppSettingsPojo
+{
+ // private String globalColorScheme = "none";
+
+
+
+ public AppSettingsPojo()
+ {
+
+ }
+
+ //
+ //
+ // public void setGlobalColorScheme(String globalColorScheme)
+ // {
+ // for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper
+ // .values())
+ // {
+ // if (cs.getJalviewName().equals(globalColorScheme))
+ // {
+ // // this.globalColorScheme = cs.getBioJsName();
+ // this.settings.put("globalColorScheme", cs.getBioJsName());
+ // break;
+ // }
+ // }
+ // }
+ //
+ // public enum JalviewBioJsColorSchemeMapper
+ // {
+ // USER_DEFINED("User Defined", "user defined", null), NONE("None", "foo",
+ // null), CLUSTAL("Clustal", "clustal", null), ZAPPO("Zappo",
+ // "zappo", new ZappoColourScheme()), TAYLOR("Taylor", "taylor",
+ // new TaylorColourScheme()), NUCLEOTIDE("Nucleotide",
+ // "nucleotide", new NucleotideColourScheme()), PURINE_PYRIMIDINE(
+ // "Purine/Pyrimidine", "purine",
+ // new PurinePyrimidineColourScheme()), HELIX_PROPENCITY(
+ // "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY(
+ // "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY(
+ // "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX(
+ // "Buried Index", "buried", new BuriedColourScheme()), HYDROPHOBIC(
+ // "Hydrophobic", "hydro", new HydrophobicColourScheme()),
+ //
+ // // The color types below are not yet supported by BioJs MSA viewer
+ // T_COFFE_SCORES("T-Coffee Scores", "T-Coffee Scores", null), RNA_INT_TYPE(
+ // "RNA Interaction type", "RNA Interaction type",
+ // new RNAInteractionColourScheme()), BLOSUM62("Blosum62",
+ // "Blosum62", new Blosum62ColourScheme()), RNA_HELICES(
+ // "RNA Helices", "RNA Helices", null), PERCENTAGE_IDENTITY(
+ // "% Identity", "pid", new PIDColourScheme());
+ //
+ // private String jalviewName;
+ //
+ // private String bioJsName;
+ //
+ // private ColourSchemeI jvColourScheme;
+ //
+ // private JalviewBioJsColorSchemeMapper(String jalviewName,
+ // String bioJsName, ColourSchemeI jvColourScheme)
+ // {
+ // this.jalviewName = jalviewName;
+ // this.bioJsName = bioJsName;
+ // this.setJvColourScheme(jvColourScheme);
+ // }
+ //
+ // public String getJalviewName()
+ // {
+ // return jalviewName;
+ // }
+ //
+ // public String getBioJsName()
+ // {
+ // return bioJsName;
+ // }
+ //
+ // public ColourSchemeI getJvColourScheme()
+ // {
+ // return jvColourScheme;
+ // }
+ //
+ // public void setJvColourScheme(ColourSchemeI jvColourScheme)
+ // {
+ // this.jvColourScheme = jvColourScheme;
+ // }
+ //
+ // }
+
+
+}
+++ /dev/null
-package jalview.json.binding.v1;
-
-import jalview.schemes.Blosum62ColourScheme;
-import jalview.schemes.BuriedColourScheme;
-import jalview.schemes.ColourSchemeI;
-import jalview.schemes.HelixColourScheme;
-import jalview.schemes.HydrophobicColourScheme;
-import jalview.schemes.NucleotideColourScheme;
-import jalview.schemes.PIDColourScheme;
-import jalview.schemes.PurinePyrimidineColourScheme;
-import jalview.schemes.RNAInteractionColourScheme;
-import jalview.schemes.StrandColourScheme;
-import jalview.schemes.TaylorColourScheme;
-import jalview.schemes.TurnColourScheme;
-import jalview.schemes.ZappoColourScheme;
-
-public class JalviewSettingsPojo
-{
- private String svid = "1.0";
-
- private String globalColorScheme = "none";
-
- private String jalviewVersion;
-
- private String webStartUrl;
-
- private boolean showSeqFeatures;
-
- private boolean wrapModeEnabled;
-
- public JalviewSettingsPojo()
- {
-
- }
-
- public String getGlobalColorScheme()
- {
- return globalColorScheme;
- }
-
- public void setGlobalColorScheme(String globalColorScheme)
- {
- for (JalviewBioJsColorSchemeMapper cs : JalviewBioJsColorSchemeMapper
- .values())
- {
- if (cs.getJalviewName().equals(globalColorScheme))
- {
- this.globalColorScheme = cs.getBioJsName();
- break;
- }
- }
- }
-
- public String getJalviewVersion()
- {
- return jalviewVersion;
- }
-
- public void setJalviewVersion(String jalviewVersion)
- {
- this.jalviewVersion = jalviewVersion;
- }
-
- public String getWebStartUrl()
- {
- return webStartUrl;
- }
-
- public void setWebStartUrl(String webStartUrl)
- {
- this.webStartUrl = webStartUrl;
- }
-
- public boolean isShowSeqFeatures()
- {
- return showSeqFeatures;
- }
-
- public void setShowSeqFeatures(boolean showSeqFeatures)
- {
- this.showSeqFeatures = showSeqFeatures;
- }
-
- public boolean isWrapModeEnabled()
- {
- return wrapModeEnabled;
- }
-
- public void setWrapModeEnabled(boolean wrapModeEnabled)
- {
- this.wrapModeEnabled = wrapModeEnabled;
- }
-
- public enum JalviewBioJsColorSchemeMapper
- {
- USER_DEFINED("User Defined", "user defined", null), NONE("None", "foo",
- null), CLUSTAL("Clustal", "clustal", null), ZAPPO("Zappo",
- "zappo", new ZappoColourScheme()), TAYLOR("Taylor", "taylor",
- new TaylorColourScheme()), NUCLEOTIDE("Nucleotide",
- "nucleotide", new NucleotideColourScheme()), PURINE_PYRIMIDINE(
- "Purine/Pyrimidine", "purine",
- new PurinePyrimidineColourScheme()), HELIX_PROPENCITY(
- "Helix Propensity", "helix", new HelixColourScheme()), TURN_PROPENSITY(
- "Turn Propensity", "turn", new TurnColourScheme()), STRAND_PROPENSITY(
- "Strand Propensity", "strand", new StrandColourScheme()), BURIED_INDEX(
- "Buried Index", "buried", new BuriedColourScheme()), HYDROPHOBIC(
- "Hydrophobic", "hydro", new HydrophobicColourScheme()),
-
- // The color types below are not yet supported by BioJs MSA viewer
- T_COFFE_SCORES("T-Coffee Scores", "T-Coffee Scores", null), RNA_INT_TYPE(
- "RNA Interaction type", "RNA Interaction type",
- new RNAInteractionColourScheme()), BLOSUM62("Blosum62",
- "Blosum62", new Blosum62ColourScheme()), RNA_HELICES(
- "RNA Helices", "RNA Helices", null), PERCENTAGE_IDENTITY(
- "% Identity", "pid", new PIDColourScheme());
-
- private String jalviewName;
-
- private String bioJsName;
-
- private ColourSchemeI jvColourScheme;
-
- private JalviewBioJsColorSchemeMapper(String jalviewName,
- String bioJsName, ColourSchemeI jvColourScheme)
- {
- this.jalviewName = jalviewName;
- this.bioJsName = bioJsName;
- this.setJvColourScheme(jvColourScheme);
- }
-
- public String getJalviewName()
- {
- return jalviewName;
- }
-
- public String getBioJsName()
- {
- return bioJsName;
- }
-
- public ColourSchemeI getJvColourScheme()
- {
- return jvColourScheme;
- }
-
- public void setJvColourScheme(ColourSchemeI jvColourScheme)
- {
- this.jvColourScheme = jvColourScheme;
- }
-
- }
-
- public String getSvid()
- {
- return svid;
- }
-
-}