}
// SAVE ANNOTATIONS
+ /**
+ * store forward refs from an annotationRow to any groups
+ */
+ IdentityHashMap groupRefs = new IdentityHashMap();
if (jal.getAlignmentAnnotation() != null)
{
jalview.datamodel.AlignmentAnnotation[] aa = jal
an.setId(aa[i].annotationId);
- if (aa[i] == av.quality || aa[i] == av.conservation
- || aa[i] == av.consensus)
- {
- an.setLabel(aa[i].label);
- an.setGraph(true);
- vamsasSet.addAnnotation(an);
- continue;
- }
-
+
an.setVisible(aa[i].visible);
an.setDescription(aa[i].description);
// sequence rather than its display name
an.setSequenceRef(aa[i].sequenceRef.getName());
}
+ if (aa[i].groupRef!=null)
+ {
+ Object groupIdr = groupRefs.get(aa[i].groupRef);
+ if (groupIdr==null)
+ {
+ // make a locally unique String
+ groupRefs.put(aa[i].groupRef, groupIdr = (""+System.currentTimeMillis()+aa[i].groupRef.getName()+groupRefs.size()));
+ }
+ an.setGroupRef(groupIdr.toString());
+ }
+ if (aa[i] == av.quality || aa[i] == av.conservation
+ || aa[i] == av.consensus || aa[i].autoCalculated)
+ {
+ // new way of indicating autocalculated annotation -
+ an.setAutoCalculated(aa[i].autoCalculated);
+ // write a stub for this annotation - indicate presence of autocalc rows
+ an.setLabel(aa[i].label);
+ an.setGraph(true);
+ vamsasSet.addAnnotation(an);
+ continue;
+ }
if (aa[i].graph > 0)
{
vamsasSet.addAnnotation(an);
}
}
-
// SAVE GROUPS
if (jal.getGroups() != null)
{
.getGroups().elementAt(i);
groups[i].setStart(sg.getStartRes());
groups[i].setEnd(sg.getEndRes());
- groups[i].setName(sg.getName()); // TODO later sequence group should
- // specify IDs of sequences, not just
- // names
+ groups[i].setName(sg.getName());
+ if (groupRefs.containsKey(sg)) {
+ // group has references so set it's ID field
+ groups[i].setId(groupRefs.get(sg).toString());
+ }
if (sg.cs != null)
{
if (sg.cs.conservationApplied())
groups[i].setTextCol2(sg.textColour2.getRGB());
groups[i].setTextColThreshold(sg.thresholdTextColour);
groups[i].setShowUnconserved(sg.getShowunconserved());
+ groups[i].setIgnoreGapsinConsensus(sg.getIgnoreGapsConsensus());
+ groups[i].setShowConsensusHistogram(sg.isShowConsensusHistogram());
+ groups[i].setShowConsensusProfile(sg.isIncludeAllConsSymbols());
for (int s = 0; s < sg.getSize(); s++)
{
jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg
view.setTextCol1(av.textColour.getRGB());
view.setTextCol2(av.textColour2.getRGB());
view.setTextColThreshold(av.thresholdTextColour);
-
+ view.setShowConsensusHistogram(av.isShowConsensusHistogram());
+ view.setShowConsensusProfile(av.isShowConsensusProfile());
+ view.setShowGroupConsensus(av.isShowGroupConsensus());
+ view.setShowGroupConservation(av.isShowGroupConservation());
+ view.setShowNPfeatureTooltip(av.isShowNpFeats());
+ view.setShowDbRefTooltip(av.isShowDbRefs());
+ view.setFollowHighlight(av.followHighlight);
+ view.setFollowSelection(av.followSelection);
+ view.setIgnoreGapsinConsensus(av.getIgnoreGapsConsensus());
if (av.featuresDisplayed != null)
{
jalview.schemabinding.version2.FeatureSettings fs = new jalview.schemabinding.version2.FeatureSettings();
String[] renderOrder = ap.seqPanel.seqCanvas.getFeatureRenderer().renderOrder;
Vector settingsAdded = new Vector();
+ Object gstyle=null;
+ GraduatedColor gcol = null;
for (int ro = 0; ro < renderOrder.length; ro++)
{
+ gstyle = ap.seqPanel.seqCanvas.getFeatureRenderer().getFeatureStyle(renderOrder[ro]);
Setting setting = new Setting();
setting.setType(renderOrder[ro]);
- setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer()
- .getColour(renderOrder[ro]).getRGB());
-
+ if (gstyle instanceof GraduatedColor) {
+ gcol = (GraduatedColor) gstyle;
+ setting.setColour(gcol.getMaxColor().getRGB());
+ setting.setMincolour(gcol.getMinColor().getRGB());
+ setting.setMin(gcol.getMin());
+ setting.setMax(gcol.getMax());
+ setting.setColourByLabel(gcol.isColourByLabel());
+ setting.setAutoScale(gcol.isAutoScale());
+ setting.setThreshold(gcol.getThresh());
+ setting.setThreshstate(gcol.getThreshType());
+ } else {
+ setting.setColour(ap.seqPanel.seqCanvas.getFeatureRenderer() .getColour(renderOrder[ro]).getRGB());
+ }
+
setting.setDisplay(av.featuresDisplayed
.containsKey(renderOrder[ro]));
float rorder = ap.seqPanel.seqCanvas.getFeatureRenderer().getOrder(
{
String id = null;
jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme) cs;
-
+ boolean newucs=false;
if (!userColours.contains(ucs))
{
userColours.add(ucs);
-
+ newucs=true;
+ }
+ id = "ucs" + userColours.indexOf(ucs);
+ if (newucs) {
+ // actually create the scheme's entry in the XML model
java.awt.Color[] colours = ucs.getColours();
jalview.schemabinding.version2.UserColours uc = new jalview.schemabinding.version2.UserColours();
jalview.schemabinding.version2.UserColourScheme jbucs = new jalview.schemabinding.version2.UserColourScheme();
}
}
- id = "ucs" + userColours.indexOf(ucs);
uc.setId(id);
uc.setUserColourScheme(jbucs);
jms.addUserColours(uc);
// ////////////////////////////////
// LOAD ANNOTATIONS
boolean hideQuality = true, hideConservation = true, hideConsensus = true;
+ /**
+ * store any annotations which forward reference a group's ID
+ */
+ Hashtable groupAnnotRefs = new Hashtable();
if (vamsasSet.getAnnotationCount() > 0)
{
{
hideConsensus = false;
continue;
- }
+ }
// set visiblity for other annotation in this view
if (an[i].getId() != null
&& annotationIds.containsKey(an[i].getId()))
al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa);
}
}
+ // and make a note of any group association
+ if (an[i].getGroupRef()!=null && an[i].getGroupRef().length()>0)
+ {
+ groupAnnotRefs.put(an[i].getGroupRef(),jaa);
+ }
+
if (an[i].hasScore())
{
jaa.setScore(an[i].getScore());
}
-
if (an[i].hasVisible())
jaa.visible = an[i].getVisible();
-
+
+ if (an[i].hasCentreColLabels())
+ jaa.centreColLabels = an[i].getCentreColLabels();
+
+ if (an[i].hasScaleColLabels())
+ {
+ jaa.scaleColLabel = an[i].getScaleColLabels();
+ }
+ if (an[i].hasAutoCalculated() && an[i].isAutoCalculated())
+ {
+ // newer files have an 'autoCalculated' flag and store calculation state in viewport properties
+ jaa.autoCalculated = true; // means annotation will be marked for update at end of load.
+ }
al.addAnnotation(jaa);
}
}
sg.setShowunconserved(groups[i].hasShowUnconserved() ? groups[i]
.isShowUnconserved() : false);
sg.thresholdTextColour = groups[i].getTextColThreshold();
-
+ if (groups[i].hasShowConsensusHistogram()) {
+ sg.setShowConsensusHistogram(groups[i].isShowConsensusHistogram());
+ };
+ if (groups[i].hasShowConsensusProfile()) {
+ sg.setIncludeAllConsSymbols(groups[i].isShowConsensusProfile());
+ }
+ if (groups[i].hasIgnoreGapsinConsensus())
+ {
+ sg.setIgnoreGapsConsensus(groups[i].getIgnoreGapsinConsensus());
+ }
if (groups[i].getConsThreshold() != 0)
{
jalview.analysis.Conservation c = new jalview.analysis.Conservation(
c.verdict(false, 25);
sg.cs.setConservation(c);
}
-
+
+ if (groups[i].getId()!=null
+ && groupAnnotRefs.size()>0)
+ {
+ // re-instate unique group/annotation row reference
+ jalview.datamodel.AlignmentAnnotation jaa = (jalview.datamodel.AlignmentAnnotation) groupAnnotRefs.get(groups[i].getId());
+ if (jaa!=null)
+ {
+ jaa.groupRef = sg;
+ }
+ }
al.addGroup(sg);
+
}
}
{
af.viewport.showSequenceFeatures = true;
}
+ if (view.hasCentreColumnLabels())
+ {
+ af.viewport.setCentreColumnLabels(view.getCentreColumnLabels());
+ }
+ if (view.hasIgnoreGapsinConsensus())
+ {
+ af.viewport.ignoreGapsInConsensusCalculation=view.getIgnoreGapsinConsensus();
+ }
+ if (view.hasFollowHighlight())
+ {
+ af.viewport.followHighlight = view.getFollowHighlight();
+ }
+ if (view.hasFollowSelection())
+ {
+ af.viewport.followSelection = view.getFollowSelection();
+ }
+ if (view.hasShowConsensusHistogram())
+ {
+ af.viewport.setShowConsensusHistogram(view.getShowConsensusHistogram());
+ }
+ if (view.hasShowConsensusProfile())
+ {
+ af.viewport.setShowConsensusProfile(view.getShowConsensusProfile());
+ }
+ if (view.hasShowDbRefTooltip())
+ {
+ af.viewport.setShowDbRefs(view.getShowDbRefTooltip());
+ }
+ if (view.hasShowNPfeatureTooltip())
+ {
+ af.viewport.setShowNpFeats(view.hasShowNPfeatureTooltip());
+ }
+ if (view.hasShowGroupConsensus())
+ {
+ af.viewport.setShowGroupConsensus(view.getShowGroupConsensus());
+ }
+ if (view.hasShowGroupConservation())
+ {
+ af.viewport.setShowGroupConservation(view.getShowGroupConservation());
+ }
+
// recover featre settings
if (jms.getFeatureSettings() != null)
{
Setting setting = jms.getFeatureSettings().getSetting(fs);
if (setting.hasMincolour())
{
- // TODO: determine how to set data independent bounds for a graduated
- // colour scheme's range.
- GraduatedColor gc = new GraduatedColor(new java.awt.Color(setting
+ GraduatedColor gc = setting.hasMin() ? new GraduatedColor(new java.awt.Color(setting
+ .getMincolour()),
+ new java.awt.Color(setting.getColour()), setting.getMin(), setting.getMax())
+ : new GraduatedColor(new java.awt.Color(setting
.getMincolour()),
- new java.awt.Color(setting.getColour()), 0, 1);
+ new java.awt.Color(setting.getColour()), 0,1);
if (setting.hasThreshold())
{
gc.setThresh(setting.getThreshold());
gc.setThreshType(setting.getThreshstate());
}
+ gc.setAutoScaled(true); // default
+ if (setting.hasAutoScale())
+ {
+ gc.setAutoScaled(setting.getAutoScale());
+ }
+ if (setting.hasColourByLabel())
+ {
+ gc.setColourByLabel(setting.getColourByLabel());
+ }
+ // and put in the feature colour table.
+ af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(setting.getType(),gc);
}
else
{
}
af.setMenusFromViewport(af.viewport);
+ af.alignPanel.updateAnnotation(false); // recompute any autoannotation
// TODO: we don't need to do this if the viewport is aready visible.
Desktop.addInternalFrame(af, view.getTitle(), view.getWidth(), view
.getHeight());