From: amwaterhouse Date: Wed, 5 Apr 2006 15:53:09 +0000 (+0000) Subject: Save annotationColours X-Git-Tag: Release_2_08~52 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9d64429d4fbb50c23d9d66e1de396f8a3d1927b8;p=jalview.git Save annotationColours --- diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index eb071e2..db60b8b 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -320,6 +320,14 @@ public class Jalview2XML { an.setGraph(true); an.setGraphType(aa[i].graph); + if(aa[i].getThreshold()!=null) + { + ThresholdLine line = new ThresholdLine(); + line.setLabel(aa[i].getThreshold().label); + line.setValue(aa[i].getThreshold().value); + line.setColour(aa[i].getThreshold().colour.getRGB()); + an.setThresholdLine(line); + } } else an.setGraph(false); @@ -381,6 +389,12 @@ public class Jalview2XML cs)); } } + else if(sg.cs instanceof jalview.schemes.AnnotationColourGradient) + { + groups[i].setColour( + ColourSchemeProperty.getColourName( + ( (jalview.schemes.AnnotationColourGradient) sg.cs).getBaseColour())); + } else if (sg.cs instanceof jalview.schemes.UserColourScheme) { groups[i].setColour(SetUserColourScheme(sg.cs, userColours, @@ -427,6 +441,26 @@ public class Jalview2XML view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(), userColours, jms)); } + else if(av.getGlobalColourScheme() instanceof jalview.schemes.AnnotationColourGradient) + { + jalview.schemes.AnnotationColourGradient acg + = (jalview.schemes.AnnotationColourGradient)av.getGlobalColourScheme(); + + AnnotationColours ac = new AnnotationColours(); + ac.setAboveThreshold(acg.getAboveThreshold()); + ac.setThreshold(acg.getAnnotationThreshold()); + ac.setAnnotation(acg.getAnnotation()); + if(acg.getBaseColour() instanceof jalview.schemes.UserColourScheme) + ac.setColourScheme(SetUserColourScheme(acg.getBaseColour(), + userColours, jms)); + else + ac.setColourScheme(ColourSchemeProperty.getColourName(acg.getBaseColour())); + + ac.setMaxColour(acg.getMaxColour().getRGB()); + ac.setMinColour(acg.getMinColour().getRGB()); + view.setAnnotationColours(ac); + view.setBgColour("AnnotationColourGradient"); + } else { view.setBgColour(ColourSchemeProperty.getColourName( @@ -761,9 +795,20 @@ public class Jalview2XML if (an[i].getGraph()) { - jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), - an[i].getDescription(), anot, 0, 0, - an[i].getGraphType()); + jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(), + an[i].getDescription(), anot, 0, 0, + an[i].getGraphType()); + + if (an[i].getThresholdLine() != null) + { + jaa.setThreshold(new jalview.datamodel.GraphLine( + an[i].getThresholdLine().getValue(), + an[i].getThresholdLine().getLabel(), + new java.awt.Color(an[i].getThresholdLine().getColour())) + ); + + } + } else { @@ -807,7 +852,8 @@ public class Jalview2XML groups[i].getColour()); } - cs.setThreshold(groups[i].getPidThreshold(), true); + if(cs!=null) + cs.setThreshold(groups[i].getPidThreshold(), true); } Vector seqs = new Vector(); @@ -895,6 +941,96 @@ public class Jalview2XML { cs = GetUserColourScheme(jms, view.getBgColour()); } + else if(view.getBgColour().startsWith("Annotation")) + { + //int find annotation + for (int i = 0; i < af.viewport.alignment.getAlignmentAnnotation().length; i++) + { + if (af.viewport.alignment.getAlignmentAnnotation()[i].label. + equals(view.getAnnotationColours().getAnnotation())) + { + if (af.viewport.alignment.getAlignmentAnnotation()[i]. + getThreshold() == null) + { + af.viewport.alignment.getAlignmentAnnotation()[i]. + setThreshold( + new jalview.datamodel.GraphLine( + view.getAnnotationColours().getThreshold(), + "Threshold", java.awt.Color.black) + + ); + } + + + if (view.getAnnotationColours().getColourScheme().equals( + "None")) + { + cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + new java.awt.Color(view.getAnnotationColours(). + getMinColour()), + new java.awt.Color(view.getAnnotationColours(). + getMaxColour()), + view.getAnnotationColours().getAboveThreshold()); + } + else if (view.getAnnotationColours().getColourScheme(). + startsWith("ucs")) + { + cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + GetUserColourScheme(jms, view.getAnnotationColours(). + getColourScheme()), + view.getAnnotationColours().getAboveThreshold() + ); + } + else + { + cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + ColourSchemeProperty.getColour(al, + view.getAnnotationColours().getColourScheme()), + view.getAnnotationColours().getAboveThreshold() + ); + } + + // Also use these settings for all the groups + if (al.getGroups() != null) + for (int g = 0; g < al.getGroups().size(); g++) + { + jalview.datamodel.SequenceGroup sg + = (jalview.datamodel.SequenceGroup)al.getGroups().elementAt(g); + + if(sg.cs == null) + continue; + + + /* if (view.getAnnotationColours().getColourScheme().equals("None")) + { + sg.cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + new java.awt.Color(view.getAnnotationColours(). + getMinColour()), + new java.awt.Color(view.getAnnotationColours(). + getMaxColour()), + view.getAnnotationColours().getAboveThreshold()); + } + else*/ + { + sg.cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + sg.cs, + view.getAnnotationColours().getAboveThreshold() + ); + } + + } + + + break; + } + + } + } else { cs = ColourSchemeProperty.getColour(al, view.getBgColour());