2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.appletgui;
25 import jalview.analysis.*;
27 import jalview.datamodel.*;
28 import jalview.schemes.*;
30 public class AlignViewport
40 boolean cursorMode = false;
42 boolean showJVSuffix = true;
44 boolean showText = true;
46 boolean showColourText = false;
48 boolean showBoxes = true;
50 boolean wrapAlignment = false;
52 boolean renderGaps = true;
54 boolean showSequenceFeatures = false;
56 boolean showAnnotation = true;
58 boolean showConservation = true;
60 boolean showQuality = true;
62 boolean showConsensus = true;
64 boolean upperCasebold = false;
66 boolean colourAppliesToAllGroups = true;
68 ColourSchemeI globalColourScheme = null;
70 boolean conservationColourSelected = false;
72 boolean abovePIDThreshold = false;
74 SequenceGroup selectionGroup;
82 Font font = new Font("SansSerif", Font.PLAIN, 10);
84 boolean validCharWidth = true;
88 ColumnSelection colSel = new ColumnSelection();
94 NJTree currentTree = null;
96 boolean scaleAboveWrapped = true;
98 boolean scaleLeftWrapped = true;
100 boolean scaleRightWrapped = true;
102 // The following vector holds the features which are
103 // currently visible, in the correct order or rendering
104 public Hashtable featuresDisplayed;
106 boolean hasHiddenColumns = false;
108 boolean hasHiddenRows = false;
110 boolean showHiddenMarkers = true;
112 public Hashtable[] hconsensus;
114 AlignmentAnnotation consensus;
116 AlignmentAnnotation conservation;
118 AlignmentAnnotation quality;
119 AlignmentAnnotation[] groupConsensus;
120 AlignmentAnnotation[] groupConservation;
122 boolean autocalculateConsensus = true;
124 public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
126 private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
129 boolean ignoreGapsInConsensusCalculation = false;
131 jalview.bin.JalviewLite applet;
133 Hashtable sequenceColours;
137 Stack historyList = new Stack();
139 Stack redoList = new Stack();
141 String sequenceSetID;
143 Hashtable hiddenRepSequences;
145 public AlignViewport(AlignmentI al, JalviewLite applet)
147 this.applet = applet;
150 this.endRes = al.getWidth() - 1;
152 this.endSeq = al.getHeight() - 1;
155 MAC = new jalview.util.Platform().isAMac();
159 String param = applet.getParameter("showFullId");
162 showJVSuffix = Boolean.valueOf(param).booleanValue();
165 param = applet.getParameter("showAnnotation");
168 showAnnotation = Boolean.valueOf(param).booleanValue();
171 param = applet.getParameter("showConservation");
174 showConservation = Boolean.valueOf(param).booleanValue();
177 param = applet.getParameter("showQuality");
180 showQuality = Boolean.valueOf(param).booleanValue();
183 param = applet.getParameter("showConsensus");
186 showConsensus = Boolean.valueOf(param).booleanValue();
189 param = applet.getParameter("showUnconserved");
192 this.showUnconserved = Boolean.valueOf(param).booleanValue();
195 param = applet.getParameter("upperCase");
198 if (param.equalsIgnoreCase("bold"))
200 upperCasebold = true;
203 param = applet.getParameter("sortByTree");
206 sortByTree=Boolean.valueOf(param).booleanValue();
213 String colour = applet.getParameter("defaultColour");
217 colour = applet.getParameter("userDefinedColour");
220 colour = "User Defined";
226 globalColourScheme = ColourSchemeProperty.getColour(alignment,
228 if (globalColourScheme != null)
230 globalColourScheme.setConsensus(hconsensus);
234 if (applet.getParameter("userDefinedColour") != null)
236 ((UserColourScheme) globalColourScheme).parseAppletParameter(applet
237 .getParameter("userDefinedColour"));
240 if (hconsensus == null)
242 if (!alignment.isNucleotide())
244 conservation = new AlignmentAnnotation("Conservation",
245 "Conservation of total alignment less than " + ConsPercGaps
246 + "% gaps", new Annotation[1], 0f, 11f,
247 AlignmentAnnotation.BAR_GRAPH);
248 conservation.hasText = true;
249 conservation.autoCalculated = true;
251 if (showConservation)
253 alignment.addAnnotation(conservation);
258 quality = new AlignmentAnnotation("Quality",
259 "Alignment Quality based on Blosum62 scores",
260 new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
261 quality.hasText = true;
262 quality.autoCalculated = true;
264 alignment.addAnnotation(quality);
268 consensus = new AlignmentAnnotation("Consensus", "PID",
269 new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
270 consensus.hasText = true;
271 consensus.autoCalculated = true;
275 alignment.addAnnotation(consensus);
281 public void showSequenceFeatures(boolean b)
283 showSequenceFeatures = b;
286 public boolean getShowSequenceFeatures()
288 return showSequenceFeatures;
291 class ConservationThread extends Thread
295 public ConservationThread(AlignmentPanel ap)
304 updatingConservation = true;
306 while (UPDATING_CONSERVATION)
312 ap.paintAlignment(false);
315 } catch (Exception ex)
317 ex.printStackTrace();
321 UPDATING_CONSERVATION = true;
323 int alWidth = alignment.getWidth();
329 Conservation cons = new jalview.analysis.Conservation("All",
330 jalview.schemes.ResidueProperties.propHash, 3, alignment
331 .getSequences(), 0, alWidth - 1);
334 cons.verdict(false, ConsPercGaps);
341 char[] sequence = cons.getConsSequence().getSequence();
353 maxB = 0f - minB; // scalable range for colouring both Conservation and
363 conservation.annotations = new Annotation[alWidth];
367 quality.graphMax = cons.qualityRange[1].floatValue();
368 quality.annotations = new Annotation[alWidth];
369 qmin = cons.qualityRange[0].floatValue();
370 qmax = cons.qualityRange[1].floatValue();
373 for (int i = 0; i < alWidth; i++)
379 if (Character.isDigit(c))
381 value = (int) (c - '0');
391 // TODO - refactor to use a graduatedColorScheme to calculate the histogram colors.
392 float vprop = value - min;
394 conservation.annotations[i] = new Annotation(String.valueOf(c),
395 String.valueOf(value), ' ', value, new Color(minR
396 + (maxR * vprop), minG + (maxG * vprop), minB
402 value = ((Double) cons.quality.elementAt(i)).floatValue();
403 vprop = value - qmin;
405 quality.annotations[i] = new Annotation(" ", String
406 .valueOf(value), ' ', value, new Color(minR
407 + (maxR * vprop), minG + (maxG * vprop), minB
411 } catch (OutOfMemoryError error)
413 System.out.println("Out of memory calculating conservation!!");
419 UPDATING_CONSERVATION = false;
420 updatingConservation = false;
424 ap.paintAlignment(true);
430 ConservationThread conservationThread;
432 ConsensusThread consensusThread;
434 boolean consUpdateNeeded = false;
436 static boolean UPDATING_CONSENSUS = false;
438 static boolean UPDATING_CONSERVATION = false;
440 boolean updatingConsensus = false;
442 boolean updatingConservation = false;
447 public void updateConservation(final AlignmentPanel ap)
449 if (alignment.isNucleotide() || conservation == null)
454 conservationThread = new ConservationThread(ap);
455 conservationThread.start();
461 public void updateConsensus(final AlignmentPanel ap)
463 consensusThread = new ConsensusThread(ap);
464 consensusThread.start();
467 class ConsensusThread extends Thread
471 public ConsensusThread(AlignmentPanel ap)
478 updatingConsensus = true;
479 while (UPDATING_CONSENSUS)
485 ap.paintAlignment(false);
489 } catch (Exception ex)
491 ex.printStackTrace();
495 UPDATING_CONSENSUS = true;
499 int aWidth = alignment.getWidth();
505 consensus.annotations = null;
506 consensus.annotations = new Annotation[aWidth];
508 hconsensus = new Hashtable[aWidth];
509 AAFrequency.calculate(alignment.getSequencesArray(), 0, alignment
510 .getWidth(), hconsensus, includeAllConsensusSymbols);
511 AAFrequency.completeConsensus(consensus,hconsensus,0,aWidth,ignoreGapsInConsensusCalculation, includeAllConsensusSymbols);
513 if (globalColourScheme != null)
515 globalColourScheme.setConsensus(hconsensus);
518 } catch (OutOfMemoryError error)
520 alignment.deleteAnnotation(consensus);
524 System.out.println("Out of memory calculating consensus!!");
527 UPDATING_CONSENSUS = false;
528 updatingConsensus = false;
532 ap.paintAlignment(true);
538 * get the consensus sequence as displayed under the PID consensus annotation
541 * @return consensus sequence as a new sequence object
543 public SequenceI getConsensusSeq()
545 if (consensus == null)
549 StringBuffer seqs = new StringBuffer();
550 for (int i = 0; i < consensus.annotations.length; i++)
552 if (consensus.annotations[i] != null)
554 if (consensus.annotations[i].description.charAt(0) == '[')
556 seqs.append(consensus.annotations[i].description.charAt(1));
560 seqs.append(consensus.annotations[i].displayCharacter);
564 SequenceI sq = new Sequence("Consensus", seqs.toString());
565 sq.setDescription("Percentage Identity Consensus "
566 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
570 public SequenceGroup getSelectionGroup()
572 return selectionGroup;
575 public void setSelectionGroup(SequenceGroup sg)
580 public boolean getConservationSelected()
582 return conservationColourSelected;
585 public void setConservationSelected(boolean b)
587 conservationColourSelected = b;
590 public boolean getAbovePIDThreshold()
592 return abovePIDThreshold;
595 public void setAbovePIDThreshold(boolean b)
597 abovePIDThreshold = b;
600 public int getStartRes()
605 public int getEndRes()
610 public int getStartSeq()
615 public void setGlobalColourScheme(ColourSchemeI cs)
617 globalColourScheme = cs;
620 public ColourSchemeI getGlobalColourScheme()
622 return globalColourScheme;
625 public void setStartRes(int res)
630 public void setStartSeq(int seq)
635 public void setEndRes(int res)
637 if (res > alignment.getWidth() - 1)
639 // log.System.out.println(" Corrected res from " + res + " to maximum " +
640 // (alignment.getWidth()-1));
641 res = alignment.getWidth() - 1;
650 public void setEndSeq(int seq)
652 if (seq > alignment.getHeight())
654 seq = alignment.getHeight();
663 public int getEndSeq()
668 java.awt.Frame nullFrame;
670 protected FeatureSettings featureSettings = null;
672 public void setFont(Font f)
675 if (nullFrame == null)
677 nullFrame = new java.awt.Frame();
678 nullFrame.addNotify();
681 java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
682 setCharHeight(fm.getHeight());
683 charWidth = fm.charWidth('M');
687 Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
688 fm = nullFrame.getGraphics().getFontMetrics(f2);
689 charWidth = fm.stringWidth("MMMMMMMMMMM") / 10;
693 public Font getFont()
698 public int getCharWidth()
703 public void setCharHeight(int h)
708 public int getCharHeight()
713 public void setWrappedWidth(int w)
715 this.wrappedWidth = w;
718 public int getwrappedWidth()
723 public AlignmentI getAlignment()
728 public void setAlignment(AlignmentI align)
730 this.alignment = align;
733 public void setWrapAlignment(boolean state)
735 wrapAlignment = state;
738 public void setShowText(boolean state)
743 public void setRenderGaps(boolean state)
748 public boolean getColourText()
750 return showColourText;
753 public void setColourText(boolean state)
755 showColourText = state;
758 public void setShowBoxes(boolean state)
763 public boolean getWrapAlignment()
765 return wrapAlignment;
768 public boolean getShowText()
773 public boolean getShowBoxes()
778 public char getGapCharacter()
780 return getAlignment().getGapCharacter();
783 public void setGapCharacter(char gap)
785 if (getAlignment() != null)
787 getAlignment().setGapCharacter(gap);
791 public void setThreshold(int thresh)
796 public int getThreshold()
801 public void setIncrement(int inc)
806 public int getIncrement()
811 public void setHiddenColumns(ColumnSelection colsel)
813 this.colSel = colsel;
814 if (colSel.getHiddenColumns() != null)
816 hasHiddenColumns = true;
820 public ColumnSelection getColumnSelection()
825 public void resetSeqLimits(int height)
827 setEndSeq(height / getCharHeight());
830 public void setCurrentTree(NJTree tree)
835 public NJTree getCurrentTree()
840 public void setColourAppliesToAllGroups(boolean b)
842 colourAppliesToAllGroups = b;
845 public boolean getColourAppliesToAllGroups()
847 return colourAppliesToAllGroups;
850 public boolean getShowJVSuffix()
855 public void setShowJVSuffix(boolean b)
860 public boolean getShowAnnotation()
862 return showAnnotation;
865 public void setShowAnnotation(boolean b)
870 public boolean getScaleAboveWrapped()
872 return scaleAboveWrapped;
875 public boolean getScaleLeftWrapped()
877 return scaleLeftWrapped;
880 public boolean getScaleRightWrapped()
882 return scaleRightWrapped;
885 public void setScaleAboveWrapped(boolean b)
887 scaleAboveWrapped = b;
890 public void setScaleLeftWrapped(boolean b)
892 scaleLeftWrapped = b;
895 public void setScaleRightWrapped(boolean b)
897 scaleRightWrapped = b;
900 public void setIgnoreGapsConsensus(boolean b)
902 ignoreGapsInConsensusCalculation = b;
903 updateConsensus(null);
904 if (globalColourScheme != null)
906 globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
907 ignoreGapsInConsensusCalculation);
913 * Property change listener for changes in alignment
918 public void addPropertyChangeListener(
919 java.beans.PropertyChangeListener listener)
921 changeSupport.addPropertyChangeListener(listener);
930 public void removePropertyChangeListener(
931 java.beans.PropertyChangeListener listener)
933 changeSupport.removePropertyChangeListener(listener);
937 * Property change listener for changes in alignment
946 public void firePropertyChange(String prop, Object oldvalue,
949 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
952 public boolean getIgnoreGapsConsensus()
954 return ignoreGapsInConsensusCalculation;
957 public void hideSelectedColumns()
959 if (colSel.size() < 1)
964 colSel.hideSelectedColumns();
965 setSelectionGroup(null);
967 hasHiddenColumns = true;
970 public void invertColumnSelection()
972 for (int i = 0; i < alignment.getWidth(); i++)
974 if (colSel.contains(i))
976 colSel.removeElement(i);
980 if (!hasHiddenColumns || colSel.isVisible(i))
982 colSel.addElement(i);
988 public void hideColumns(int start, int end)
992 colSel.hideColumns(start);
996 colSel.hideColumns(start, end);
999 hasHiddenColumns = true;
1002 public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
1004 int sSize = sg.getSize();
1010 if (hiddenRepSequences == null)
1012 hiddenRepSequences = new Hashtable();
1015 hiddenRepSequences.put(repSequence, sg);
1017 // Hide all sequences except the repSequence
1018 SequenceI[] seqs = new SequenceI[sSize - 1];
1020 for (int i = 0; i < sSize; i++)
1022 if (sg.getSequenceAt(i) != repSequence)
1024 if (index == sSize - 1)
1029 seqs[index++] = sg.getSequenceAt(i);
1037 public void hideAllSelectedSeqs()
1039 if (selectionGroup == null || selectionGroup.getSize() < 1)
1044 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1048 setSelectionGroup(null);
1051 public void hideSequence(SequenceI[] seq)
1055 for (int i = 0; i < seq.length; i++)
1057 alignment.getHiddenSequences().hideSequence(seq[i]);
1060 hasHiddenRows = true;
1061 firePropertyChange("alignment", null, alignment.getSequences());
1065 public void showColumn(int col)
1067 colSel.revealHiddenColumns(col);
1068 if (colSel.getHiddenColumns() == null)
1070 hasHiddenColumns = false;
1074 public void showAllHiddenColumns()
1076 colSel.revealAllHiddenColumns();
1077 hasHiddenColumns = false;
1080 public void showAllHiddenSeqs()
1082 if (alignment.getHiddenSequences().getSize() > 0)
1084 if (selectionGroup == null)
1086 selectionGroup = new SequenceGroup();
1087 selectionGroup.setEndRes(alignment.getWidth() - 1);
1089 Vector tmp = alignment.getHiddenSequences().showAll(
1090 hiddenRepSequences);
1091 for (int t = 0; t < tmp.size(); t++)
1093 selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
1095 firePropertyChange("alignment", null, alignment.getSequences());
1096 hasHiddenRows = false;
1097 hiddenRepSequences = null;
1101 public int adjustForHiddenSeqs(int alignmentIndex)
1103 return alignment.getHiddenSequences().adjustForHiddenSeqs(
1108 * This method returns the a new SequenceI [] with the selection sequence and
1109 * start and end points adjusted
1113 public SequenceI[] getSelectionAsNewSequence()
1115 SequenceI[] sequences;
1117 if (selectionGroup == null)
1119 sequences = alignment.getSequencesArray();
1123 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1130 * This method returns the visible alignment as text, as seen on the GUI, ie
1131 * if columns are hidden they will not be returned in the result. Use this for
1132 * calculating trees, PCA, redundancy etc on views which contain hidden
1137 public jalview.datamodel.CigarArray getViewAsCigars(
1138 boolean selectedRegionOnly)
1140 CigarArray selection = null;
1141 SequenceI[] seqs = null;
1143 int start = 0, end = 0;
1144 if (selectedRegionOnly && selectionGroup != null)
1146 iSize = selectionGroup.getSize();
1147 seqs = selectionGroup.getSequencesInOrder(alignment);
1148 start = selectionGroup.getStartRes();
1149 end = selectionGroup.getEndRes(); // inclusive for start and end in
1150 // SeqCigar constructor
1154 iSize = alignment.getHeight();
1155 seqs = alignment.getSequencesArray();
1156 end = alignment.getWidth() - 1;
1158 SeqCigar[] selseqs = new SeqCigar[iSize];
1159 for (i = 0; i < iSize; i++)
1161 selseqs[i] = new SeqCigar(seqs[i], start, end);
1163 selection = new CigarArray(selseqs);
1164 // now construct the CigarArray operations
1165 if (hasHiddenColumns)
1167 Vector regions = colSel.getHiddenColumns();
1169 int hideStart, hideEnd;
1171 for (int j = 0; last < end & j < regions.size(); j++)
1173 region = (int[]) regions.elementAt(j);
1174 hideStart = region[0];
1175 hideEnd = region[1];
1176 // edit hidden regions to selection range
1177 if (hideStart < last)
1189 if (hideStart > end)
1199 if (hideStart > hideEnd)
1204 * form operations...
1206 if (last < hideStart)
1208 selection.addOperation(CigarArray.M, hideStart - last);
1210 selection.addOperation(CigarArray.D, 1 + hideEnd - hideStart);
1213 // Final match if necessary.
1216 selection.addOperation(CigarArray.M, end - last + 1);
1221 selection.addOperation(CigarArray.M, end - start + 1);
1227 * return a compact representation of the current alignment selection to pass
1228 * to an analysis function
1230 * @param selectedOnly
1231 * boolean true to just return the selected view
1232 * @return AlignmentView
1234 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
1237 // this is here because the AlignmentView constructor modifies the
1239 // object. Refactoring of Cigar and alignment view representation should
1240 // be done to remove redundancy.
1241 CigarArray aligview = getViewAsCigars(selectedOnly);
1242 if (aligview != null)
1244 return new AlignmentView(aligview,
1245 (selectedOnly && selectionGroup != null) ? selectionGroup
1246 .getStartRes() : 0);
1252 * This method returns the visible alignment as text, as seen on the GUI, ie
1253 * if columns are hidden they will not be returned in the result. Use this for
1254 * calculating trees, PCA, redundancy etc on views which contain hidden
1259 public String[] getViewAsString(boolean selectedRegionOnly)
1261 String[] selection = null;
1262 SequenceI[] seqs = null;
1264 int start = 0, end = 0;
1265 if (selectedRegionOnly && selectionGroup != null)
1267 iSize = selectionGroup.getSize();
1268 seqs = selectionGroup.getSequencesInOrder(alignment);
1269 start = selectionGroup.getStartRes();
1270 end = selectionGroup.getEndRes() + 1;
1274 iSize = alignment.getHeight();
1275 seqs = alignment.getSequencesArray();
1276 end = alignment.getWidth();
1279 selection = new String[iSize];
1281 for (i = 0; i < iSize; i++)
1283 if (hasHiddenColumns)
1285 StringBuffer visibleSeq = new StringBuffer();
1286 Vector regions = colSel.getHiddenColumns();
1288 int blockStart = start, blockEnd = end;
1290 int hideStart, hideEnd;
1292 for (int j = 0; j < regions.size(); j++)
1294 region = (int[]) regions.elementAt(j);
1295 hideStart = region[0];
1296 hideEnd = region[1];
1298 if (hideStart < start)
1303 blockStart = Math.min(blockStart, hideEnd + 1);
1304 blockEnd = Math.min(blockEnd, hideStart);
1306 if (blockStart > blockEnd)
1311 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
1313 blockStart = hideEnd + 1;
1317 if (end > blockStart)
1319 visibleSeq.append(seqs[i].getSequence(blockStart, end));
1322 selection[i] = visibleSeq.toString();
1326 selection[i] = seqs[i].getSequenceAsString(start, end);
1333 public boolean getShowHiddenMarkers()
1335 return showHiddenMarkers;
1338 public void setShowHiddenMarkers(boolean show)
1340 showHiddenMarkers = show;
1343 public Color getSequenceColour(SequenceI seq)
1345 if (sequenceColours == null || !sequenceColours.containsKey(seq))
1351 return (Color) sequenceColours.get(seq);
1355 public void setSequenceColour(SequenceI seq, Color col)
1357 if (sequenceColours == null)
1359 sequenceColours = new Hashtable();
1364 sequenceColours.remove(seq);
1368 sequenceColours.put(seq, col);
1372 public String getSequenceSetId()
1374 if (sequenceSetID == null)
1376 sequenceSetID = alignment.hashCode() + "";
1379 return sequenceSetID;
1382 public void alignmentChanged(AlignmentPanel ap)
1384 alignment.padGaps();
1386 if (hconsensus != null && autocalculateConsensus)
1388 updateConsensus(ap);
1389 updateConservation(ap);
1392 // Reset endRes of groups if beyond alignment width
1393 int alWidth = alignment.getWidth();
1394 Vector groups = alignment.getGroups();
1397 for (int i = 0; i < groups.size(); i++)
1399 SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
1400 if (sg.getEndRes() > alWidth)
1402 sg.setEndRes(alWidth - 1);
1407 if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
1409 selectionGroup.setEndRes(alWidth - 1);
1412 resetAllColourSchemes();
1414 // AW alignment.adjustSequenceAnnotations();
1417 void resetAllColourSchemes()
1419 ColourSchemeI cs = globalColourScheme;
1422 if (cs instanceof ClustalxColourScheme)
1424 ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
1425 alignment.getWidth());
1428 cs.setConsensus(hconsensus);
1429 if (cs.conservationApplied())
1431 Alignment al = (Alignment) alignment;
1432 Conservation c = new Conservation("All",
1433 ResidueProperties.propHash, 3, al.getSequences(), 0, al
1436 c.verdict(false, ConsPercGaps);
1438 cs.setConservation(c);
1442 int s, sSize = alignment.getGroups().size();
1443 for (s = 0; s < sSize; s++)
1445 SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
1446 if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
1448 ((ClustalxColourScheme) sg.cs).resetClustalX(sg
1449 .getSequences(hiddenRepSequences), sg.getWidth());
1451 sg.recalcConservation();
1455 boolean centreColumnLabels;
1458 public boolean getCentreColumnLabels()
1460 return centreColumnLabels;
1463 public void updateSequenceIdColours()
1465 Vector groups = alignment.getGroups();
1466 for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
1468 SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
1469 if (sg.idColour != null)
1471 Vector sqs = sg.getSequences(hiddenRepSequences);
1472 for (int s = 0, sSize = sqs.size(); s < sSize; s++)
1474 this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
1479 public boolean followHighlight=false;
1480 public boolean getFollowHighlight() {
1481 return followHighlight;
1484 * show non-conserved residues only
1486 public boolean showUnconserved=false;
1489 * when set, alignment should be reordered according to a newly opened tree
1491 public boolean sortByTree=false;
1494 * @return the showUnconserved
1496 public boolean getShowunconserved()
1498 return showUnconserved;
1502 * @param showUnconserved the showUnconserved to set
1504 public void setShowunconserved(boolean displayNonconserved)
1506 this.showUnconserved = displayNonconserved;
1510 * consensus annotation includes all percentage for all symbols in column
1511 * DISABLED FOR 2.5 RELEASE (bug #60064 logo rendering is not AWT 1.1 compatible)
1513 private boolean includeAllConsensusSymbols=false;
1516 * should conservation rows be shown for groups
1517 * DISABLED FOR 2.5 RELEASE (bug 62446)
1519 boolean showGroupConservation = false;
1521 * should consensus rows be shown for groups
1522 * DISABLED FOR 2.5 RELEASE (bug 62446)
1524 boolean showGroupConsensus = false;
1526 * should consensus profile be rendered by default
1527 * DISABLED FOR 2.5 RELEASE (bug #60064 logo rendering is not AWT 1.1 compatible)
1529 public boolean showSequenceLogo = false;
1531 * should consensus histograms be rendered by default
1533 public boolean showConsensusHistogram = true;
1535 * @return the showConsensusProfile
1537 public boolean isShowSequenceLogo()
1539 return showSequenceLogo;
1542 * @param showSequenceLogo the new value
1543 public void setShowSequenceLogo(boolean showSequenceLogo)
1545 this.showSequenceLogo = showSequenceLogo;
1549 * @param showGroupConsensus the showGroupConsensus to set
1551 public void setShowGroupConsensus(boolean showGroupConsensus)
1553 this.showGroupConsensus = showGroupConsensus;
1556 * @return the includeAllConsensusSymbols
1558 public boolean isIncludeAllConsensusSymbols()
1565 * @return flag to indicate if the consensus histogram should be rendered by default
1567 public boolean isShowConsensusHistogram()
1569 return this.showConsensusHistogram;