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("upperCase");
190 if (param.equalsIgnoreCase("bold"))
192 upperCasebold = true;
200 String colour = applet.getParameter("defaultColour");
204 colour = applet.getParameter("userDefinedColour");
207 colour = "User Defined";
213 globalColourScheme = ColourSchemeProperty.getColour(alignment,
215 if (globalColourScheme != null)
217 globalColourScheme.setConsensus(hconsensus);
221 if (applet.getParameter("userDefinedColour") != null)
223 ((UserColourScheme) globalColourScheme).parseAppletParameter(applet
224 .getParameter("userDefinedColour"));
227 if (hconsensus == null)
229 if (!alignment.isNucleotide())
231 conservation = new AlignmentAnnotation("Conservation",
232 "Conservation of total alignment less than " + ConsPercGaps
233 + "% gaps", new Annotation[1], 0f, 11f,
234 AlignmentAnnotation.BAR_GRAPH);
235 conservation.hasText = true;
236 conservation.autoCalculated = true;
238 if (showConservation)
240 alignment.addAnnotation(conservation);
245 quality = new AlignmentAnnotation("Quality",
246 "Alignment Quality based on Blosum62 scores",
247 new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH);
248 quality.hasText = true;
249 quality.autoCalculated = true;
251 alignment.addAnnotation(quality);
255 consensus = new AlignmentAnnotation("Consensus", "PID",
256 new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
257 consensus.hasText = true;
258 consensus.autoCalculated = true;
262 alignment.addAnnotation(consensus);
268 public void showSequenceFeatures(boolean b)
270 showSequenceFeatures = b;
273 public boolean getShowSequenceFeatures()
275 return showSequenceFeatures;
278 class ConservationThread extends Thread
282 public ConservationThread(AlignmentPanel ap)
291 updatingConservation = true;
293 while (UPDATING_CONSERVATION)
299 ap.paintAlignment(false);
302 } catch (Exception ex)
304 ex.printStackTrace();
308 UPDATING_CONSERVATION = true;
310 int alWidth = alignment.getWidth();
316 Conservation cons = new jalview.analysis.Conservation("All",
317 jalview.schemes.ResidueProperties.propHash, 3, alignment
318 .getSequences(), 0, alWidth - 1);
321 cons.verdict(false, ConsPercGaps);
328 char[] sequence = cons.getConsSequence().getSequence();
340 maxB = 0f - minB; // scalable range for colouring both Conservation and
350 conservation.annotations = new Annotation[alWidth];
354 quality.graphMax = cons.qualityRange[1].floatValue();
355 quality.annotations = new Annotation[alWidth];
356 qmin = cons.qualityRange[0].floatValue();
357 qmax = cons.qualityRange[1].floatValue();
360 for (int i = 0; i < alWidth; i++)
366 if (Character.isDigit(c))
368 value = (int) (c - '0');
379 float vprop = value - min;
381 conservation.annotations[i] = new Annotation(String.valueOf(c),
382 String.valueOf(value), ' ', value, new Color(minR
383 + (maxR * vprop), minG + (maxG * vprop), minB
389 value = ((Double) cons.quality.elementAt(i)).floatValue();
390 vprop = value - qmin;
392 quality.annotations[i] = new Annotation(" ", String
393 .valueOf(value), ' ', value, new Color(minR
394 + (maxR * vprop), minG + (maxG * vprop), minB
398 } catch (OutOfMemoryError error)
400 System.out.println("Out of memory calculating conservation!!");
406 UPDATING_CONSERVATION = false;
407 updatingConservation = false;
411 ap.paintAlignment(true);
417 ConservationThread conservationThread;
419 ConsensusThread consensusThread;
421 boolean consUpdateNeeded = false;
423 static boolean UPDATING_CONSENSUS = false;
425 static boolean UPDATING_CONSERVATION = false;
427 boolean updatingConsensus = false;
429 boolean updatingConservation = false;
434 public void updateConservation(final AlignmentPanel ap)
436 if (alignment.isNucleotide() || conservation == null)
441 conservationThread = new ConservationThread(ap);
442 conservationThread.start();
448 public void updateConsensus(final AlignmentPanel ap)
450 consensusThread = new ConsensusThread(ap);
451 consensusThread.start();
454 class ConsensusThread extends Thread
458 public ConsensusThread(AlignmentPanel ap)
465 updatingConsensus = true;
466 while (UPDATING_CONSENSUS)
472 ap.paintAlignment(false);
476 } catch (Exception ex)
478 ex.printStackTrace();
482 UPDATING_CONSENSUS = true;
486 int aWidth = alignment.getWidth();
492 consensus.annotations = null;
493 consensus.annotations = new Annotation[aWidth];
495 hconsensus = new Hashtable[aWidth];
496 AAFrequency.calculate(alignment.getSequencesArray(), 0, alignment
497 .getWidth(), hconsensus);
499 for (int i = 0; i < aWidth; i++)
502 if (ignoreGapsInConsensusCalculation)
504 value = ((Float) hconsensus[i].get(AAFrequency.PID_NOGAPS))
509 value = ((Float) hconsensus[i].get(AAFrequency.PID_GAPS))
513 String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE)
515 String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE)
518 if (maxRes.length() > 1)
520 mouseOver = "[" + maxRes + "] ";
524 mouseOver += ((int) value + "%");
525 consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ',
529 if (globalColourScheme != null)
531 globalColourScheme.setConsensus(hconsensus);
534 } catch (OutOfMemoryError error)
536 alignment.deleteAnnotation(consensus);
540 System.out.println("Out of memory calculating consensus!!");
543 UPDATING_CONSENSUS = false;
544 updatingConsensus = false;
548 ap.paintAlignment(true);
554 * get the consensus sequence as displayed under the PID consensus annotation
557 * @return consensus sequence as a new sequence object
560 * get the consensus sequence as displayed under the PID consensus annotation
563 * @return consensus sequence as a new sequence object
565 public SequenceI getConsensusSeq()
567 if (consensus == null)
571 StringBuffer seqs = new StringBuffer();
572 for (int i = 0; i < consensus.annotations.length; i++)
574 if (consensus.annotations[i] != null)
576 if (consensus.annotations[i].description.charAt(0) == '[')
578 seqs.append(consensus.annotations[i].description.charAt(1));
582 seqs.append(consensus.annotations[i].displayCharacter);
586 SequenceI sq = new Sequence("Consensus", seqs.toString());
587 sq.setDescription("Percentage Identity Consensus "
588 + ((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
592 public SequenceGroup getSelectionGroup()
594 return selectionGroup;
597 public void setSelectionGroup(SequenceGroup sg)
602 public boolean getConservationSelected()
604 return conservationColourSelected;
607 public void setConservationSelected(boolean b)
609 conservationColourSelected = b;
612 public boolean getAbovePIDThreshold()
614 return abovePIDThreshold;
617 public void setAbovePIDThreshold(boolean b)
619 abovePIDThreshold = b;
622 public int getStartRes()
627 public int getEndRes()
632 public int getStartSeq()
637 public void setGlobalColourScheme(ColourSchemeI cs)
639 globalColourScheme = cs;
642 public ColourSchemeI getGlobalColourScheme()
644 return globalColourScheme;
647 public void setStartRes(int res)
652 public void setStartSeq(int seq)
657 public void setEndRes(int res)
659 if (res > alignment.getWidth() - 1)
661 // log.System.out.println(" Corrected res from " + res + " to maximum " +
662 // (alignment.getWidth()-1));
663 res = alignment.getWidth() - 1;
672 public void setEndSeq(int seq)
674 if (seq > alignment.getHeight())
676 seq = alignment.getHeight();
685 public int getEndSeq()
690 java.awt.Frame nullFrame;
692 protected FeatureSettings featureSettings = null;
694 public void setFont(Font f)
697 if (nullFrame == null)
699 nullFrame = new java.awt.Frame();
700 nullFrame.addNotify();
703 java.awt.FontMetrics fm = nullFrame.getGraphics().getFontMetrics(font);
704 setCharHeight(fm.getHeight());
705 charWidth = fm.charWidth('M');
709 Font f2 = new Font(f.getName(), Font.BOLD, f.getSize());
710 fm = nullFrame.getGraphics().getFontMetrics(f2);
711 charWidth = fm.stringWidth("MMMMMMMMMMM") / 10;
715 public Font getFont()
720 public int getCharWidth()
725 public void setCharHeight(int h)
730 public int getCharHeight()
735 public void setWrappedWidth(int w)
737 this.wrappedWidth = w;
740 public int getwrappedWidth()
745 public AlignmentI getAlignment()
750 public void setAlignment(AlignmentI align)
752 this.alignment = align;
755 public void setWrapAlignment(boolean state)
757 wrapAlignment = state;
760 public void setShowText(boolean state)
765 public void setRenderGaps(boolean state)
770 public boolean getColourText()
772 return showColourText;
775 public void setColourText(boolean state)
777 showColourText = state;
780 public void setShowBoxes(boolean state)
785 public boolean getWrapAlignment()
787 return wrapAlignment;
790 public boolean getShowText()
795 public boolean getShowBoxes()
800 public char getGapCharacter()
802 return getAlignment().getGapCharacter();
805 public void setGapCharacter(char gap)
807 if (getAlignment() != null)
809 getAlignment().setGapCharacter(gap);
813 public void setThreshold(int thresh)
818 public int getThreshold()
823 public void setIncrement(int inc)
828 public int getIncrement()
833 public void setHiddenColumns(ColumnSelection colsel)
835 this.colSel = colsel;
836 if (colSel.getHiddenColumns() != null)
838 hasHiddenColumns = true;
842 public ColumnSelection getColumnSelection()
847 public void resetSeqLimits(int height)
849 setEndSeq(height / getCharHeight());
852 public void setCurrentTree(NJTree tree)
857 public NJTree getCurrentTree()
862 public void setColourAppliesToAllGroups(boolean b)
864 colourAppliesToAllGroups = b;
867 public boolean getColourAppliesToAllGroups()
869 return colourAppliesToAllGroups;
872 public boolean getShowJVSuffix()
877 public void setShowJVSuffix(boolean b)
882 public boolean getShowAnnotation()
884 return showAnnotation;
887 public void setShowAnnotation(boolean b)
892 public boolean getScaleAboveWrapped()
894 return scaleAboveWrapped;
897 public boolean getScaleLeftWrapped()
899 return scaleLeftWrapped;
902 public boolean getScaleRightWrapped()
904 return scaleRightWrapped;
907 public void setScaleAboveWrapped(boolean b)
909 scaleAboveWrapped = b;
912 public void setScaleLeftWrapped(boolean b)
914 scaleLeftWrapped = b;
917 public void setScaleRightWrapped(boolean b)
919 scaleRightWrapped = b;
922 public void setIgnoreGapsConsensus(boolean b)
924 ignoreGapsInConsensusCalculation = b;
925 updateConsensus(null);
926 if (globalColourScheme != null)
928 globalColourScheme.setThreshold(globalColourScheme.getThreshold(),
929 ignoreGapsInConsensusCalculation);
935 * Property change listener for changes in alignment
940 public void addPropertyChangeListener(
941 java.beans.PropertyChangeListener listener)
943 changeSupport.addPropertyChangeListener(listener);
952 public void removePropertyChangeListener(
953 java.beans.PropertyChangeListener listener)
955 changeSupport.removePropertyChangeListener(listener);
959 * Property change listener for changes in alignment
968 public void firePropertyChange(String prop, Object oldvalue,
971 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
974 public boolean getIgnoreGapsConsensus()
976 return ignoreGapsInConsensusCalculation;
979 public void hideSelectedColumns()
981 if (colSel.size() < 1)
986 colSel.hideSelectedColumns();
987 setSelectionGroup(null);
989 hasHiddenColumns = true;
992 public void invertColumnSelection()
994 for (int i = 0; i < alignment.getWidth(); i++)
996 if (colSel.contains(i))
998 colSel.removeElement(i);
1002 if (!hasHiddenColumns || colSel.isVisible(i))
1004 colSel.addElement(i);
1010 public void hideColumns(int start, int end)
1014 colSel.hideColumns(start);
1018 colSel.hideColumns(start, end);
1021 hasHiddenColumns = true;
1024 public void hideRepSequences(SequenceI repSequence, SequenceGroup sg)
1026 int sSize = sg.getSize();
1032 if (hiddenRepSequences == null)
1034 hiddenRepSequences = new Hashtable();
1037 hiddenRepSequences.put(repSequence, sg);
1039 // Hide all sequences except the repSequence
1040 SequenceI[] seqs = new SequenceI[sSize - 1];
1042 for (int i = 0; i < sSize; i++)
1044 if (sg.getSequenceAt(i) != repSequence)
1046 if (index == sSize - 1)
1051 seqs[index++] = sg.getSequenceAt(i);
1059 public void hideAllSelectedSeqs()
1061 if (selectionGroup == null || selectionGroup.getSize() < 1)
1066 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1070 setSelectionGroup(null);
1073 public void hideSequence(SequenceI[] seq)
1077 for (int i = 0; i < seq.length; i++)
1079 alignment.getHiddenSequences().hideSequence(seq[i]);
1082 hasHiddenRows = true;
1083 firePropertyChange("alignment", null, alignment.getSequences());
1087 public void showColumn(int col)
1089 colSel.revealHiddenColumns(col);
1090 if (colSel.getHiddenColumns() == null)
1092 hasHiddenColumns = false;
1096 public void showAllHiddenColumns()
1098 colSel.revealAllHiddenColumns();
1099 hasHiddenColumns = false;
1102 public void showAllHiddenSeqs()
1104 if (alignment.getHiddenSequences().getSize() > 0)
1106 if (selectionGroup == null)
1108 selectionGroup = new SequenceGroup();
1109 selectionGroup.setEndRes(alignment.getWidth() - 1);
1111 Vector tmp = alignment.getHiddenSequences().showAll(
1112 hiddenRepSequences);
1113 for (int t = 0; t < tmp.size(); t++)
1115 selectionGroup.addSequence((SequenceI) tmp.elementAt(t), false);
1117 firePropertyChange("alignment", null, alignment.getSequences());
1118 hasHiddenRows = false;
1119 hiddenRepSequences = null;
1123 public int adjustForHiddenSeqs(int alignmentIndex)
1125 return alignment.getHiddenSequences().adjustForHiddenSeqs(
1130 * This method returns the a new SequenceI [] with the selection sequence and
1131 * start and end points adjusted
1135 public SequenceI[] getSelectionAsNewSequence()
1137 SequenceI[] sequences;
1139 if (selectionGroup == null)
1141 sequences = alignment.getSequencesArray();
1145 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1152 * This method returns the visible alignment as text, as seen on the GUI, ie
1153 * if columns are hidden they will not be returned in the result. Use this for
1154 * calculating trees, PCA, redundancy etc on views which contain hidden
1159 public jalview.datamodel.CigarArray getViewAsCigars(
1160 boolean selectedRegionOnly)
1162 CigarArray selection = null;
1163 SequenceI[] seqs = null;
1165 int start = 0, end = 0;
1166 if (selectedRegionOnly && selectionGroup != null)
1168 iSize = selectionGroup.getSize();
1169 seqs = selectionGroup.getSequencesInOrder(alignment);
1170 start = selectionGroup.getStartRes();
1171 end = selectionGroup.getEndRes(); // inclusive for start and end in
1172 // SeqCigar constructor
1176 iSize = alignment.getHeight();
1177 seqs = alignment.getSequencesArray();
1178 end = alignment.getWidth() - 1;
1180 SeqCigar[] selseqs = new SeqCigar[iSize];
1181 for (i = 0; i < iSize; i++)
1183 selseqs[i] = new SeqCigar(seqs[i], start, end);
1185 selection = new CigarArray(selseqs);
1186 // now construct the CigarArray operations
1187 if (hasHiddenColumns)
1189 Vector regions = colSel.getHiddenColumns();
1191 int hideStart, hideEnd;
1193 for (int j = 0; last < end & j < regions.size(); j++)
1195 region = (int[]) regions.elementAt(j);
1196 hideStart = region[0];
1197 hideEnd = region[1];
1198 // edit hidden regions to selection range
1199 if (hideStart < last)
1211 if (hideStart > end)
1221 if (hideStart > hideEnd)
1226 * form operations...
1228 if (last < hideStart)
1230 selection.addOperation(CigarArray.M, hideStart - last);
1232 selection.addOperation(CigarArray.D, 1 + hideEnd - hideStart);
1235 // Final match if necessary.
1238 selection.addOperation(CigarArray.M, end - last + 1);
1243 selection.addOperation(CigarArray.M, end - start + 1);
1249 * return a compact representation of the current alignment selection to pass
1250 * to an analysis function
1252 * @param selectedOnly
1253 * boolean true to just return the selected view
1254 * @return AlignmentView
1256 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly)
1259 // this is here because the AlignmentView constructor modifies the
1261 // object. Refactoring of Cigar and alignment view representation should
1262 // be done to remove redundancy.
1263 CigarArray aligview = getViewAsCigars(selectedOnly);
1264 if (aligview != null)
1266 return new AlignmentView(aligview,
1267 (selectedOnly && selectionGroup != null) ? selectionGroup
1268 .getStartRes() : 0);
1274 * This method returns the visible alignment as text, as seen on the GUI, ie
1275 * if columns are hidden they will not be returned in the result. Use this for
1276 * calculating trees, PCA, redundancy etc on views which contain hidden
1281 public String[] getViewAsString(boolean selectedRegionOnly)
1283 String[] selection = null;
1284 SequenceI[] seqs = null;
1286 int start = 0, end = 0;
1287 if (selectedRegionOnly && selectionGroup != null)
1289 iSize = selectionGroup.getSize();
1290 seqs = selectionGroup.getSequencesInOrder(alignment);
1291 start = selectionGroup.getStartRes();
1292 end = selectionGroup.getEndRes() + 1;
1296 iSize = alignment.getHeight();
1297 seqs = alignment.getSequencesArray();
1298 end = alignment.getWidth();
1301 selection = new String[iSize];
1303 for (i = 0; i < iSize; i++)
1305 if (hasHiddenColumns)
1307 StringBuffer visibleSeq = new StringBuffer();
1308 Vector regions = colSel.getHiddenColumns();
1310 int blockStart = start, blockEnd = end;
1312 int hideStart, hideEnd;
1314 for (int j = 0; j < regions.size(); j++)
1316 region = (int[]) regions.elementAt(j);
1317 hideStart = region[0];
1318 hideEnd = region[1];
1320 if (hideStart < start)
1325 blockStart = Math.min(blockStart, hideEnd + 1);
1326 blockEnd = Math.min(blockEnd, hideStart);
1328 if (blockStart > blockEnd)
1333 visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
1335 blockStart = hideEnd + 1;
1339 if (end > blockStart)
1341 visibleSeq.append(seqs[i].getSequence(blockStart, end));
1344 selection[i] = visibleSeq.toString();
1348 selection[i] = seqs[i].getSequenceAsString(start, end);
1355 public boolean getShowHiddenMarkers()
1357 return showHiddenMarkers;
1360 public void setShowHiddenMarkers(boolean show)
1362 showHiddenMarkers = show;
1365 public Color getSequenceColour(SequenceI seq)
1367 if (sequenceColours == null || !sequenceColours.containsKey(seq))
1373 return (Color) sequenceColours.get(seq);
1377 public void setSequenceColour(SequenceI seq, Color col)
1379 if (sequenceColours == null)
1381 sequenceColours = new Hashtable();
1386 sequenceColours.remove(seq);
1390 sequenceColours.put(seq, col);
1394 public String getSequenceSetId()
1396 if (sequenceSetID == null)
1398 sequenceSetID = alignment.hashCode() + "";
1401 return sequenceSetID;
1404 public void alignmentChanged(AlignmentPanel ap)
1406 alignment.padGaps();
1408 if (hconsensus != null && autocalculateConsensus)
1410 updateConsensus(ap);
1411 updateConservation(ap);
1414 // Reset endRes of groups if beyond alignment width
1415 int alWidth = alignment.getWidth();
1416 Vector groups = alignment.getGroups();
1419 for (int i = 0; i < groups.size(); i++)
1421 SequenceGroup sg = (SequenceGroup) groups.elementAt(i);
1422 if (sg.getEndRes() > alWidth)
1424 sg.setEndRes(alWidth - 1);
1429 if (selectionGroup != null && selectionGroup.getEndRes() > alWidth)
1431 selectionGroup.setEndRes(alWidth - 1);
1434 resetAllColourSchemes();
1436 // AW alignment.adjustSequenceAnnotations();
1439 void resetAllColourSchemes()
1441 ColourSchemeI cs = globalColourScheme;
1444 if (cs instanceof ClustalxColourScheme)
1446 ((ClustalxColourScheme) cs).resetClustalX(alignment.getSequences(),
1447 alignment.getWidth());
1450 cs.setConsensus(hconsensus);
1451 if (cs.conservationApplied())
1453 Alignment al = (Alignment) alignment;
1454 Conservation c = new Conservation("All",
1455 ResidueProperties.propHash, 3, al.getSequences(), 0, al
1458 c.verdict(false, ConsPercGaps);
1460 cs.setConservation(c);
1464 int s, sSize = alignment.getGroups().size();
1465 for (s = 0; s < sSize; s++)
1467 SequenceGroup sg = (SequenceGroup) alignment.getGroups().elementAt(s);
1468 if (sg.cs != null && sg.cs instanceof ClustalxColourScheme)
1470 ((ClustalxColourScheme) sg.cs).resetClustalX(sg
1471 .getSequences(hiddenRepSequences), sg.getWidth());
1473 sg.recalcConservation();
1477 boolean centreColumnLabels;
1480 public boolean getCentreColumnLabels()
1482 return centreColumnLabels;
1485 public void updateSequenceIdColours()
1487 Vector groups = alignment.getGroups();
1488 for (int ig = 0, igSize = groups.size(); ig < igSize; ig++)
1490 SequenceGroup sg = (SequenceGroup) groups.elementAt(ig);
1491 if (sg.idColour != null)
1493 Vector sqs = sg.getSequences(hiddenRepSequences);
1494 for (int s = 0, sSize = sqs.size(); s < sSize; s++)
1496 this.setSequenceColour((SequenceI) sqs.elementAt(s), sg.idColour);
1501 public boolean followHighlight=false;
1502 public boolean getFollowHighlight() {
1503 return followHighlight;