JAL-1831 added changes to allow auto-generation of BioJSON schema from src code
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 14 Aug 2015 15:37:13 +0000 (16:37 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Fri, 14 Aug 2015 15:37:13 +0000 (16:37 +0100)
16 files changed:
src/com/github/reinert/jjschema/Attributes.java [new file with mode: 0755]
src/jalview/io/BioJsHTMLOutput.java
src/jalview/io/JSONFile.java
src/jalview/json/binding/biojs/BioJSReleasePojo.java [moved from src/jalview/json/binding/v1/BioJSReleasePojo.java with 93% similarity]
src/jalview/json/binding/biojs/BioJSRepositoryPojo.java [moved from src/jalview/json/binding/v1/BioJSRepositoryPojo.java with 98% similarity]
src/jalview/json/binding/biojson/v1/AlignmentAnnotationPojo.java [moved from src/jalview/json/binding/v1/AlignmentAnnotationPojo.java with 66% similarity]
src/jalview/json/binding/biojson/v1/AlignmentPojo.java [new file with mode: 0644]
src/jalview/json/binding/biojson/v1/AnnotationPojo.java [new file with mode: 0644]
src/jalview/json/binding/biojson/v1/AppSettingsPojo.java [moved from src/jalview/json/binding/v1/AppSettingsPojo.java with 98% similarity]
src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java [new file with mode: 0644]
src/jalview/json/binding/biojson/v1/SequenceFeaturesPojo.java [moved from src/jalview/json/binding/v1/SequenceFeaturesPojo.java with 51% similarity]
src/jalview/json/binding/biojson/v1/SequenceGrpPojo.java [moved from src/jalview/json/binding/v1/SequenceGrpPojo.java with 59% similarity]
src/jalview/json/binding/biojson/v1/SequencePojo.java [moved from src/jalview/json/binding/v1/SequencePojo.java with 53% similarity]
src/jalview/json/binding/v1/AlignmentPojo.java [deleted file]
src/jalview/json/binding/v1/AnnotationPojo.java [deleted file]
test/jalview/io/BioJsHTMLOutputTest.java

diff --git a/src/com/github/reinert/jjschema/Attributes.java b/src/com/github/reinert/jjschema/Attributes.java
new file mode 100755 (executable)
index 0000000..f6a3d47
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Danilo Reinert (daniloreinert@growbit.com)
+ *
+ * This software is dual-licensed under:
+ *
+ * - the Lesser General Public License (LGPL) version 3.0 or, at your option, any
+ *   later version;
+ * - the Apache Software License (ASL) version 2.0.
+ *
+ * The text of both licenses is available under the src/resources/ directory of
+ * this project (under the names LGPL-3.0.txt and ASL-2.0.txt respectively).
+ *
+ * Direct link to the sources:
+ *
+ * - LGPL 3.0: https://www.gnu.org/licenses/lgpl-3.0.txt
+ * - ASL 2.0: http://www.apache.org/licenses/LICENSE-2.0.txt
+ */
+
+package com.github.reinert.jjschema;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation for the attributes of JSON Schema
+ *
+ * @author reinert
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
+public @interface Attributes {
+    String $ref() default "";
+
+    String id() default "";
+
+    String title() default "";
+
+    String description() default "";
+
+    long maximum() default -1l;
+
+    boolean exclusiveMaximum() default false;
+
+    int minimum() default -1;
+
+    boolean exclusiveMinimum() default false;
+
+    String pattern() default "";
+
+    boolean required() default false;
+
+    String[] enums() default {};
+
+    int minItems() default 0;
+
+    long maxItems() default -1l;
+
+    boolean uniqueItems() default false;
+
+    int multipleOf() default 0;
+
+    int minLength() default 0;
+
+    long maxLength() default -1l;
+}
index 73be79f..528ba09 100644 (file)
@@ -3,8 +3,8 @@ package jalview.io;
 import jalview.api.AlignmentViewPanel;
 import jalview.datamodel.AlignmentExportData;
 import jalview.exceptions.NoFileSelectedException;
-import jalview.json.binding.v1.BioJSReleasePojo;
-import jalview.json.binding.v1.BioJSRepositoryPojo;
+import jalview.json.binding.biojs.BioJSReleasePojo;
+import jalview.json.binding.biojs.BioJSRepositoryPojo;
 import jalview.util.MessageManager;
 
 import java.io.BufferedInputStream;
index 89518e5..8c790cc 100644 (file)
@@ -37,13 +37,13 @@ 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.SequenceFeaturesPojo;
-import jalview.json.binding.v1.SequenceGrpPojo;
-import jalview.json.binding.v1.SequencePojo;
+import jalview.json.binding.biojson.v1.AlignmentAnnotationPojo;
+import jalview.json.binding.biojson.v1.AlignmentPojo;
+import jalview.json.binding.biojson.v1.AnnotationPojo;
+import jalview.json.binding.biojson.v1.JalviewBioJsColorSchemeMapper;
+import jalview.json.binding.biojson.v1.SequenceFeaturesPojo;
+import jalview.json.binding.biojson.v1.SequenceGrpPojo;
+import jalview.json.binding.biojson.v1.SequencePojo;
 import jalview.schemes.ColourSchemeI;
 import jalview.schemes.ColourSchemeProperty;
 import jalview.viewmodel.seqfeatures.FeaturesDisplayed;
@@ -93,7 +93,6 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
 
   private ArrayList<SequenceI> hiddenSequences;
 
-
   public JSONFile()
   {
     super();
@@ -115,6 +114,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     parse(getReader());
 
   }
+
   @Override
   public String print()
   {
@@ -188,15 +188,13 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
       if (hiddenSections != null)
       {
         if (hiddenSections[0] != null
-                && exportSettings
-                        .isExportHiddenColumns())
+                && exportSettings.isExportHiddenColumns())
         {
           jsonAlignmentPojo.getAppSettings().put("hiddenCols",
                   String.valueOf(hiddenSections[0]));
         }
         if (hiddenSections[1] != null
-                && exportSettings
-                        .isExportHiddenSequences())
+                && exportSettings.isExportHiddenSequences())
         {
           jsonAlignmentPojo.getAppSettings().put("hiddenSeqs",
                   String.valueOf(hiddenSections[1]));
@@ -215,8 +213,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
                 .setSeqFeatures(sequenceFeatureToJsonPojo(seqs, fr));
       }
 
-      if (exportSettings.isExportGroups()
-              && seqGroups != null
+      if (exportSettings.isExportGroups() && seqGroups != null
               && seqGroups.size() > 0)
       {
         for (SequenceGroup seqGrp : seqGroups)
@@ -305,8 +302,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
   public List<SequenceFeaturesPojo> sequenceFeatureToJsonPojo(
           List<SequenceI> seqs, FeatureRenderer fr)
   {
-    displayedFeatures = (fr == null) ? null : fr
-            .getFeaturesDisplayed();
+    displayedFeatures = (fr == null) ? null : fr.getFeaturesDisplayed();
     List<SequenceFeaturesPojo> sequenceFeaturesPojo = new ArrayList<SequenceFeaturesPojo>();
     for (SequenceI seq : seqs)
     {
@@ -330,8 +326,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
                   String.valueOf(seq.hashCode()));
 
           String featureColour = (fr == null) ? null : jalview.util.Format
-                  .getHexString(fr
-                  .findFeatureColour(Color.white, seq,
+                  .getHexString(fr.findFeatureColour(Color.white, seq,
                           seq.findIndex(sf.getBegin())));
           jsonFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
           jsonFeature.setXend(seq.findIndex(sf.getEnd()));
@@ -473,8 +468,8 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
         }
         ColourSchemeI grpColourScheme = getJalviewColorScheme(colourScheme);
         SequenceGroup seqGrp = new SequenceGroup(grpSeqs, grpName,
-                grpColourScheme,
-                displayBoxes, displayText, colourText, startRes, endRes);
+                grpColourScheme, displayBoxes, displayText, colourText,
+                startRes, endRes);
         seqGrp.setShowNonconserved(showNonconserved);
         seqGrp.setDescription(description);
         this.seqGroups.add(seqGrp);
@@ -503,9 +498,10 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
             String desc = annot.get("description") == null ? null : annot
                     .get("description").toString();
 
-            char ss = annot.get("secondaryStructure") == null ? ' '
-                    : annot.get("secondaryStructure").toString().charAt(0);
-            String displayChar = annot.get("displayCharacter").toString();
+            char ss = annot.get("secondaryStructure") == null ? ' ' : annot
+                    .get("secondaryStructure").toString().charAt(0);
+            String displayChar = annot.get("displayCharacter") == null ? ""
+                    : annot.get("displayCharacter").toString();
 
             annotations[count] = new Annotation(displayChar, desc, ss, val);
           }
@@ -529,9 +525,11 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
   {
     hiddenSeqRefs = new ArrayList<String>();
     String hiddenSeqs = (String) jvSettingsJson.get("hiddenSeqs");
-    if(hiddenSeqs != null && !hiddenSeqs.isEmpty()){
+    if (hiddenSeqs != null && !hiddenSeqs.isEmpty())
+    {
       String[] seqRefs = hiddenSeqs.split(";");
-      for(String seqRef : seqRefs){
+      for (String seqRef : seqRefs)
+      {
         hiddenSeqRefs.add(seqRef);
       }
     }
@@ -540,10 +538,12 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
   public void parseHiddenCols(JSONObject jvSettingsJson)
   {
     String hiddenCols = (String) jvSettingsJson.get("hiddenCols");
-    if(hiddenCols != null && !hiddenCols.isEmpty()){
+    if (hiddenCols != null && !hiddenCols.isEmpty())
+    {
       columnSelection = new ColumnSelection();
       String[] rangeStrings = hiddenCols.split(";");
-      for(String rangeString : rangeStrings){
+      for (String rangeString : rangeStrings)
+      {
         String[] range = rangeString.split("-");
         columnSelection.hideColumns(Integer.valueOf(range[0]),
                 Integer.valueOf(range[1]));
@@ -640,7 +640,6 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
     this.displayedFeatures = displayedFeatures;
   }
 
-
   public void configureForView(AlignmentViewPanel avpanel)
   {
     super.configureForView(avpanel);
@@ -704,8 +703,7 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
   {
     if (hiddenSequences == null || hiddenSequences.isEmpty())
     {
-      return new SequenceI[]
-      {};
+      return new SequenceI[] {};
     }
     synchronized (hiddenSequences)
     {
@@ -1,4 +1,4 @@
-package jalview.json.binding.v1;
+package jalview.json.binding.biojs;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -1,16 +1,22 @@
-package jalview.json.binding.v1;
+package jalview.json.binding.biojson.v1;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import com.github.reinert.jjschema.Attributes;
+
 public class AlignmentAnnotationPojo
 {
+  @Attributes(required = true, description = "Serial version id for the alignAnnotation object model")
   private String svid = "1.0";
 
+  @Attributes(required = false, description = "Label for the Alignment Annotation")
   private String label;
 
+  @Attributes(required = false, description = "Description for the Alignment Annotation")
   private String description;
 
+  @Attributes(required = false)
   private List<AnnotationPojo> annotations = new ArrayList<AnnotationPojo>();
 
   public String getLabel()
diff --git a/src/jalview/json/binding/biojson/v1/AlignmentPojo.java b/src/jalview/json/binding/biojson/v1/AlignmentPojo.java
new file mode 100644 (file)
index 0000000..2625b69
--- /dev/null
@@ -0,0 +1,112 @@
+package jalview.json.binding.biojson.v1;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.github.reinert.jjschema.Attributes;
+
+@Attributes(title="BioJSON", description="A specification for the representation and exchange of bioinformatics data")
+public class AlignmentPojo
+{
+  @Attributes(required = true, description = "Serial version identifier for <b>BioJSON</b> schema")
+  private String svid = "1.0";
+
+  @Attributes(required = true, minItems = 1, maxItems = 1999999999, description = "A sequence group is a bracket of alignment residues spanning <br>across multiple columns and rows. These can be treated as a <br>sub-alignments.")
+  private List<SequencePojo> seqs = new ArrayList<SequencePojo>();
+
+  @Attributes(required = false, minItems = 0, maxItems = 1999999999, exclusiveMaximum=true, description = "Alignment annotations stores symbols and graphs usually rendered </br>below the alignment.")
+  private List<AlignmentAnnotationPojo> alignAnnotation = new ArrayList<AlignmentAnnotationPojo>();
+
+  @Attributes(required = false, minItems = 0, maxItems = 1999999999, description = "A sequence group is a bracket of alignment residues spanning <br>across multiple columns and rows. These can be treated as a <br>sub-alignments.")
+  private List<SequenceGrpPojo> seqGroups = new ArrayList<SequenceGrpPojo>();
+
+  @Attributes(required = false, minItems = 0, maxItems = 1999999999, description = "Sequence features are associated with sequences rather than <br>alignments. A sequence feature can span across multiple <br>sequences in an alignment. They indicate features generated <br>by the same analysis process or retrieved from the same database <br>(such as Uniprot features).")
+  private List<SequenceFeaturesPojo> seqFeatures = new ArrayList<SequenceFeaturesPojo>();
+
+  @Attributes(required = false, enums = { "None", "Custom", "Clustal",
+      "Zappo", "Taylor", "Nucleotide", "Pyrimidine", "Purine", "Turn",
+      "Strand", "Buried", "Hydro" })
+  private String colourScheme;
+  
+  @Attributes(required = true, maxItems = 1, description = "This is an array of key=value pairs for storing custom application <br>specific settings")
+  Map<String, Object> appSettings = new HashMap<String, Object>();
+
+  public AlignmentPojo()
+  {
+  }
+
+  public List<SequencePojo> getSeqs()
+  {
+    return seqs;
+  }
+
+  public void setSeqs(ArrayList<SequencePojo> seqs)
+  {
+    this.seqs = seqs;
+  }
+
+  public Map<String, Object> getAppSettings()
+  {
+    return appSettings;
+  }
+
+  public void setAppSettings(Map<String, Object> appSettings)
+  {
+    this.appSettings = appSettings;
+  }
+
+  public List<AlignmentAnnotationPojo> getAlignAnnotation()
+  {
+    return alignAnnotation;
+  }
+
+  public void setAlignAnnotation(
+          List<AlignmentAnnotationPojo> alignAnnotation)
+  {
+    this.alignAnnotation = alignAnnotation;
+  }
+
+  public List<SequenceGrpPojo> getSeqGroups()
+  {
+    return seqGroups;
+  }
+
+  public void setSeqGroups(List<SequenceGrpPojo> seqGroups)
+  {
+    this.seqGroups = seqGroups;
+  }
+
+  public List<SequenceFeaturesPojo> getSeqFeatures()
+  {
+    return seqFeatures;
+  }
+
+  public void setSeqFeatures(List<SequenceFeaturesPojo> seqFeatures)
+  {
+    this.seqFeatures = seqFeatures;
+  }
+
+  public String getSvid()
+  {
+    return svid;
+  }
+
+  public void setGlobalColorScheme(String globalColorScheme)
+  {
+//       this.appSettings.put("globalColorScheme", globalColorScheme);
+  }
+
+  public String getColourScheme()
+  {
+    return colourScheme;
+  }
+
+  public void setColourScheme(String colourScheme)
+  {
+    this.colourScheme = colourScheme;
+  }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/AnnotationPojo.java b/src/jalview/json/binding/biojson/v1/AnnotationPojo.java
new file mode 100644 (file)
index 0000000..919f6ab
--- /dev/null
@@ -0,0 +1,60 @@
+package jalview.json.binding.biojson.v1;
+
+import com.github.reinert.jjschema.Attributes;
+
+public class AnnotationPojo
+{
+  @Attributes(required = false, description = "Display character for the given annotation")
+  private String displayCharacter;
+
+  @Attributes(required = false, description = "Description for the annotation")
+  private String description;
+
+  @Attributes(required = true, enums = {"E", "H", "\u0000", ")", "("}, description = "Determines what is rendered for the secondary </br>structure <ul><li>’E’ - indicates Beta Sheet/Strand <li>’H’ - indicates alpha helix </li><li> ‘\\u0000’ - indicates blank</li></ul></br>For RNA Helix (only shown when working with</br> nucleotide sequences): <ul><li> ‘(’ - indicates bases pair with columns upstream</br> (to right) </li><li> ’(’ - indicate region pairs with bases to the left</li></ul>")
+  private char secondaryStructure;
+
+  @Attributes(required = false, description = "Value of the annotation")
+  private float value;
+
+
+  public String getDisplayCharacter()
+  {
+    return displayCharacter;
+  }
+
+  public void setDisplayCharacter(String displayCharacter)
+  {
+    this.displayCharacter = displayCharacter;
+  }
+
+  public String getDescription()
+  {
+    return description;
+  }
+
+  public void setDescription(String description)
+  {
+    this.description = description;
+  }
+
+  public char getSecondaryStructure()
+  {
+    return secondaryStructure;
+  }
+
+  public void setSecondaryStructure(char secondaryStructure)
+  {
+    this.secondaryStructure = secondaryStructure;
+  }
+
+  public float getValue()
+  {
+    return value;
+  }
+
+  public void setValue(float value)
+  {
+    this.value = value;
+  }
+
+}
diff --git a/src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java b/src/jalview/json/binding/biojson/v1/JalviewBioJsColorSchemeMapper.java
new file mode 100644 (file)
index 0000000..094adad
--- /dev/null
@@ -0,0 +1,74 @@
+package jalview.json.binding.biojson.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 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;
+  }
+
+}
@@ -1,30 +1,43 @@
-package jalview.json.binding.v1;
+package jalview.json.binding.biojson.v1;
 
-import java.util.Hashtable;
+import java.util.Map;
 import java.util.Vector;
 
+import com.github.reinert.jjschema.Attributes;
+
 public class SequenceFeaturesPojo
 {
+  @Attributes(required = true, description = "Serial version id for the <b>SeqFeature</b> object")
   private String svid = "1.0";
 
-  private int xstart;
+  @Attributes(required = true, description = "Start residue position for the sequence feature")
+  private int xStart;
 
-  private int xend;
+  @Attributes(required = true, description = "End residue position for the sequence feature")
+  private int xEnd;
 
+  @Attributes(required = true, minItems = 1, maxItems = 1999999999, description = "Reference to the sequence in the alignment<br> (more like a foreign key)")
   private String sequenceRef;
 
+  @Attributes(required = true, description = "The name or type of the SequenceFeature")
   private String type;
 
+  @Attributes(required = false, description = "Score")
   private Float score;
 
+  @Attributes(required = false, description = "Description for the feature")
   private String description;
+  
+  @Attributes(required = false, description = "Additional metadata for the feature")
+  private Map<String, Object> otherDetails;
 
-  private Hashtable otherDetails;
-
+  @Attributes(required = false, description = "Fill colour")
   private String fillColor;
 
+  @Attributes(required = true, description = "Feature group")
   private String featureGroup;
 
+  @Attributes(required = false, description = "URL links associated to the feature")
   private Vector<String> links;
 
   public SequenceFeaturesPojo()
@@ -48,22 +61,22 @@ public class SequenceFeaturesPojo
 
   public int getXstart()
   {
-    return xstart;
+    return xStart;
   }
 
-  public void setXstart(int xstart)
+  public void setXstart(int xStart)
   {
-    this.xstart = xstart;
+    this.xStart = xStart;
   }
 
   public int getXend()
   {
-    return xend;
+    return xEnd;
   }
 
   public void setXend(int xend)
   {
-    this.xend = xend;
+    this.xEnd = xend;
   }
 
   public String getType()
@@ -96,12 +109,12 @@ public class SequenceFeaturesPojo
     this.description = description;
   }
 
-  public Hashtable getOtherDetails()
+  public Map<String, Object> getOtherDetails()
   {
     return otherDetails;
   }
 
-  public void setOtherDetails(Hashtable otherDetails)
+  public void setOtherDetails(Map<String, Object> otherDetails)
   {
     this.otherDetails = otherDetails;
   }
@@ -141,4 +154,12 @@ public class SequenceFeaturesPojo
     return svid;
   }
 
+//public Map<String, Object> getOtherDetails() {
+//     return otherDetails;
+//}
+//
+//public void setOtherDetails(Map<String, Object> otherDetails) {
+//     this.otherDetails = otherDetails;
+//}
+
 }
@@ -1,29 +1,42 @@
-package jalview.json.binding.v1;
+package jalview.json.binding.biojson.v1;
 
 import java.util.ArrayList;
 
+import com.github.reinert.jjschema.Attributes;
+
 public class SequenceGrpPojo
 {
+  @Attributes(required = true, description = "Serial version identifier for the <b>seqGroup</b> object model")
   private String svid = "1.0";
-
+  
+  @Attributes(required = false, description = "The Colour Scheme applied to the Sequence Group")
   private String colourScheme;
 
+  @Attributes(required = true, description = "The name assigned to the seqGroup")
   private String groupName;
 
+  @Attributes(required = false, description = "Serial version identifier for the <b>seqGroup</b> object model")
   private String description;
 
+  @Attributes(required = false, description = "Determines if the seqGroup border should be visible or not")
   private boolean displayBoxes;
 
+  @Attributes(required = false, description = "Determines if the texts of the group is displayed or not")
   private boolean displayText;
 
+  @Attributes(required = false, description = "Determines if the residues text for the group is coloured")
   private boolean colourText;
 
+  @Attributes(required = false, description = "Boolean value indicating whether residues should only be shown <br/>that are different from current reference or consensus sequence")
   private boolean showNonconserved;
 
+  @Attributes(required = true, description = "The index of the group’s first residue in the alignment space")
   private int startRes;
 
+  @Attributes(required = true, description = "The index of the group’s last residue in the alignment space")
   private int endRes;
-
+  
+  @Attributes(required = true, minItems = 1, maxItems = 1999999999, uniqueItems=true, description = "An array of the unique id's for the sequences belonging to the group")  
   private ArrayList<String> sequenceRefs = new ArrayList<String>();
 
   public String getColourScheme()
@@ -1,23 +1,33 @@
-package jalview.json.binding.v1;
+package jalview.json.binding.biojson.v1;
+
+import com.github.reinert.jjschema.Attributes;
 
 
 
 public class SequencePojo
 {
+  @Attributes(required = true, description = "Serial version identifier for the <b>seqs</b> object model")
   private String svid = "1.0";
 
+  @Attributes(required = true,minLength=3,maxLength=1999999999, description = "Sequence residue characters. An aligned sequence may contain <br>one of the following gap characters “.”, “-” or “ ”")
   private String seq;
 
+  @Attributes(required = true, description = "Sequence name")
   private String name;
 
+  @Attributes(required = false, description = "Sequence type", enums = {"DNA", "RNA", "Protein"})
   private String type;
 
+  @Attributes(required = true, description = "Unique identifier for a given Sequence")
   private String id;
-
+  
+  @Attributes(required = false, description = "The order/position of a sequence in the alignment space")
   private int order;
-
+  
+  @Attributes(required = true, description = "The index of the sequence’s first residue in its source database, <br>using a one-based numbering index system")
   private int start;
 
+  @Attributes(required = true, description = "The index of the sequence’s last residue in its source database, <br>using a one-based numbering index system")
   private int end;
 
 
diff --git a/src/jalview/json/binding/v1/AlignmentPojo.java b/src/jalview/json/binding/v1/AlignmentPojo.java
deleted file mode 100644 (file)
index 9f129f7..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-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 String svid = "1.0";
-
-  private List<SequencePojo> seqs = new ArrayList<SequencePojo>();
-
-  private List<AlignmentAnnotationPojo> alignAnnotation = new ArrayList<AlignmentAnnotationPojo>();
-
-  private List<SequenceGrpPojo> seqGroups = new ArrayList<SequenceGrpPojo>();
-
-  private List<SequenceFeaturesPojo> seqFeatures = new ArrayList<SequenceFeaturesPojo>();
-
-  HashMap<String, String> appSettings = new HashMap<String, String>();
-
-  public AlignmentPojo()
-  {
-  }
-
-  public List<SequencePojo> getSeqs()
-  {
-    return seqs;
-  }
-
-  public void setSeqs(ArrayList<SequencePojo> seqs)
-  {
-    this.seqs = seqs;
-  }
-
-  public HashMap<String, String> getAppSettings()
-  {
-    return appSettings;
-  }
-
-  public void setAppSettings(HashMap<String, String> appSettings)
-  {
-    this.appSettings = appSettings;
-  }
-
-  public List<AlignmentAnnotationPojo> getAlignAnnotation()
-  {
-    return alignAnnotation;
-  }
-
-  public void setAlignAnnotation(
-          List<AlignmentAnnotationPojo> alignAnnotation)
-  {
-    this.alignAnnotation = alignAnnotation;
-  }
-
-  public List<SequenceGrpPojo> getSeqGroups()
-  {
-    return seqGroups;
-  }
-
-  public void setSeqGroups(List<SequenceGrpPojo> seqGroups)
-  {
-    this.seqGroups = seqGroups;
-  }
-
-  public List<SequenceFeaturesPojo> getSeqFeatures()
-  {
-    return seqFeatures;
-  }
-
-  public void setSeqFeatures(List<SequenceFeaturesPojo> seqFeatures)
-  {
-    this.seqFeatures = seqFeatures;
-  }
-
-  public String getSvid()
-  {
-    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;
-    }
-
-  }
-
-}
diff --git a/src/jalview/json/binding/v1/AnnotationPojo.java b/src/jalview/json/binding/v1/AnnotationPojo.java
deleted file mode 100644 (file)
index 41eae82..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-package jalview.json.binding.v1;
-
-
-public class AnnotationPojo
-{
-  private String displayCharacter = "";
-
-  private String description;
-
-  private char secondaryStructure;
-
-  private float value;
-
-
-  public String getDisplayCharacter()
-  {
-    return displayCharacter;
-  }
-
-  public void setDisplayCharacter(String displayCharacter)
-  {
-    this.displayCharacter = displayCharacter;
-  }
-
-  public String getDescription()
-  {
-    return description;
-  }
-
-  public void setDescription(String description)
-  {
-    this.description = description;
-  }
-
-  public char getSecondaryStructure()
-  {
-    return secondaryStructure;
-  }
-
-  public void setSecondaryStructure(char secondaryStructure)
-  {
-    this.secondaryStructure = secondaryStructure;
-  }
-
-  public float getValue()
-  {
-    return value;
-  }
-
-  public void setValue(float value)
-  {
-    this.value = value;
-  }
-
-}
index 27c8a0e..2d49bf7 100644 (file)
@@ -1,7 +1,7 @@
 package jalview.io;
 
-import jalview.json.binding.v1.BioJSReleasePojo;
-import jalview.json.binding.v1.BioJSRepositoryPojo;
+import jalview.json.binding.biojs.BioJSReleasePojo;
+import jalview.json.binding.biojs.BioJSRepositoryPojo;
 
 import java.io.File;
 import java.io.IOException;