import jalview.datamodel.*;\r
import jalview.schemes.*;\r
import java.util.*;\r
+import jalview.bin.Cache;\r
\r
public class AlignViewport\r
{\r
boolean renderGaps = true;\r
boolean showSequenceFeatures = false;\r
boolean showAnnotation = true;\r
+ boolean showConservation = true;\r
+ boolean showQuality = true;\r
+ boolean showIdentity = true;\r
\r
boolean colourAppliesToAllGroups = true;\r
ColourSchemeI globalColourScheme = null;\r
boolean scaleRightWrapped = true;\r
\r
\r
- public AlignViewport(AlignmentI al,\r
- boolean showText,\r
- boolean showBoxes,\r
- boolean wrapAlignment) {\r
-\r
+ public AlignViewport(AlignmentI al)\r
+ {\r
+ setAlignment(al);\r
this.startRes = 0;\r
this.endRes = al.getWidth()-1;\r
this.startSeq = 0;\r
this.endSeq = al.getHeight()-1;\r
- this.showText = showText;\r
- this.showBoxes = showBoxes;\r
- this.wrapAlignment = wrapAlignment;\r
\r
- setAlignment(al);\r
- setFont( font );\r
+ updateFromPreferences();\r
+\r
+ }\r
+\r
+ public void updateFromPreferences()\r
+ {\r
+ String string = Cache.getProperty("SHOW_FULL_ID");\r
+ if(string!=null)\r
+ showFullId = Boolean.valueOf(string).booleanValue();\r
+\r
+ string = Cache.getProperty("SHOW_ANNOTATIONS");\r
+ if(string!=null)\r
+ showAnnotation = Boolean.valueOf(string).booleanValue();\r
+\r
+ string = Cache.getProperty("SHOW_CONSERVATION");\r
+ if(string!=null)\r
+ showConservation = Boolean.valueOf(string).booleanValue();\r
+ string = Cache.getProperty("SHOW_QUALITY");\r
+ if(string!=null)\r
+ showQuality = Boolean.valueOf(string).booleanValue();\r
+ string = Cache.getProperty("SHOW_IDENTITY");\r
+ if(string!=null)\r
+ showIdentity = Boolean.valueOf(string).booleanValue();\r
+\r
+ string = Cache.getProperty("SHOW_FULL_ID");\r
+ if(string!=null)\r
+ showFullId = Boolean.valueOf(string).booleanValue();\r
+\r
+ String fontName = Cache.getProperty("FONT_NAME");\r
+ String fontStyle= Cache.getProperty("FONT_STYLE");\r
+ String fontSize = Cache.getProperty("FONT_SIZE");\r
+ if(fontName!=null && fontStyle!=null && fontSize!=null)\r
+ setFont( new Font(fontName,Integer.parseInt(fontStyle),Integer.parseInt(fontSize)) );\r
+ else\r
+ setFont( font );\r
+\r
+ string = Cache.getProperty("GAP_SYMBOL");\r
+ if(string!=null)\r
+ alignment.setGapCharacter( string.charAt(0) );\r
+\r
+\r
+ // We must set conservation and consensus before setting colour,\r
+ // as Blosum and Clustal require this to be done\r
+ updateConservation();\r
+ updateConsensus();\r
+ string = Cache.getProperty("DEFAULT_COLOUR");\r
+ if(string!=null)\r
+ {\r
+ globalColourScheme = ColourSchemeProperty.getColour(alignment, string);\r
+ if(globalColourScheme!=null)\r
+ globalColourScheme.setConsensus( vconsensus );\r
+ }\r
+\r
}\r
\r
public void showSequenceFeatures(boolean b)\r
0f, // cons.qualityRange[0].floatValue(),\r
11f, // cons.qualityRange[1].floatValue()\r
1);\r
+ if(showConservation)\r
alignment.addAnnotation(conservation);\r
quality = new AlignmentAnnotation("Quality",\r
"Alignment Quality based on Blosum62 scores",\r
cons.qualityRange[0].floatValue(),\r
cons.qualityRange[1].floatValue(),\r
1);\r
- alignment.addAnnotation(quality);\r
+ if(showQuality)\r
+ alignment.addAnnotation(quality);\r
}\r
else {\r
conservation.annotations = annotations;\r
quality.annotations = qannotations;\r
+ quality.graphMax = cons.qualityRange[1].floatValue();\r
}\r
\r
\r
{\r
consensus = new AlignmentAnnotation("% Identity",\r
"PID", annotations, 0f, 100f, 1);\r
- alignment.addAnnotation(consensus);\r
+ if(showIdentity)\r
+ alignment.addAnnotation(consensus);\r
}\r
else\r
consensus.annotations = annotations;\r