2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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;
120 boolean autocalculateConsensus = true;
122 public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
124 private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(
127 boolean ignoreGapsInConsensusCalculation = false;
129 jalview.bin.JalviewLite applet;
131 Hashtable sequenceColours;
135 Stack historyList = new Stack();
137 Stack redoList = new Stack();
139 String sequenceSetID;
141 Hashtable hiddenRepSequences;
143 public AlignViewport(AlignmentI al, JalviewLite applet)
145 this.applet = applet;
148 this.endRes = al.getWidth() - 1;
150 this.endSeq = al.getHeight() - 1;
153 MAC = new jalview.util.Platform().isAMac();
157 String param = applet.getParameter("showFullId");
160 showJVSuffix = Boolean.valueOf(param).booleanValue();
163 param = applet.getParameter("showAnnotation");
166 showAnnotation = Boolean.valueOf(param).booleanValue();
169 param = applet.getParameter("showConservation");
172 showConservation = Boolean.valueOf(param).booleanValue();
175 param = applet.getParameter("showQuality");
178 showQuality = Boolean.valueOf(param).booleanValue();
181 param = applet.getParameter("showConsensus");
184 showConsensus = Boolean.valueOf(param).booleanValue();
187 param = applet.getParameter("showUnconserved");
190 this.showUnconserved = Boolean.valueOf(param).booleanValue();
193 param = applet.getParameter("upperCase");
196 if (param.equalsIgnoreCase("bold"))
198 upperCasebold = true;
206 String colour = applet.getParameter("defaultColour");
210 colour = applet.getParameter("userDefinedColour");
213 colour = "User Defined";
219 globalColourScheme = ColourSchemeProperty.getColour(alignment,
221 if (globalColourScheme != null)
223 globalColourScheme.setConsensus(hconsensus);
227 if (applet.getParameter("userDefinedColour") != null)
229 ((UserColourScheme) globalColourScheme).parseAppletParameter(applet
230 .getParameter("userDefinedColour"));
233 if (hconsensus == null)
235 if (!alignment.isNucleotide())
237 conservation = new AlignmentAnnotation("Conservation",
238 "Conservation of total alignment less than " + ConsPercGaps
239 + "% gaps", new Annotation[1], 0f, 11f,
240 AlignmentAnnotation.BAR_GRAPH);
241 conservation.hasText = true;
242 conservation.autoCalculated = true;
244 if (showConservation)
246 alignment.addAnnotation(conservation);
251 quality = new AlignmentAnnotation("Quality",
252 "Alignment Quality based on Blosum62 scores",
253 new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
254 quality.hasText = true;
255 quality.autoCalculated = true;
257 alignment.addAnnotation(quality);
261 consensus = new AlignmentAnnotation("Consensus", "PID",
262 new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
263 consensus.hasText = true;
264 consensus.autoCalculated = true;
268 alignment.addAnnotation(consensus);
274 public void showSequenceFeatures(boolean b)
276 showSequenceFeatures = b;
279 public boolean getShowSequenceFeatures()
281 return showSequenceFeatures;
284 class ConservationThread extends Thread
288 public ConservationThread(AlignmentPanel ap)
297 updatingConservation = true;
299 while (UPDATING_CONSERVATION)
305 ap.paintAlignment(false);
308 } catch (Exception ex)
310 ex.printStackTrace();
314 UPDATING_CONSERVATION = true;
316 int alWidth = alignment.getWidth();
322 Conservation cons = new jalview.analysis.Conservation("All",
323 jalview.schemes.ResidueProperties.propHash, 3, alignment
324 .getSequences(), 0, alWidth - 1);
327 cons.verdict(false, ConsPercGaps);
334 char[] sequence = cons.getConsSequence().getSequence();
346 maxB = 0f - minB; // scalable range for colouring both Conservation and
356 conservation.annotations = new Annotation[alWidth];
360 quality.graphMax = cons.qualityRange[1].floatValue();
361 quality.annotations = new Annotation[alWidth];
362 qmin = cons.qualityRange[0].floatValue();
363 qmax = cons.qualityRange[1].floatValue();
366 for (int i = 0; i < alWidth; i++)
372 if (Character.isDigit(c))
374 value = (int) (c - '0');
385 float vprop = value - min;
387 conservation.annotations[i] = new Annotation(String.valueOf(c),
388 String.valueOf(value), ' ', value, new Color(minR
389 + (maxR * vprop), minG + (maxG * vprop), minB
395 value = ((Double) cons.quality.elementAt(i)).floatValue();
396 vprop = value - qmin;
398 quality.annotations[i] = new Annotation(" ", String
399 .valueOf(value), ' ', value, new Color(minR
400 + (maxR * vprop), minG + (maxG * vprop), minB
404 } catch (OutOfMemoryError error)
406 System.out.println("Out of memory calculating conservation!!");
412 UPDATING_CONSERVATION = false;
413 updatingConservation = false;
417 ap.paintAlignment(true);
423 ConservationThread conservationThread;
425 ConsensusThread consensusThread;
427 boolean consUpdateNeeded = false;
429 static boolean UPDATING_CONSENSUS = false;
431 static boolean UPDATING_CONSERVATION = false;
433 boolean updatingConsensus = false;
435 boolean updatingConservation = false;
440 public void updateConservation(final AlignmentPanel ap)
442 if (alignment.isNucleotide() || conservation == null)
447 conservationThread = new ConservationThread(ap);
448 conservationThread.start();
454 public void updateConsensus(final AlignmentPanel ap)
456 consensusThread = new ConsensusThread(ap);
457 consensusThread.start();
460 class ConsensusThread extends Thread
464 public ConsensusThread(AlignmentPanel ap)
471 updatingConsensus = true;
472 while (UPDATING_CONSENSUS)
478 ap.paintAlignment(false);
482 } catch (Exception ex)
484 ex.printStackTrace();
488 UPDATING_CONSENSUS = true;
492 int aWidth = alignment.getWidth();
498 consensus.annotations = null;
499 consensus.annotations = new Annotation[aWidth];
501 hconsensus = new Hashtable[aWidth];
502 AAFrequency.calculate(alignment.getSequencesArray(), 0, alignment
503 .getWidth(), hconsensus);
505 for (int i = 0; i < aWidth; i++)
508 if (ignoreGapsInConsensusCalculation)
510 value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
515 value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
519 String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE)
521 String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE)
524 if (maxRes.length() > 1)
526 mouseOver = "[" + maxRes + "] ";
530 mouseOver += ((int) value + "%");
531 consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
535 if (globalColourScheme != null)
537 globalColourScheme.setConsensus(hconsensus);
540 } catch (OutOfMemoryError error)
542 alignment.deleteAnnotation(consensus);
546 System.out.println("Out of memory calculating consensus!!");
549 UPDATING_CONSENSUS = false;
550 updatingConsensus = false;
554 ap.paintAlignment(true);
560 * get the consensus sequence as displayed under the PID consensus annotation
563 * @return consensus sequence as a new sequence object
566 * get the consensus sequence as displayed under the PID consensus annotation
569 * @return consensus sequence as a new sequence object
571 public SequenceI getConsensusSeq()
573 if (consensus == null)
577 StringBuffer seqs = new StringBuffer();
578 for (int i = 0; i < consensus.annotations.length; i++)
580 if (consensus.annotations[i] != null)
582 if (consensus.annotations[i].description.charAt(0) == '[')
584 seqs.append(consensus.annotations[i].description.charAt(1));
588 seqs.append(consensus.annotations[i].displayCharacter);
592 SequenceI sq = new Sequence("Consensus", seqs.toString());
593 sq.setDescription("Percentage Identity Consensus "
594 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
598 public SequenceGroup getSelectionGroup()
600 return selectionGroup;
603 public void setSelectionGroup(SequenceGroup sg)
608 public boolean getConservationSelected()
610 return conservationColourSelected;
613 public void setConservationSelected(boolean b)
615 conservationColourSelected = b;
618 public boolean getAbovePIDThreshold()
620 return abovePIDThreshold;
623 public void setAbovePIDThreshold(boolean b)
625 abovePIDThreshold = b;
628 public int getStartRes()
633 public int getEndRes()
638 public int getStartSeq()
643 public void setGlobalColourScheme(ColourSchemeI cs)
645 globalColourScheme = cs;
648 public ColourSchemeI getGlobalColourScheme()
650 return globalColourScheme;
653 public void setStartRes(int res)
658 public void setStartSeq(int seq)
663 public void setEndRes(int res)
665 if (res > alignment.getWidth() - 1)
667 // log.System.out.println(" Corrected res from " + res + " to maximum " +
668 // (alignment.getWidth()-1));
669 res = alignment.getWidth() - 1;
678 public void setEndSeq(int seq)
680 if (seq > alignment.getHeight())
682 seq = alignment.getHeight();
691 public int getEndSeq()
696 java.awt.Frame nullFrame;
698 protected FeatureSettings featureSettings = null;
700 public void setFont(Font f)
703 if (nullFrame == null)
705 nullFrame = new java.awt.Frame();
706 nullFrame.addNotify();
709 java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
710 setCharHeight(fm.getHeight());
711 charWidth = fm.charWidth('M');
715 Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
716 fm = nullFrame.getGraphics().getFontMetrics(f2);
717 charWidth = fm.stringWidth("MMMMMMMMMMM") / 10;
721 public Font getFont()
726 public int getCharWidth()
731 public void setCharHeight(int h)
736 public int getCharHeight()
741 public void setWrappedWidth(int w)
743 this.wrappedWidth = w;
746 public int getwrappedWidth()
751 public AlignmentI getAlignment()
756 public void setAlignment(AlignmentI align)
758 this.alignment = align;
761 public void setWrapAlignment(boolean state)
763 wrapAlignment = state;
766 public void setShowText(boolean state)
771 public void setRenderGaps(boolean state)
776 public boolean getColourText()
778 return showColourText;
781 public void setColourText(boolean state)
783 showColourText = state;
786 public void setShowBoxes(boolean state)
791 public boolean getWrapAlignment()
793 return wrapAlignment;
796 public boolean getShowText()
801 public boolean getShowBoxes()
806 public char getGapCharacter()
808 return getAlignment().getGapCharacter();
811 public void setGapCharacter(char gap)
813 if (getAlignment() != null)
815 getAlignment().setGapCharacter(gap);
819 public void setThreshold(int thresh)
824 public int getThreshold()
829 public void setIncrement(int inc)
834 public int getIncrement()
839 public void setHiddenColumns(ColumnSelection colsel)
841 this.colSel = colsel;
842 if (colSel.getHiddenColumns() != null)
844 hasHiddenColumns = true;
848 public ColumnSelection getColumnSelection()
853 public void resetSeqLimits(int height)
855 setEndSeq(height / getCharHeight());
858 public void setCurrentTree(NJTree tree)
863 public NJTree getCurrentTree()
868 public void setColourAppliesToAllGroups(boolean b)
870 colourAppliesToAllGroups = b;
873 public boolean getColourAppliesToAllGroups()
875 return colourAppliesToAllGroups;
878 public boolean getShowJVSuffix()
883 public void setShowJVSuffix(boolean b)
888 public boolean getShowAnnotation()
890 return showAnnotation;
893 public void setShowAnnotation(boolean b)
898 public boolean getScaleAboveWrapped()
900 return scaleAboveWrapped;
903 public boolean getScaleLeftWrapped()
905 return scaleLeftWrapped;
908 public boolean getScaleRightWrapped()
910 return scaleRightWrapped;
913 public void setScaleAboveWrapped(boolean b)
915 scaleAboveWrapped = b;
918 public void setScaleLeftWrapped(boolean b)
920 scaleLeftWrapped = b;
923 public void setScaleRightWrapped(boolean b)
925 scaleRightWrapped = b;
928 public void setIgnoreGapsConsensus(boolean b)
930 ignoreGapsInConsensusCalculation = b;
931 updateConsensus(null);
932 if (globalColourScheme != null)
934 globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
935 ignoreGapsInConsensusCalculation);
941 * Property change listener for changes in alignment
946 public void addPropertyChangeListener(
947 java.beans.PropertyChangeListener listener)
949 changeSupport.addPropertyChangeListener(listener);
958 public void removePropertyChangeListener(
959 java.beans.PropertyChangeListener listener)
961 changeSupport.removePropertyChangeListener(listener);
965 * Property change listener for changes in alignment
974 public void firePropertyChange(String prop, Object oldvalue,
977 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
980 public boolean getIgnoreGapsConsensus()
982 return ignoreGapsInConsensusCalculation;
985 public void hideSelectedColumns()
987 if (colSel.size() < 1)
992 colSel.hideSelectedColumns();
993 setSelectionGroup(null);
995 hasHiddenColumns = true;
998 public void invertColumnSelection()
1000 for (int i = 0; i < alignment.getWidth(); i++)
1002 if (colSel.contains(i))
1004 colSel.removeElement(i);
1008 if (!hasHiddenColumns || colSel.isVisible(i))
1010 colSel.addElement(i);
1016 public void hideColumns(int start, int end)
1020 colSel.hideColumns(start);
1024 colSel.hideColumns(start, end);
1027 hasHiddenColumns = true;
1030 public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
1032 int sSize = sg.getSize();
1038 if (hiddenRepSequences == null)
1040 hiddenRepSequences = new Hashtable();
1043 hiddenRepSequences.put(repSequence, sg);
1045 // Hide all sequences except the repSequence
1046 SequenceI[] seqs = new SequenceI[sSize - 1];
1048 for (int i = 0; i < sSize; i++)
1050 if (sg.getSequenceAt(i) != repSequence)
1052 if (index == sSize - 1)
1057 seqs[index++] = sg.getSequenceAt(i);
1065 public void hideAllSelectedSeqs()
1067 if (selectionGroup == null || selectionGroup.getSize() < 1)
1072 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1076 setSelectionGroup(null);
1079 public void hideSequence(SequenceI[] seq)
1083 for (int i = 0; i < seq.length; i++)
1085 alignment.getHiddenSequences().hideSequence(seq[i]);
1088 hasHiddenRows = true;
1089 firePropertyChange("alignment", null, alignment.getSequences());
1093 public void showColumn(int col)
1095 colSel.revealHiddenColumns(col);
1096 if (colSel.getHiddenColumns() == null)
1098 hasHiddenColumns = false;
1102 public void showAllHiddenColumns()
1104 colSel.revealAllHiddenColumns();
1105 hasHiddenColumns = false;
1108 public void showAllHiddenSeqs()
1110 if (alignment.getHiddenSequences().getSize() > 0)
1112 if (selectionGroup == null)
1114 selectionGroup = new SequenceGroup();
1115 selectionGroup.setEndRes(alignment.getWidth() - 1);
1117 Vector tmp = alignment.getHiddenSequences().showAll(
1118 hiddenRepSequences);
1119 for (int t = 0; t < tmp.size(); t++)
1121 selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
1123 firePropertyChange("alignment", null, alignment.getSequences());
1124 hasHiddenRows = false;
1125 hiddenRepSequences = null;
1129 public int adjustForHiddenSeqs(int alignmentIndex)
1131 return alignment.getHiddenSequences().adjustForHiddenSeqs(
1136 * This method returns the a new SequenceI [] with the selection sequence and
1137 * start and end points adjusted
1141 public SequenceI[] getSelectionAsNewSequence()
1143 SequenceI[] sequences;
1145 if (selectionGroup == null)
1147 sequences = alignment.getSequencesArray();
1151 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1158 * This method returns the visible alignment as text, as seen on the GUI, ie
1159 * if columns are hidden they will not be returned in the result. Use this for
1160 * calculating trees, PCA, redundancy etc on views which contain hidden
1165 public jalview.datamodel.CigarArray getViewAsCigars(
1166 boolean selectedRegionOnly)
1168 CigarArray selection = null;
1169 SequenceI[] seqs = null;
1171 int start = 0, end = 0;
1172 if (selectedRegionOnly && selectionGroup != null)
1174 iSize = selectionGroup.getSize();
1175 seqs = selectionGroup.getSequencesInOrder(alignment);
1176 start = selectionGroup.getStartRes();
1177 end = selectionGroup.getEndRes(); // inclusive for start and end in
1178 // SeqCigar constructor
1182 iSize = alignment.getHeight();
1183 seqs = alignment.getSequencesArray();
1184 end = alignment.getWidth() - 1;
1186 SeqCigar[] selseqs = new SeqCigar[iSize];
1187 for (i = 0; i < iSize; i++)
1189 selseqs[i] = new SeqCigar(seqs[i], start, end);
1191 selection = new CigarArray(selseqs);
1192 // now construct the CigarArray operations
1193 if (hasHiddenColumns)
1195 Vector regions = colSel.getHiddenColumns();
1197 int hideStart, hideEnd;
1199 for (int j = 0; last < end & j < regions.size(); j++)
1201 region = (int[]) regions.elementAt(j);
1202 hideStart = region[0];
1203 hideEnd = region[1];
1204 // edit hidden regions to selection range
1205 if (hideStart < last)
1217 if (hideStart > end)
1227 if (hideStart > hideEnd)
1232 * form operations...
1234 if (last < hideStart)
1236 selection.addOperation(CigarArray.M, hideStart - last);
1238 selection.addOperation(CigarArray.D, 1 + hideEnd - hideStart);
1241 // Final match if necessary.
1244 selection.addOperation(CigarArray.M, end - last + 1);
1249 selection.addOperation(CigarArray.M, end - start + 1);
1255 * return a compact representation of the current alignment selection to pass
1256 * to an analysis function
1258 * @param selectedOnly
1259 * boolean true to just return the selected view
1260 * @return AlignmentView
1262 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
1265 // this is here because the AlignmentView constructor modifies the
1267 // object. Refactoring of Cigar and alignment view representation should
1268 // be done to remove redundancy.
1269 CigarArray aligview = getViewAsCigars(selectedOnly);
1270 if (aligview != null)
1272 return new AlignmentView(aligview,
1273 (selectedOnly && selectionGroup != null) ? selectionGroup
1274 .getStartRes() : 0);
1280 * This method returns the visible alignment as text, as seen on the GUI, ie
1281 * if columns are hidden they will not be returned in the result. Use this for
1282 * calculating trees, PCA, redundancy etc on views which contain hidden
1287 public String[] getViewAsString(boolean selectedRegionOnly)
1289 String[] selection = null;
1290 SequenceI[] seqs = null;
1292 int start = 0, end = 0;
1293 if (selectedRegionOnly && selectionGroup != null)
1295 iSize = selectionGroup.getSize();
1296 seqs = selectionGroup.getSequencesInOrder(alignment);
1297 start = selectionGroup.getStartRes();
1298 end = selectionGroup.getEndRes() + 1;
1302 iSize = alignment.getHeight();
1303 seqs = alignment.getSequencesArray();
1304 end = alignment.getWidth();
1307 selection = new String[iSize];
1309 for (i = 0; i < iSize; i++)
1311 if (hasHiddenColumns)
1313 StringBuffer visibleSeq = new StringBuffer();
1314 Vector regions = colSel.getHiddenColumns();
1316 int blockStart = start, blockEnd = end;
1318 int hideStart, hideEnd;
1320 for (int j = 0; j < regions.size(); j++)
1322 region = (int[]) regions.elementAt(j);
1323 hideStart = region[0];
1324 hideEnd = region[1];
1326 if (hideStart < start)
1331 blockStart = Math.min(blockStart, hideEnd + 1);
1332 blockEnd = Math.min(blockEnd, hideStart);
1334 if (blockStart > blockEnd)
1339 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
1341 blockStart = hideEnd + 1;
1345 if (end > blockStart)
1347 visibleSeq.append(seqs[i].getSequence(blockStart, end));
1350 selection[i] = visibleSeq.toString();
1354 selection[i] = seqs[i].getSequenceAsString(start, end);
1361 public boolean getShowHiddenMarkers()
1363 return showHiddenMarkers;
1366 public void setShowHiddenMarkers(boolean show)
1368 showHiddenMarkers = show;
1371 public Color getSequenceColour(SequenceI seq)
1373 if (sequenceColours == null || !sequenceColours.containsKey(seq))
1379 return (Color) sequenceColours.get(seq);
1383 public void setSequenceColour(SequenceI seq, Color col)
1385 if (sequenceColours == null)
1387 sequenceColours = new Hashtable();
1392 sequenceColours.remove(seq);
1396 sequenceColours.put(seq, col);
1400 public String getSequenceSetId()
1402 if (sequenceSetID == null)
1404 sequenceSetID = alignment.hashCode() + "";
1407 return sequenceSetID;
1410 public void alignmentChanged(AlignmentPanel ap)
1412 alignment.padGaps();
1414 if (hconsensus != null && autocalculateConsensus)
1416 updateConsensus(ap);
1417 updateConservation(ap);
1420 // Reset endRes of groups if beyond alignment width
1421 int alWidth = alignment.getWidth();
1422 Vector groups = alignment.getGroups();
1425 for (int i = 0; i < groups.size(); i++)
1427 SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
1428 if (sg.getEndRes() > alWidth)
1430 sg.setEndRes(alWidth - 1);
1435 if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
1437 selectionGroup.setEndRes(alWidth - 1);
1440 resetAllColourSchemes();
1442 // AW alignment.adjustSequenceAnnotations();
1445 void resetAllColourSchemes()
1447 ColourSchemeI cs = globalColourScheme;
1450 if (cs instanceof ClustalxColourScheme)
1452 ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
1453 alignment.getWidth());
1456 cs.setConsensus(hconsensus);
1457 if (cs.conservationApplied())
1459 Alignment al = (Alignment) alignment;
1460 Conservation c = new Conservation("All",
1461 ResidueProperties.propHash, 3, al.getSequences(), 0, al
1464 c.verdict(false, ConsPercGaps);
1466 cs.setConservation(c);
1470 int s, sSize = alignment.getGroups().size();
1471 for (s = 0; s < sSize; s++)
1473 SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
1474 if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
1476 ((ClustalxColourScheme) sg.cs).resetClustalX(sg
1477 .getSequences(hiddenRepSequences), sg.getWidth());
1479 sg.recalcConservation();
1483 boolean centreColumnLabels;
1486 public boolean getCentreColumnLabels()
1488 return centreColumnLabels;
1491 public void updateSequenceIdColours()
1493 Vector groups = alignment.getGroups();
1494 for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
1496 SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
1497 if (sg.idColour != null)
1499 Vector sqs = sg.getSequences(hiddenRepSequences);
1500 for (int s = 0, sSize = sqs.size(); s < sSize; s++)
1502 this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
1507 public boolean followHighlight=false;
1508 public boolean getFollowHighlight() {
1509 return followHighlight;
1512 * show non-conserved residues only
1514 public boolean showUnconserved=false;
1517 * @return the showUnconserved
1519 public boolean getShowunconserved()
1521 return showUnconserved;
1525 * @param showUnconserved the showUnconserved to set
1527 public void setShowunconserved(boolean displayNonconserved)
1529 this.showUnconserved = displayNonconserved;