af.statusBar.setText(MessageManager
.getString("label.successfully_pasted_alignment_file"));
- System.out.println(">>>>>>>>>>>>>>>> showFeatures : "
- + Desktop.isCurrentSeqFeaturesVisible());
-
af.setShowSeqFeatures(Desktop.isCurrentSeqFeaturesVisible());
af.changeColour(Desktop.getCurrentGlobalColourScheme());
}
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"))
{
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())
import jalview.gui.AlignmentPanel;
import jalview.gui.FeatureRenderer;
import jalview.json.binding.v1.AlignmentPojo;
-import jalview.json.binding.v1.FeaturePojo;
+import jalview.json.binding.v1.SequenceFeaturesPojo;
import jalview.json.binding.v1.SequencePojo;
import jalview.schemes.ColourSchemeProperty;
import jalview.util.MessageManager;
{
AlignmentPojo bjsAlignment = new AlignmentPojo();
- bjsAlignment.setGlobalColorScheme(getGlobalColorScheme());
- bjsAlignment.setJalviewVersion(jalviewVersion);
- bjsAlignment.setWebStartUrl(webStartLaunchServletUrl);
+ // bjsAlignment.setGlobalColorScheme(getGlobalColorScheme());
+ // bjsAlignment.setJalviewVersion(jalviewVersion);
+ // bjsAlignment.setWebStartUrl(webStartLaunchServletUrl);
int count = 0;
for (SequenceI seq : alignment.getSequences())
SequenceFeature[] seqFeatures = seq.getSequenceFeatures();
if (seqFeatures != null)
{
- ArrayList<FeaturePojo> bjsSeqFeatures = new ArrayList<FeaturePojo>();
+ ArrayList<SequenceFeaturesPojo> bjsSeqFeatures = new ArrayList<SequenceFeaturesPojo>();
for (SequenceFeature sf : seqFeatures)
{
if (displayedFeatures != null
String featureColour = jalview.util.Format.getHexString(fr
.findFeatureColour(Color.white, seq,
seq.findIndex(sf.getBegin())));
- FeaturePojo bjsFeature = new FeaturePojo();
- bjsFeature.setFillColor(featureColour);
- bjsFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
- bjsFeature.setXend(seq.findIndex(sf.getEnd()));
- bjsFeature.setType(sf.getType());
- bjsSeqFeatures.add(bjsFeature);
+ // SequenceFeaturesPojo bjsFeature = new SequenceFeaturesPojo();
+ // bjsFeature.setFillColor(featureColour);
+ // bjsFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
+ // bjsFeature.setXend(seq.findIndex(sf.getEnd()));
+ // bjsFeature.setType(sf.getType());
+ // bjsSeqFeatures.add(bjsFeature);
}
}
- seqPojo.setFeatures(bjsSeqFeatures);
+ // seqPojo.setFeatures(bjsSeqFeatures);
}
bjsAlignment.getSeqs().add(seqPojo);
}
import jalview.gui.Desktop;
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.FeaturePojo;
+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;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
import jalview.viewmodel.AlignmentViewport;
-import java.awt.Color;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
private String globalColorScheme;
+ private boolean showSeqFeatures;
+
private Hashtable<String, Sequence> seqMap;
private FeaturesDisplayedI displayedFeatures;
super(inFile, type);
}
-
@Override
public void parse() throws IOException
{
@Override
public String print()
{
- AlignmentPojo jsonAlignmentPojo = new AlignmentPojo();
- if (Desktop.getCurrentAlignFrame() != null)
+ try
+ {
+ JSONExportSettings exportSettings = new JSONExportSettings();
+ exportSettings.setExportAnnotations(true);
+ exportSettings.setExportGroups(true);
+ exportSettings.setExportJalviewSettings(true);
+ exportSettings.setExportSequenceFeatures(true);
+
+ AlignmentPojo jsonAlignmentPojo = new AlignmentPojo();
+ if (Desktop.getCurrentAlignFrame() != null)
+ {
+ globalColorScheme = ColourSchemeProperty.getColourName(Desktop
+ .getCurrentAlignFrame().getViewport()
+ .getGlobalColourScheme());
+ this.av = Desktop.getCurrentAlignFrame().getCurrentView();
+ this.fr = Desktop.getCurrentAlignFrame().alignPanel
+ .cloneFeatureRenderer();
+ displayedFeatures = av.getFeaturesDisplayed();
+ showSeqFeatures = Desktop.getCurrentAlignFrame().showSeqFeatures
+ .isSelected();
+ }
+
+ int count = 0;
+ for (SequenceI seq : seqs)
+ {
+ StringBuilder name = new StringBuilder();
+ name.append(seq.getName()).append("/").append(seq.getStart())
+ .append("-").append(seq.getEnd());
+ SequencePojo jsonSeqPojo = new SequencePojo();
+ jsonSeqPojo.setId(seq.getName() + "_" + seq.hashCode());
+ jsonSeqPojo.setOrder(++count);
+ jsonSeqPojo.setEnd(seq.getEnd());
+ jsonSeqPojo.setStart(seq.getStart());
+ jsonSeqPojo.setName(name.toString());
+ jsonSeqPojo.setSeq(seq.getSequenceAsString());
+ jsonAlignmentPojo.getSeqs().add(jsonSeqPojo);
+ }
+
+ if (exportSettings.isExportJalviewSettings())
+ {
+ JalviewSettingsPojo jvSettings = new JalviewSettingsPojo();
+ jvSettings.setGlobalColorScheme(globalColorScheme);
+ jvSettings.setJalviewVersion(jalviewVersion);
+ jvSettings.setWebStartUrl(webStartLaunchServletUrl);
+ jvSettings.setShowSeqFeatures(showSeqFeatures);
+ jsonAlignmentPojo.setJalviewSettings(jvSettings);
+ }
+
+ if (exportSettings.isExportAnnotations())
+ {
+ jsonAlignmentPojo
+ .setAlignAnnotation(annotationToJsonPojo(annotations));
+ }
+
+ if (exportSettings.isExportSequenceFeatures())
+ {
+ jsonAlignmentPojo.setSeqFeatures(sequenceFeatureToJsonPojo(seqs,
+ displayedFeatures));
+ }
+
+ if (exportSettings.isExportGroups() && seqGroups.size() > 0)
+ {
+ ArrayList<SequenceGrpPojo> sequenceGroupsPojo = new ArrayList<SequenceGrpPojo>();
+ for (SequenceGroup seqGrp : seqGroups)
+ {
+ SequenceGrpPojo seqGrpPojo = new SequenceGrpPojo();
+ seqGrpPojo.setGroupName(seqGrp.getName());
+ seqGrpPojo.setColourScheme(ColourSchemeProperty
+ .getColourName(seqGrp.cs));
+ seqGrpPojo.setColourText(seqGrp.getColourText());
+ seqGrpPojo.setDescription(seqGrp.getDescription());
+ seqGrpPojo.setDisplayBoxes(seqGrp.getDisplayBoxes());
+ seqGrpPojo.setDisplayText(seqGrp.getDisplayText());
+ seqGrpPojo.setEndRes(seqGrp.getEndRes());
+ seqGrpPojo.setStartRes(seqGrp.getStartRes());
+ seqGrpPojo.setShowNonconserved(seqGrp.getShowNonconserved());
+ for (SequenceI seq : seqGrp.getSequences())
+ {
+ seqGrpPojo.getSeqsHash().add(
+ seq.getName() + "_" + seq.hashCode());
+ }
+ jsonAlignmentPojo.getSeqGroups().add(seqGrpPojo);
+ }
+ }
+ com.json.JSONObject generatedJSon = new com.json.JSONObject(
+ jsonAlignmentPojo);
+ String jsonOutput = generatedJSon.toString();
+ return jsonOutput.replaceAll("xstart", "xStart").replaceAll("xend",
+ "xEnd");
+ } catch (Exception e)
{
- jsonAlignmentPojo.setGlobalColorScheme(ColourSchemeProperty
- .getColourName(Desktop.getCurrentAlignFrame().getViewport()
- .getGlobalColourScheme()));
- this.av = Desktop.getCurrentAlignFrame().getCurrentView();
- this.fr = Desktop.getCurrentAlignFrame().alignPanel
- .cloneFeatureRenderer();
- displayedFeatures = av.getFeaturesDisplayed();
- jsonAlignmentPojo
- .setShowSeqFeatures(Desktop.getCurrentAlignFrame().showSeqFeatures
- .isSelected());
+ e.printStackTrace();
+ throw e;
}
- jsonAlignmentPojo.setJalviewVersion(jalviewVersion);
- jsonAlignmentPojo.setWebStartUrl(webStartLaunchServletUrl);
+ }
- if (seqGroups.size() > 0)
+ public static List<SequenceFeaturesPojo> sequenceFeatureToJsonPojo(
+ List<SequenceI> seqs, FeaturesDisplayedI displayedFeatures)
+ {
+ List<SequenceFeaturesPojo> sequenceFeaturesPojo = new ArrayList<SequenceFeaturesPojo>();
+ for (SequenceI seq : seqs)
{
- ArrayList<SequenceGrpPojo> sequenceGroupsPojo = new ArrayList<SequenceGrpPojo>();
- for (SequenceGroup seqGrp : seqGroups)
+ SequenceI dataSetSequence = seq.getDatasetSequence();
+ SequenceFeature[] seqFeatures = (dataSetSequence == null) ? null
+ : seq.getDatasetSequence().getSequenceFeatures();
+ for (SequenceFeature sf : seqFeatures)
{
- SequenceGrpPojo seqGrpPojo = new SequenceGrpPojo();
- seqGrpPojo.setGroupName(seqGrp.getName());
- seqGrpPojo.setColourScheme(ColourSchemeProperty
- .getColourName(seqGrp.cs));
- seqGrpPojo.setColourText(seqGrp.getColourText());
- seqGrpPojo.setDescription(seqGrp.getDescription());
- seqGrpPojo.setDisplayBoxes(seqGrp.getDisplayBoxes());
- seqGrpPojo.setDisplayText(seqGrp.getDisplayText());
- seqGrpPojo.setEndRes(seqGrp.getEndRes());
- seqGrpPojo.setStartRes(seqGrp.getStartRes());
- seqGrpPojo.setShowNonconserved(seqGrp.getShowNonconserved());
- for(SequenceI seq : seqGrp.getSequences()){
- seqGrpPojo.getSeqsHash().add(seq.getName() + "_" + seq.hashCode());
+ if (displayedFeatures != null
+ && displayedFeatures.isVisible(sf.getType()))
+ {
+ // String fillColor = ((fr != null) ? jalview.util.Format
+ // .getHexString(fr.findFeatureColour(Color.white, seq,
+ // seq.findIndex(sf.getBegin()))) : null);
+ SequenceFeaturesPojo jsonFeature = new SequenceFeaturesPojo(
+ seq.getName() + "_" + seq.hashCode());
+ jsonFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
+ jsonFeature.setXend(seq.findIndex(sf.getEnd()));
+ jsonFeature.setType(sf.getType());
+ jsonFeature.setDescription(sf.getDescription());
+ jsonFeature.setLinks(sf.links);
+ jsonFeature.setOtherDetails(sf.otherDetails);
+ jsonFeature.setScore(sf.getScore());
+ // jsonFeature.setFillColor(fillColor);
+ jsonFeature.setFeatureGroup(sf.getFeatureGroup());
+ sequenceFeaturesPojo.add(jsonFeature);
}
- jsonAlignmentPojo.getSequenceGroups().add(seqGrpPojo);
}
}
+ return sequenceFeaturesPojo;
+ }
+ public static List<AlignmentAnnotationPojo> annotationToJsonPojo(
+ Vector<AlignmentAnnotation> annotations)
+ {
+ List<AlignmentAnnotationPojo> jsonAnnotations = new ArrayList<AlignmentAnnotationPojo>();
for (AlignmentAnnotation annot : annotations)
{
AlignmentAnnotationPojo alignAnnotPojo = new AlignmentAnnotationPojo();
alignAnnotPojo.getAnnotations().add(annotationPojo);
}
}
- jsonAlignmentPojo.getAlignmentAnnotation().add(alignAnnotPojo);
+ jsonAnnotations.add(alignAnnotPojo);
}
-
- int count = 0;
- for (SequenceI seq : seqs)
- {
- StringBuilder name = new StringBuilder();
- name.append(seq.getName()).append("/").append(seq.getStart())
- .append("-").append(seq.getEnd());
-
- SequencePojo jsonSeqPojo = new SequencePojo();
-
- jsonSeqPojo.setId(seq.getName() + "_" + seq.hashCode());
- jsonSeqPojo.setOrder(++count);
- jsonSeqPojo.setEnd(seq.getEnd());
- jsonSeqPojo.setStart(seq.getStart());
- jsonSeqPojo.setName(name.toString());
- jsonSeqPojo.setSeq(seq.getSequenceAsString());
- jsonAlignmentPojo.getSeqs().add(jsonSeqPojo);
-
- if (seq.getDatasetSequence() != null
- && seq.getDatasetSequence().getSequenceFeatures() != null)
- {
- ArrayList<FeaturePojo> seqFeaturesPojo = new ArrayList<FeaturePojo>();
- for (SequenceFeature sf : seq.getDatasetSequence()
- .getSequenceFeatures())
- {
-
- if (displayedFeatures != null
- && displayedFeatures.isVisible(sf.getType()))
- {
-
- String fillColor = ((fr != null) ? jalview.util.Format
- .getHexString(fr.findFeatureColour(Color.white, seq,
- seq.findIndex(sf.getBegin()))) : null);
- FeaturePojo jsonFeature = new FeaturePojo();
- jsonFeature.setXstart(seq.findIndex(sf.getBegin()) - 1);
- jsonFeature.setXend(seq.findIndex(sf.getEnd()));
- jsonFeature.setType(sf.getType());
- jsonFeature.setDescription(sf.getDescription());
- jsonFeature.setLinks(sf.links);
- jsonFeature.setOtherDetails(sf.otherDetails);
- jsonFeature.setScore(sf.getScore());
- jsonFeature.setFillColor(fillColor);
- jsonFeature.setFeatureGroup(sf.getFeatureGroup());
- seqFeaturesPojo.add(jsonFeature);
- }
- }
- jsonSeqPojo.setFeatures(seqFeaturesPojo);
- }
- }
- return new com.json.JSONObject(jsonAlignmentPojo).toString()
- .replaceAll("xstart", "xStart").replaceAll("xend", "xEnd");
+ return jsonAnnotations;
}
public void parse(String jsonAlignmentString)
JSONObject alignmentJsonObj = (JSONObject) jsonParser
.parse(jsonAlignmentString);
JSONArray seqJsonArray = (JSONArray) alignmentJsonObj.get("seqs");
- JSONArray alAnnotJsonArray = (JSONArray) alignmentJsonObj.get("alignmentAnnotation");
- JSONArray seqGrpJsonArray = (JSONArray) alignmentJsonObj.get("sequenceGroups");
- String jsColourScheme = (String) alignmentJsonObj
- .get("globalColorScheme");
- Boolean showFeatures = Boolean.valueOf(alignmentJsonObj.get(
- "showSeqFeatures").toString());
- cs = getJalviewColorScheme(jsColourScheme);
+ JSONArray alAnnotJsonArray = (JSONArray) alignmentJsonObj
+ .get("alignAnnotation");
+ JSONArray jsonSeqArray = (JSONArray) alignmentJsonObj
+ .get("seqFeatures");
+ JSONArray seqGrpJsonArray = (JSONArray) alignmentJsonObj
+ .get("seqGroups");
+ JSONObject jvSettingsJsonObj = (JSONObject) alignmentJsonObj
+ .get("jalviewSettings");
+
+ if (jvSettingsJsonObj != null)
+ {
+ String jsColourScheme = (String) jvSettingsJsonObj
+ .get("globalColorScheme");
+ Boolean showFeatures = Boolean.valueOf(jvSettingsJsonObj.get(
+ "showSeqFeatures").toString());
+ cs = getJalviewColorScheme(jsColourScheme);
+ Desktop.setCurrentSeqFeaturesVisible(showFeatures);
+ }
+
seqMap = new Hashtable<String, Sequence>();
Desktop.setCurrentGlobalColourScheme(cs);
- Desktop.setCurrentSeqFeaturesVisible(showFeatures);
for (Iterator<JSONObject> sequenceIter = seqJsonArray.iterator(); sequenceIter
.hasNext();)
{
int end = Integer.valueOf(sequence.get("end").toString());
Sequence seq = new Sequence(sequenceName, sequcenceString, start,
end);
- JSONArray jsonSeqArray = (JSONArray) sequence.get("features");
- SequenceFeature[] retrievedSeqFeatures = getJalviewSequenceFeatures(
- jsonSeqArray, seq);
- if (retrievedSeqFeatures != null)
- {
- seq.setSequenceFeatures(retrievedSeqFeatures);
- }
seqs.add(seq);
seqMap.put(seqUniqueId, seq);
}
-
+ parseFeatures(jsonSeqArray);
+
for (Iterator<JSONObject> seqGrpIter = seqGrpJsonArray.iterator(); seqGrpIter
.hasNext();)
{
}
-
for (Iterator<JSONObject> alAnnotIter = alAnnotJsonArray.iterator(); alAnnotIter
.hasNext();)
{
JSONObject alAnnot = alAnnotIter.next();
- JSONArray annotJsonArray = (JSONArray) alAnnot
- .get("annotations");
+ JSONArray annotJsonArray = (JSONArray) alAnnot.get("annotations");
Annotation[] annotations = new Annotation[annotJsonArray.size()];
int count = 0;
for (Iterator<JSONObject> annotIter = annotJsonArray.iterator(); annotIter
}
else
{
- float val = annot.get("value") == null ? null
- : Float.valueOf(annot.get("value")
- .toString());
+ float val = annot.get("value") == null ? null : Float
+ .valueOf(annot.get("value").toString());
String desc = annot.get("description") == null ? null : annot
.get("description").toString();
char ss = annot.get("secondaryStructure") == null ? null
- : annot
- .get("secondaryStructure").toString().charAt(0);
- String displayChar = annot.get(
- "displayCharacter").toString();
+ : annot.get("secondaryStructure").toString().charAt(0);
+ String displayChar = annot.get("displayCharacter").toString();
annotations[count] = new Annotation(displayChar, desc, ss, val);
}
}
}
- public SequenceFeature[] getJalviewSequenceFeatures(
- JSONArray jsonSeqFeatures, Sequence seq)
+
+ private void parseFeatures(JSONArray jsonSeqFeatures)
{
- SequenceFeature[] seqFeatures = null;
- int count = 0;
if (jsonSeqFeatures != null)
{
- seqFeatures = new SequenceFeature[jsonSeqFeatures.size()];
for (@SuppressWarnings("unchecked")
Iterator<JSONObject> seqFeatureItr = jsonSeqFeatures.iterator(); seqFeatureItr
.hasNext();)
{
-
- SequenceFeature sequenceFeature = new SequenceFeature();
JSONObject jsonFeature = seqFeatureItr.next();
Long begin = (Long) jsonFeature.get("xStart");
Long end = (Long) jsonFeature.get("xEnd");
String color = (String) jsonFeature.get("fillColor");
String featureGrp = (String) jsonFeature.get("featureGroup");
String descripiton = (String) jsonFeature.get("description");
+ String seqRef = (String) jsonFeature.get("sequenceRef");
Float score = Float.valueOf(jsonFeature.get("score").toString());
// Hashtable otherDetails = (Hashtable) jsonFeature
// .get("otherDetails");
- // Vector<String> links = (Vector<String>) jsonFeature.get("links");
-
- // sequenceFeature.links = links;
// sequenceFeature.otherDetails = otherDetails;
+
+ Sequence seq = seqMap.get(seqRef);
+ SequenceFeature sequenceFeature = new SequenceFeature();
+ JSONArray linksJsonArray = (JSONArray) jsonFeature.get("links");
+ if (linksJsonArray != null && linksJsonArray.size() > 0)
+ {
+ Iterator<String> linkList = linksJsonArray.iterator();
+ while (linkList.hasNext())
+ {
+ String link = linkList.next();
+ sequenceFeature.addLink(link);
+ }
+ }
+ sequenceFeature.setFeatureGroup(featureGrp);
sequenceFeature.setScore(score);
sequenceFeature.setDescription(descripiton);
-
+ sequenceFeature.setType(type);
sequenceFeature.setBegin(seq.findPosition(begin.intValue()));
sequenceFeature.setEnd(seq.findPosition(end.intValue()) - 1);
- sequenceFeature.setType(type);
- seqFeatures[count++] = sequenceFeature;
+ seq.addSequenceFeature(sequenceFeature);
}
}
- return seqFeatures;
}
private ColourSchemeI getJalviewColorScheme(String bioJsColourSchemeName)
{
this.globalColorScheme = globalColorScheme;
}
+
+ public class JSONExportSettings
+ {
+ private boolean exportSequence;
+
+ private boolean exportSequenceFeatures;
+
+ private boolean exportAnnotations;
+
+ private boolean exportGroups;
+
+ private boolean exportJalviewSettings;
+
+ public boolean isExportSequence()
+ {
+ return exportSequence;
+ }
+
+ public void setExportSequence(boolean exportSequence)
+ {
+ this.exportSequence = exportSequence;
+ }
+
+ public boolean isExportSequenceFeatures()
+ {
+ return exportSequenceFeatures;
+ }
+
+ public void setExportSequenceFeatures(boolean exportSequenceFeatures)
+ {
+ this.exportSequenceFeatures = exportSequenceFeatures;
+ }
+
+ public boolean isExportAnnotations()
+ {
+ return exportAnnotations;
+ }
+
+ public void setExportAnnotations(boolean exportAnnotations)
+ {
+ this.exportAnnotations = exportAnnotations;
+ }
+
+ public boolean isExportGroups()
+ {
+ return exportGroups;
+ }
+
+ public void setExportGroups(boolean exportGroups)
+ {
+ this.exportGroups = exportGroups;
+ }
+
+ public boolean isExportJalviewSettings()
+ {
+ return exportJalviewSettings;
+ }
+
+ public void setExportJalviewSettings(boolean exportJalviewSettings)
+ {
+ this.exportJalviewSettings = exportJalviewSettings;
+ }
+ }
}
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.List;
public class AlignmentPojo
{
- private String globalColorScheme = "none";
-
- private String jalviewVersion;
-
- private String webStartUrl;
+ private List<SequencePojo> seqs = new ArrayList<SequencePojo>();
- private boolean showSeqFeatures;
+ private List<AlignmentAnnotationPojo> alignAnnotation = new ArrayList<AlignmentAnnotationPojo>();
- private List<SequencePojo> seqs = new ArrayList<SequencePojo>();
+ private List<SequenceGrpPojo> seqGroups = new ArrayList<SequenceGrpPojo>();
- private List<AlignmentAnnotationPojo> alignmentAnnotation = new ArrayList<AlignmentAnnotationPojo>();
+ private List<SequenceFeaturesPojo> seqFeatures = new ArrayList<SequenceFeaturesPojo>();
- private List<SequenceGrpPojo> sequenceGroups = new ArrayList<SequenceGrpPojo>();
+ private JalviewSettingsPojo jalviewSettings;
public AlignmentPojo()
{
-
}
public List<SequencePojo> getSeqs()
{
this.seqs = seqs;
}
- 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;
- }
- }
-
- // JALVIEW colors not in biojs
- // Blosum62
- // T-Coffee Scores (almost same with Blosom62
- // RNA Interaction type - no color applied
- // RNA Helices - missing
-
- // BIOJS Colour not in jalview
- // schemes.push name: "Lesk", id: "lesk"
- // schemes.push name: "Cinema", id: "cinema"
- // schemes.push name: "MAE", id: "mae"
- // schemes.push name: "Clustal2", id: "clustal2"
-
- }
-
-
- public String getJalviewVersion()
- {
- return jalviewVersion;
- }
- public void setJalviewVersion(String jalviewVersion)
+ public JalviewSettingsPojo getJalviewSettings()
{
- this.jalviewVersion = jalviewVersion;
+ return jalviewSettings;
}
- public String getWebStartUrl()
+ public void setJalviewSettings(JalviewSettingsPojo jalviewSettings)
{
- return webStartUrl;
+ this.jalviewSettings = jalviewSettings;
}
- public void setWebStartUrl(String webStartUrl)
+ public List<AlignmentAnnotationPojo> getAlignAnnotation()
{
- this.webStartUrl = webStartUrl;
+ return alignAnnotation;
}
- public List<AlignmentAnnotationPojo> getAlignmentAnnotation()
+ public void setAlignAnnotation(
+ List<AlignmentAnnotationPojo> alignAnnotation)
{
- return alignmentAnnotation;
+ this.alignAnnotation = alignAnnotation;
}
- public void setAlignmentAnnotation(List<AlignmentAnnotationPojo> alignmentAnnotation)
+ public List<SequenceGrpPojo> getSeqGroups()
{
- this.alignmentAnnotation = alignmentAnnotation;
+ return seqGroups;
}
- public List<SequenceGrpPojo> getSequenceGroups()
+ public void setSeqGroups(List<SequenceGrpPojo> seqGroups)
{
- return sequenceGroups;
+ this.seqGroups = seqGroups;
}
- public void setSequenceGroups(List<SequenceGrpPojo> sequenceGroups)
+ public List<SequenceFeaturesPojo> getSeqFeatures()
{
- this.sequenceGroups = sequenceGroups;
+ return seqFeatures;
}
- public boolean isShowSeqFeatures()
+ public void setSeqFeatures(List<SequenceFeaturesPojo> seqFeatures)
{
- return showSeqFeatures;
+ this.seqFeatures = seqFeatures;
}
- public void setShowSeqFeatures(boolean showSeqFeatures)
- {
- this.showSeqFeatures = showSeqFeatures;
- }
- 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 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;
+ }
+
+ }
+}
import java.util.Hashtable;
import java.util.Vector;
-public class FeaturePojo
+public class SequenceFeaturesPojo
{
private int xstart;
private int xend;
+ private String sequenceRef;
+
private String type;
- private String fillColor;
-
+ // private String fillColor;
+
private Float score;
private String description;
private String featureGroup;
private Vector<String> links;
-
- public FeaturePojo()
- {
- }
- public String getFillColor()
+ public SequenceFeaturesPojo()
{
- return "#" + fillColor;
}
- public void setFillColor(String fillColor)
+ public SequenceFeaturesPojo(String sequenceRef)
{
- this.fillColor = fillColor;
+ this.sequenceRef = sequenceRef;
}
+ // public String getFillColor()
+ // {
+ // return "#" + fillColor;
+ // }
+ //
+ // public void setFillColor(String fillColor)
+ // {
+ // this.fillColor = fillColor;
+ // }
+
public int getXstart()
{
return xstart;
{
this.featureGroup = featureGroup;
}
+
+ public String getSequenceRef()
+ {
+ return sequenceRef;
+ }
+
+ public void setSequenceRef(String sequenceRef)
+ {
+ this.sequenceRef = sequenceRef;
+ }
}
package jalview.json.binding.v1;
-import java.util.ArrayList;
public class SequencePojo
private int end;
- private ArrayList<FeaturePojo> features = new ArrayList<FeaturePojo>();
+ // private ArrayList<SequenceFeaturesPojo> features = new
+ // ArrayList<SequenceFeaturesPojo>();
public SequencePojo()
{
this.end = end;
}
- public ArrayList<FeaturePojo> getFeatures()
- {
- return features;
- }
-
- public void setFeatures(ArrayList<FeaturePojo> features)
- {
- this.features = features;
- }
+ // public ArrayList<SequenceFeaturesPojo> getFeatures()
+ // {
+ // return features;
+ // }
+ //
+ // public void setFeatures(ArrayList<SequenceFeaturesPojo> features)
+ // {
+ // this.features = features;
+ // }
public int getOrder()
{