2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.appletgui;
24 import jalview.analysis.*;
26 import jalview.datamodel.*;
27 import jalview.schemes.*;
29 public class AlignViewport
39 boolean cursorMode = false;
41 boolean showJVSuffix = true;
43 boolean showText = true;
45 boolean showColourText = false;
47 boolean showBoxes = true;
49 boolean wrapAlignment = false;
51 boolean renderGaps = true;
53 boolean showSequenceFeatures = false;
55 boolean showAnnotation = true;
57 boolean showConservation = true;
59 boolean showQuality = true;
61 boolean showConsensus = true;
63 boolean upperCasebold = false;
65 boolean colourAppliesToAllGroups = true;
67 ColourSchemeI globalColourScheme = null;
69 boolean conservationColourSelected = false;
71 boolean abovePIDThreshold = false;
73 SequenceGroup selectionGroup;
81 Font font = new Font("SansSerif", Font.PLAIN, 10);
83 boolean validCharWidth = true;
87 ColumnSelection colSel = new ColumnSelection();
93 NJTree currentTree = null;
95 boolean scaleAboveWrapped = true;
97 boolean scaleLeftWrapped = true;
99 boolean scaleRightWrapped = true;
101 // The following vector holds the features which are
102 // currently visible, in the correct order or rendering
103 public Hashtable featuresDisplayed;
105 boolean hasHiddenColumns = false;
107 boolean hasHiddenRows = false;
109 boolean showHiddenMarkers = true;
111 public Hashtable[] hconsensus;
113 AlignmentAnnotation consensus;
115 AlignmentAnnotation conservation;
117 AlignmentAnnotation quality;
119 AlignmentAnnotation[] groupConsensus;
121 AlignmentAnnotation[] groupConservation;
123 boolean autocalculateConsensus = true;
125 public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
127 private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
130 boolean ignoreGapsInConsensusCalculation = false;
132 jalview.bin.JalviewLite applet;
134 Hashtable sequenceColours;
138 Stack historyList = new Stack();
140 Stack redoList = new Stack();
142 String sequenceSetID;
144 Hashtable hiddenRepSequences;
146 public AlignViewport(AlignmentI al, JalviewLite applet)
148 this.applet = applet;
151 this.endRes = al.getWidth() - 1;
153 this.endSeq = al.getHeight() - 1;
156 // get the width and height scaling factors if they were specified
157 String param = applet.getParameter("widthScale");
162 widthScale = new Float(param).floatValue();
163 } catch (Exception e)
166 if (widthScale <= 1.0)
169 .println("Invalid alignment character width scaling factor ("
170 + widthScale + "). Ignoring.");
176 .println("Alignment character width scaling factor is now "
180 param = applet.getParameter("heightScale");
185 heightScale = new Float(param).floatValue();
186 } catch (Exception e)
189 if (heightScale <= 1.0)
192 .println("Invalid alignment character height scaling factor ("
193 + heightScale + "). Ignoring.");
199 .println("Alignment character height scaling factor is now "
206 MAC = new jalview.util.Platform().isAMac();
210 String param = applet.getParameter("showFullId");
213 showJVSuffix = Boolean.valueOf(param).booleanValue();
216 param = applet.getParameter("showAnnotation");
219 showAnnotation = Boolean.valueOf(param).booleanValue();
222 param = applet.getParameter("showConservation");
225 showConservation = Boolean.valueOf(param).booleanValue();
228 param = applet.getParameter("showQuality");
231 showQuality = Boolean.valueOf(param).booleanValue();
234 param = applet.getParameter("showConsensus");
237 showConsensus = Boolean.valueOf(param).booleanValue();
240 param = applet.getParameter("showUnconserved");
243 this.showUnconserved = Boolean.valueOf(param).booleanValue();
246 param = applet.getParameter("upperCase");
249 if (param.equalsIgnoreCase("bold"))
251 upperCasebold = true;
254 param = applet.getParameter("sortByTree");
257 sortByTree = Boolean.valueOf(param).booleanValue();
264 String colour = applet.getParameter("defaultColour");
268 colour = applet.getParameter("userDefinedColour");
271 colour = "User Defined";
277 globalColourScheme = ColourSchemeProperty.getColour(alignment,
279 if (globalColourScheme != null)
281 globalColourScheme.setConsensus(hconsensus);
285 if (applet.getParameter("userDefinedColour") != null)
287 ((UserColourScheme) globalColourScheme).parseAppletParameter(applet
288 .getParameter("userDefinedColour"));
291 if (hconsensus == null)
293 if (!alignment.isNucleotide())
295 conservation = new AlignmentAnnotation("Conservation",
296 "Conservation of total alignment less than " + ConsPercGaps
297 + "% gaps", new Annotation[1], 0f, 11f,
298 AlignmentAnnotation.BAR_GRAPH);
299 conservation.hasText = true;
300 conservation.autoCalculated = true;
302 if (showConservation)
304 alignment.addAnnotation(conservation);
309 quality = new AlignmentAnnotation("Quality",
310 "Alignment Quality based on Blosum62 scores",
311 new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
312 quality.hasText = true;
313 quality.autoCalculated = true;
315 alignment.addAnnotation(quality);
319 consensus = new AlignmentAnnotation("Consensus", "PID",
320 new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
321 consensus.hasText = true;
322 consensus.autoCalculated = true;
326 alignment.addAnnotation(consensus);
332 public void showSequenceFeatures(boolean b)
334 showSequenceFeatures = b;
337 public boolean getShowSequenceFeatures()
339 return showSequenceFeatures;
342 class ConservationThread extends Thread
346 public ConservationThread(AlignmentPanel ap)
355 updatingConservation = true;
357 while (UPDATING_CONSERVATION)
363 ap.paintAlignment(false);
366 } catch (Exception ex)
368 ex.printStackTrace();
372 UPDATING_CONSERVATION = true;
374 int alWidth = (alignment==null) ? -1 : alignment.getWidth();
377 updatingConservation = false;
378 UPDATING_CONSERVATION = false;
382 Conservation cons = new jalview.analysis.Conservation("All",
383 jalview.schemes.ResidueProperties.propHash, 3,
384 alignment.getSequences(), 0, alWidth - 1);
387 cons.verdict(false, ConsPercGaps);
394 char[] sequence = cons.getConsSequence().getSequence();
406 maxB = 0f - minB; // scalable range for colouring both Conservation and
416 conservation.annotations = new Annotation[alWidth];
420 quality.graphMax = cons.qualityRange[1].floatValue();
421 quality.annotations = new Annotation[alWidth];
422 qmin = cons.qualityRange[0].floatValue();
423 qmax = cons.qualityRange[1].floatValue();
426 for (int i = 0; i < alWidth; i++)
432 if (Character.isDigit(c))
434 value = (int) (c - '0');
444 // TODO - refactor to use a graduatedColorScheme to calculate the
446 float vprop = value - min;
448 conservation.annotations[i] = new Annotation(String.valueOf(c),
449 String.valueOf(value), ' ', value, new Color(minR
450 + (maxR * vprop), minG + (maxG * vprop), minB
456 value = ((Double) cons.quality.elementAt(i)).floatValue();
457 vprop = value - qmin;
459 quality.annotations[i] = new Annotation(" ",
460 String.valueOf(value), ' ', value, new Color(minR
461 + (maxR * vprop), minG + (maxG * vprop), minB
465 } catch (OutOfMemoryError error)
467 System.out.println("Out of memory calculating conservation!!");
473 UPDATING_CONSERVATION = false;
474 updatingConservation = false;
478 ap.paintAlignment(true);
484 ConservationThread conservationThread;
486 ConsensusThread consensusThread;
488 boolean consUpdateNeeded = false;
490 static boolean UPDATING_CONSENSUS = false;
492 static boolean UPDATING_CONSERVATION = false;
494 boolean updatingConsensus = false;
496 boolean updatingConservation = false;
501 public void updateConservation(final AlignmentPanel ap)
503 if (alignment.isNucleotide() || conservation == null)
508 conservationThread = new ConservationThread(ap);
509 conservationThread.start();
515 public void updateConsensus(final AlignmentPanel ap)
517 consensusThread = new ConsensusThread(ap);
518 consensusThread.start();
521 class ConsensusThread extends Thread
525 public ConsensusThread(AlignmentPanel ap)
532 updatingConsensus = true;
533 while (UPDATING_CONSENSUS)
539 ap.paintAlignment(false);
543 } catch (Exception ex)
545 ex.printStackTrace();
549 UPDATING_CONSENSUS = true;
553 int aWidth = alignment==null ? -1 : alignment.getWidth();
556 UPDATING_CONSENSUS = false;
557 updatingConsensus = false;
561 consensus.annotations = null;
562 consensus.annotations = new Annotation[aWidth];
564 hconsensus = new Hashtable[aWidth];
565 AAFrequency.calculate(alignment.getSequencesArray(), 0,
566 alignment.getWidth(), hconsensus, true); // always calculate the
568 AAFrequency.completeConsensus(consensus, hconsensus, 0, aWidth,
569 ignoreGapsInConsensusCalculation,
570 includeAllConsensusSymbols);
572 if (globalColourScheme != null)
574 globalColourScheme.setConsensus(hconsensus);
577 } catch (OutOfMemoryError error)
579 alignment.deleteAnnotation(consensus);
583 System.out.println("Out of memory calculating consensus!!");
586 UPDATING_CONSENSUS = false;
587 updatingConsensus = false;
591 ap.paintAlignment(true);
597 * get the consensus sequence as displayed under the PID consensus annotation
600 * @return consensus sequence as a new sequence object
602 public SequenceI getConsensusSeq()
604 if (consensus == null)
608 StringBuffer seqs = new StringBuffer();
609 for (int i = 0; i < consensus.annotations.length; i++)
611 if (consensus.annotations[i] != null)
613 if (consensus.annotations[i].description.charAt(0) == '[')
615 seqs.append(consensus.annotations[i].description.charAt(1));
619 seqs.append(consensus.annotations[i].displayCharacter);
623 SequenceI sq = new Sequence("Consensus", seqs.toString());
624 sq.setDescription("Percentage Identity Consensus "
625 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
629 public SequenceGroup getSelectionGroup()
631 return selectionGroup;
634 public void setSelectionGroup(SequenceGroup sg)
639 public boolean getConservationSelected()
641 return conservationColourSelected;
644 public void setConservationSelected(boolean b)
646 conservationColourSelected = b;
649 public boolean getAbovePIDThreshold()
651 return abovePIDThreshold;
654 public void setAbovePIDThreshold(boolean b)
656 abovePIDThreshold = b;
659 public int getStartRes()
664 public int getEndRes()
669 public int getStartSeq()
674 public void setGlobalColourScheme(ColourSchemeI cs)
676 globalColourScheme = cs;
679 public ColourSchemeI getGlobalColourScheme()
681 return globalColourScheme;
684 public void setStartRes(int res)
689 public void setStartSeq(int seq)
694 public void setEndRes(int res)
696 if (res > alignment.getWidth() - 1)
698 // log.System.out.println(" Corrected res from " + res + " to maximum " +
699 // (alignment.getWidth()-1));
700 res = alignment.getWidth() - 1;
709 public void setEndSeq(int seq)
711 if (seq > alignment.getHeight())
713 seq = alignment.getHeight();
722 public int getEndSeq()
727 java.awt.Frame nullFrame;
729 protected FeatureSettings featureSettings = null;
731 private float heightScale = 1, widthScale = 1;
733 public void setFont(Font f)
736 if (nullFrame == null)
738 nullFrame = new java.awt.Frame();
739 nullFrame.addNotify();
742 java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
743 setCharHeight((int) (heightScale * fm.getHeight()));
744 charWidth = (int) (widthScale * fm.charWidth('M'));
748 Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
749 fm = nullFrame.getGraphics().getFontMetrics(f2);
750 charWidth = (int) (widthScale * (fm.stringWidth("MMMMMMMMMMM") / 10));
754 public Font getFont()
759 public int getCharWidth()
764 public void setCharHeight(int h)
769 public int getCharHeight()
774 public void setWrappedWidth(int w)
776 this.wrappedWidth = w;
779 public int getwrappedWidth()
784 public AlignmentI getAlignment()
789 public void setAlignment(AlignmentI align)
791 this.alignment = align;
794 public void setWrapAlignment(boolean state)
796 wrapAlignment = state;
799 public void setShowText(boolean state)
804 public void setRenderGaps(boolean state)
809 public boolean getColourText()
811 return showColourText;
814 public void setColourText(boolean state)
816 showColourText = state;
819 public void setShowBoxes(boolean state)
824 public boolean getWrapAlignment()
826 return wrapAlignment;
829 public boolean getShowText()
834 public boolean getShowBoxes()
839 public char getGapCharacter()
841 return getAlignment().getGapCharacter();
844 public void setGapCharacter(char gap)
846 if (getAlignment() != null)
848 getAlignment().setGapCharacter(gap);
852 public void setThreshold(int thresh)
857 public int getThreshold()
862 public void setIncrement(int inc)
867 public int getIncrement()
872 public void setHiddenColumns(ColumnSelection colsel)
874 this.colSel = colsel;
875 if (colSel.getHiddenColumns() != null)
877 hasHiddenColumns = true;
881 public ColumnSelection getColumnSelection()
886 public void resetSeqLimits(int height)
888 setEndSeq(height / getCharHeight());
891 public void setCurrentTree(NJTree tree)
896 public NJTree getCurrentTree()
901 public void setColourAppliesToAllGroups(boolean b)
903 colourAppliesToAllGroups = b;
906 public boolean getColourAppliesToAllGroups()
908 return colourAppliesToAllGroups;
911 public boolean getShowJVSuffix()
916 public void setShowJVSuffix(boolean b)
921 public boolean getShowAnnotation()
923 return showAnnotation;
926 public void setShowAnnotation(boolean b)
931 public boolean getScaleAboveWrapped()
933 return scaleAboveWrapped;
936 public boolean getScaleLeftWrapped()
938 return scaleLeftWrapped;
941 public boolean getScaleRightWrapped()
943 return scaleRightWrapped;
946 public void setScaleAboveWrapped(boolean b)
948 scaleAboveWrapped = b;
951 public void setScaleLeftWrapped(boolean b)
953 scaleLeftWrapped = b;
956 public void setScaleRightWrapped(boolean b)
958 scaleRightWrapped = b;
961 public void setIgnoreGapsConsensus(boolean b)
963 ignoreGapsInConsensusCalculation = b;
964 updateConsensus(null);
965 if (globalColourScheme != null)
967 globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
968 ignoreGapsInConsensusCalculation);
974 * Property change listener for changes in alignment
979 public void addPropertyChangeListener(
980 java.beans.PropertyChangeListener listener)
982 changeSupport.addPropertyChangeListener(listener);
991 public void removePropertyChangeListener(
992 java.beans.PropertyChangeListener listener)
994 changeSupport.removePropertyChangeListener(listener);
998 * Property change listener for changes in alignment
1007 public void firePropertyChange(String prop, Object oldvalue,
1010 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
1013 public boolean getIgnoreGapsConsensus()
1015 return ignoreGapsInConsensusCalculation;
1018 public void hideSelectedColumns()
1020 if (colSel.size() < 1)
1025 colSel.hideSelectedColumns();
1026 setSelectionGroup(null);
1028 hasHiddenColumns = true;
1031 public void invertColumnSelection()
1033 for (int i = 0; i < alignment.getWidth(); i++)
1035 if (colSel.contains(i))
1037 colSel.removeElement(i);
1041 if (!hasHiddenColumns || colSel.isVisible(i))
1043 colSel.addElement(i);
1049 public void hideColumns(int start, int end)
1053 colSel.hideColumns(start);
1057 colSel.hideColumns(start, end);
1060 hasHiddenColumns = true;
1063 public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
1065 int sSize = sg.getSize();
1071 if (hiddenRepSequences == null)
1073 hiddenRepSequences = new Hashtable();
1076 hiddenRepSequences.put(repSequence, sg);
1078 // Hide all sequences except the repSequence
1079 SequenceI[] seqs = new SequenceI[sSize - 1];
1081 for (int i = 0; i < sSize; i++)
1083 if (sg.getSequenceAt(i) != repSequence)
1085 if (index == sSize - 1)
1090 seqs[index++] = sg.getSequenceAt(i);
1098 public void hideAllSelectedSeqs()
1100 if (selectionGroup == null || selectionGroup.getSize() < 1)
1105 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1109 setSelectionGroup(null);
1112 public void hideSequence(SequenceI[] seq)
1116 for (int i = 0; i < seq.length; i++)
1118 alignment.getHiddenSequences().hideSequence(seq[i]);
1121 hasHiddenRows = true;
1122 firePropertyChange("alignment", null, alignment.getSequences());
1126 public void showColumn(int col)
1128 colSel.revealHiddenColumns(col);
1129 if (colSel.getHiddenColumns() == null)
1131 hasHiddenColumns = false;
1135 public void showAllHiddenColumns()
1137 colSel.revealAllHiddenColumns();
1138 hasHiddenColumns = false;
1141 public void showAllHiddenSeqs()
1143 if (alignment.getHiddenSequences().getSize() > 0)
1145 if (selectionGroup == null)
1147 selectionGroup = new SequenceGroup();
1148 selectionGroup.setEndRes(alignment.getWidth() - 1);
1150 Vector tmp = alignment.getHiddenSequences().showAll(
1151 hiddenRepSequences);
1152 for (int t = 0; t < tmp.size(); t++)
1154 selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
1156 firePropertyChange("alignment", null, alignment.getSequences());
1157 hasHiddenRows = false;
1158 hiddenRepSequences = null;
1162 public int adjustForHiddenSeqs(int alignmentIndex)
1164 return alignment.getHiddenSequences().adjustForHiddenSeqs(
1169 * This method returns the a new SequenceI [] with the selection sequence and
1170 * start and end points adjusted
1174 public SequenceI[] getSelectionAsNewSequence()
1176 SequenceI[] sequences;
1178 if (selectionGroup == null)
1180 sequences = alignment.getSequencesArray();
1184 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1191 * get the currently selected sequence objects or all the sequences in the
1194 * @return array of references to sequence objects
1196 public SequenceI[] getSequenceSelection()
1198 SequenceI[] sequences = null;
1199 if (selectionGroup != null)
1201 sequences = selectionGroup.getSequencesInOrder(alignment);
1203 if (sequences == null)
1205 sequences = alignment.getSequencesArray();
1211 * This method returns the visible alignment as text, as seen on the GUI, ie
1212 * if columns are hidden they will not be returned in the result. Use this for
1213 * calculating trees, PCA, redundancy etc on views which contain hidden
1218 public jalview.datamodel.CigarArray getViewAsCigars(
1219 boolean selectedRegionOnly)
1221 return new jalview.datamodel.CigarArray(alignment, (hasHiddenColumns ? colSel : null), (selectedRegionOnly ? selectionGroup : null));
1225 * return a compact representation of the current alignment selection to pass
1226 * to an analysis function
1228 * @param selectedOnly
1229 * boolean true to just return the selected view
1230 * @return AlignmentView
1232 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
1234 return getAlignmentView(selectedOnly, false);
1238 * return a compact representation of the current alignment selection to pass
1239 * to an analysis function
1241 * @param selectedOnly
1242 * boolean true to just return the selected view
1244 * boolean true to annotate the alignment view with groups on the alignment (and intersecting with selected region if selectedOnly is true)
1245 * @return AlignmentView
1247 public jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly, boolean markGroups)
1249 return new AlignmentView(alignment, colSel, selectionGroup, hasHiddenColumns, selectedOnly, markGroups);
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,
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(
1449 sg.getSequences(hiddenRepSequences), sg.getWidth());
1451 sg.recalcConservation();
1455 boolean centreColumnLabels;
1457 public boolean getCentreColumnLabels()
1459 return centreColumnLabels;
1462 public void updateSequenceIdColours()
1464 Vector groups = alignment.getGroups();
1465 for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
1467 SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
1468 if (sg.idColour != null)
1470 Vector sqs = sg.getSequences(hiddenRepSequences);
1471 for (int s = 0, sSize = sqs.size(); s < sSize; s++)
1473 this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
1479 public boolean followHighlight = false;
1481 public boolean getFollowHighlight()
1483 return followHighlight;
1487 * show non-conserved residues only
1489 public boolean showUnconserved = false;
1492 * when set, alignment should be reordered according to a newly opened tree
1494 public boolean sortByTree = false;
1497 * @return the showUnconserved
1499 public boolean getShowunconserved()
1501 return showUnconserved;
1505 * @param showNonconserved
1506 * the showUnconserved to set
1508 public void setShowunconserved(boolean displayNonconserved)
1510 this.showUnconserved = displayNonconserved;
1514 * consensus annotation includes all percentage for all symbols in column
1515 * DISABLED FOR 2.5 RELEASE (bug #60064 logo rendering is not AWT 1.1
1518 private boolean includeAllConsensusSymbols = false;
1521 * should conservation rows be shown for groups DISABLED FOR 2.5 RELEASE (bug
1524 boolean showGroupConservation = false;
1527 * should consensus rows be shown for groups DISABLED FOR 2.5 RELEASE (bug
1530 boolean showGroupConsensus = false;
1533 * should consensus profile be rendered by default DISABLED FOR 2.5 RELEASE
1534 * (bug #60064 logo rendering is not AWT 1.1 compatible)
1536 public boolean showSequenceLogo = false;
1539 * should consensus histograms be rendered by default
1541 public boolean showConsensusHistogram = true;
1544 * @return the showConsensusProfile
1546 public boolean isShowSequenceLogo()
1548 return showSequenceLogo;
1552 * @param showSequenceLogo
1553 * the new value public void setShowSequenceLogo(boolean
1554 * showSequenceLogo) { this.showSequenceLogo = showSequenceLogo; }
1557 * @param showGroupConsensus
1558 * the showGroupConsensus to set
1560 public void setShowGroupConsensus(boolean showGroupConsensus)
1562 this.showGroupConsensus = showGroupConsensus;
1566 * @return the includeAllConsensusSymbols
1568 public boolean isIncludeAllConsensusSymbols()
1575 * @return flag to indicate if the consensus histogram should be rendered by
1578 public boolean isShowConsensusHistogram()
1580 return this.showConsensusHistogram;
1584 * synthesize a column selection if none exists so it covers the given
1585 * selection group. if wholewidth is false, no column selection is made if the
1586 * selection group covers the whole alignment width.
1591 public void expandColSelection(SequenceGroup sg, boolean wholewidth)
1595 && (sgs = sg.getStartRes()) >= 0
1596 && sg.getStartRes() <= (sge = sg.getEndRes())
1597 && (colSel == null || colSel.getSelected() == null || colSel
1598 .getSelected().size() == 0))
1600 if (!wholewidth && alignment.getWidth() == (1 + sge - sgs))
1607 colSel = new ColumnSelection();
1609 for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++)
1611 colSel.addElement(cspos);