2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 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
21 import jalview.analysis.*;
25 import jalview.datamodel.*;
27 import jalview.schemes.*;
40 public class AlignViewport
46 boolean showJVSuffix = true;
47 boolean showText = true;
48 boolean showColourText = false;
49 boolean showBoxes = true;
50 boolean wrapAlignment = false;
51 boolean renderGaps = true;
52 boolean showSequenceFeatures = false;
53 boolean showAnnotation = true;
54 boolean colourAppliesToAllGroups = true;
55 ColourSchemeI globalColourScheme = null;
56 boolean conservationColourSelected = false;
57 boolean abovePIDThreshold = false;
58 SequenceGroup selectionGroup;
61 boolean validCharWidth;
65 ColumnSelection colSel = new ColumnSelection();
68 NJTree currentTree = null;
69 boolean scaleAboveWrapped = false;
70 boolean scaleLeftWrapped = true;
71 boolean scaleRightWrapped = true;
72 boolean hasHiddenColumns = false;
73 boolean hasHiddenRows = false;
74 boolean showHiddenMarkers = true;
76 boolean cursorMode = false;
78 // The following vector holds the features which are
79 // currently visible, in the correct order or rendering
80 Hashtable featuresDisplayed = null;
84 public Hashtable [] hconsensus;
85 AlignmentAnnotation consensus;
86 AlignmentAnnotation conservation;
87 AlignmentAnnotation quality;
88 boolean autoCalculateConsensus = true;
91 public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
93 // JBPNote Prolly only need this in the applet version.
94 private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);
96 boolean ignoreGapsInConsensusCalculation = false;
98 boolean isDataset = false;
100 boolean antiAlias = false;
102 boolean padGaps = false;
104 Rectangle explodedPosition;
108 String sequenceSetID;
110 boolean gatherViewsHere = false;
113 * Creates a new AlignViewport object.
115 * @param al DOCUMENT ME!
117 public AlignViewport(AlignmentI al)
123 * Create a new AlignViewport with hidden regions
124 * @param al AlignmentI
125 * @param hiddenColumns ColumnSelection
127 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns) {
129 if (hiddenColumns!=null) {
130 this.colSel = hiddenColumns;
131 if (hiddenColumns.getHiddenColumns() != null)
132 hasHiddenColumns = true;
140 this.endRes = alignment.getWidth() - 1;
142 this.endSeq = alignment.getHeight() - 1;
144 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
146 showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);
147 showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);
149 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
151 padGaps = Cache.getDefault("PAD_GAPS", true);
153 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
154 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ;
155 String fontSize = Cache.getDefault("FONT_SIZE", "10");
159 if (fontStyle.equals("bold"))
163 else if (fontStyle.equals("italic"))
168 setFont(new Font(fontName, style, Integer.parseInt(fontSize)));
170 alignment.setGapCharacter( Cache.getDefault("GAP_SYMBOL", "-").charAt(0) );
173 // We must set conservation and consensus before setting colour,
174 // as Blosum and Clustal require this to be done
175 if(hconsensus==null && !isDataset)
177 if(!alignment.isNucleotide())
179 conservation = new AlignmentAnnotation("Conservation",
180 "Conservation of total alignment less than " +
181 ConsPercGaps + "% gaps",
182 new Annotation[1], 0f,
184 AlignmentAnnotation.BAR_GRAPH);
185 conservation.hasText = true;
188 if (Cache.getDefault("SHOW_CONSERVATION", true))
190 alignment.addAnnotation(conservation);
193 if (Cache.getDefault("SHOW_QUALITY", true))
195 quality = new AlignmentAnnotation("Quality",
196 "Alignment Quality based on Blosum62 scores",
200 AlignmentAnnotation.BAR_GRAPH);
201 quality.hasText = true;
203 alignment.addAnnotation(quality);
207 consensus = new AlignmentAnnotation("Consensus", "PID",
208 new Annotation[1], 0f, 100f,
209 AlignmentAnnotation.BAR_GRAPH);
210 consensus.hasText = true;
212 if (Cache.getDefault("SHOW_IDENTITY", true))
214 alignment.addAnnotation(consensus);
218 if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
220 globalColourScheme = ColourSchemeProperty.getColour(alignment,
221 jalview.bin.Cache.getProperty("DEFAULT_COLOUR"));
223 if (globalColourScheme instanceof UserColourScheme)
225 globalColourScheme = UserDefinedColours.loadDefaultColours();
226 ((UserColourScheme)globalColourScheme).setThreshold(0, getIgnoreGapsConsensus());
229 if (globalColourScheme != null)
231 globalColourScheme.setConsensus(hconsensus);
241 * @param b DOCUMENT ME!
243 public void setShowSequenceFeatures(boolean b)
245 showSequenceFeatures = b;
248 public boolean getShowSequenceFeatures()
250 return showSequenceFeatures;
255 class ConservationThread extends Thread
258 public ConservationThread(AlignmentPanel ap)
267 while (updatingConservation)
275 ex.printStackTrace();
279 updatingConservation = true;
282 int alWidth = alignment.getWidth();
286 Conservation cons = new jalview.analysis.Conservation("All",
287 jalview.schemes.ResidueProperties.propHash, 3,
288 alignment.getSequences(), 0, alWidth -1);
291 cons.verdict(false, ConsPercGaps);
298 String sequence = cons.getConsSequence().getSequence();
310 maxB = 0f - minB; // scalable range for colouring both Conservation and Quality
319 conservation.annotations = new Annotation[alWidth];
323 quality.graphMax = cons.qualityRange[1].floatValue();
324 quality.annotations = new Annotation[alWidth];
325 qmin = cons.qualityRange[0].floatValue();
326 qmax = cons.qualityRange[1].floatValue();
329 for (int i = 0; i < alWidth; i++)
333 c = sequence.charAt(i);
335 if (Character.isDigit(c))
336 value = (int) (c - '0');
342 float vprop = value - min;
344 conservation.annotations[i] =
345 new Annotation(String.valueOf(c),
346 String.valueOf(value), ' ', value,
347 new Color(minR + (maxR * vprop),
348 minG + (maxG * vprop),
349 minB + (maxB * vprop)));
354 value = ( (Double) cons.quality.get(i)).floatValue();
355 vprop = value - qmin;
357 quality.annotations[i] = new Annotation(" ", String.valueOf(value), ' ',
359 new Color(minR + (maxR * vprop),
360 minG + (maxG * vprop),
361 minB + (maxB * vprop)));
365 catch (OutOfMemoryError error)
367 javax.swing.SwingUtilities.invokeLater(new Runnable()
373 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
374 "Out of memory calculating conservation!!"
376 "\nSee help files for increasing Java Virtual Machine memory."
378 javax.swing.JOptionPane.WARNING_MESSAGE);
385 System.out.println("Conservation calculation: " + error);
394 updatingConservation = false;
399 ConservationThread conservationThread;
401 ConsensusThread consensusThread;
403 boolean consUpdateNeeded = false;
405 static boolean updatingConsensus = false;
407 static boolean updatingConservation = false;
412 public void updateConservation(final AlignmentPanel ap)
414 if (alignment.isNucleotide() || conservation==null)
417 conservationThread = new ConservationThread(ap);
418 conservationThread.start();
424 public void updateConsensus(final AlignmentPanel ap)
426 consensusThread = new ConsensusThread(ap);
427 consensusThread.start();
431 class ConsensusThread extends Thread
434 public ConsensusThread(AlignmentPanel ap)
440 while (updatingConsensus)
448 ex.printStackTrace();
452 updatingConsensus = true;
456 int aWidth = alignment.getWidth();
460 consensus.annotations = null;
461 consensus.annotations = new Annotation[aWidth];
464 hconsensus = new Hashtable[aWidth];
465 AAFrequency.calculate(alignment.getSequencesArray(),
467 alignment.getWidth(),
470 for (int i = 0; i < aWidth; i++)
473 if (ignoreGapsInConsensusCalculation)
474 value = ( (Float) hconsensus[i].get(AAFrequency.PID_NOGAPS)).
477 value = ( (Float) hconsensus[i].get(AAFrequency.PID_GAPS)).
480 String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
481 String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
483 if (maxRes.length() > 1)
485 mouseOver = "[" + maxRes + "] ";
489 mouseOver += ( (int) value + "%");
490 consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);
494 if (globalColourScheme != null)
495 globalColourScheme.setConsensus(hconsensus);
498 catch (OutOfMemoryError error)
502 javax.swing.SwingUtilities.invokeLater(new Runnable()
506 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
507 "Out of memory calculating consensus!!"
509 "\nSee help files for increasing Java Virtual Machine memory."
511 javax.swing.JOptionPane.WARNING_MESSAGE);
515 System.out.println("Consensus calculation: " + error);
525 updatingConsensus = false;
529 * get the consensus sequence as displayed under the PID consensus annotation row.
530 * @return consensus sequence as a new sequence object
532 public SequenceI getConsensusSeq() {
534 updateConsensus(null);
537 StringBuffer seqs=new StringBuffer();
538 for (int i=0; i<consensus.annotations.length; i++) {
539 if (consensus.annotations[i]!=null) {
540 if (consensus.annotations[i].description.charAt(0) == '[')
541 seqs.append(consensus.annotations[i].description.charAt(1));
543 seqs.append(consensus.annotations[i].displayCharacter);
546 SequenceI sq = new Sequence("Consensus", seqs.toString());
547 sq.setDescription("Percentage Identity Consensus "+((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
553 * @return DOCUMENT ME!
555 public SequenceGroup getSelectionGroup()
557 return selectionGroup;
563 * @param sg DOCUMENT ME!
565 public void setSelectionGroup(SequenceGroup sg)
573 * @return DOCUMENT ME!
575 public boolean getConservationSelected()
577 return conservationColourSelected;
583 * @param b DOCUMENT ME!
585 public void setConservationSelected(boolean b)
587 conservationColourSelected = b;
593 * @return DOCUMENT ME!
595 public boolean getAbovePIDThreshold()
597 return abovePIDThreshold;
603 * @param b DOCUMENT ME!
605 public void setAbovePIDThreshold(boolean b)
607 abovePIDThreshold = b;
613 * @return DOCUMENT ME!
615 public int getStartRes()
623 * @return DOCUMENT ME!
625 public int getEndRes()
633 * @return DOCUMENT ME!
635 public int getStartSeq()
643 * @param cs DOCUMENT ME!
645 public void setGlobalColourScheme(ColourSchemeI cs)
647 globalColourScheme = cs;
653 * @return DOCUMENT ME!
655 public ColourSchemeI getGlobalColourScheme()
657 return globalColourScheme;
663 * @param res DOCUMENT ME!
665 public void setStartRes(int res)
673 * @param seq DOCUMENT ME!
675 public void setStartSeq(int seq)
683 * @param res DOCUMENT ME!
685 public void setEndRes(int res)
687 if (res > (alignment.getWidth() - 1))
689 // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));
690 res = alignment.getWidth() - 1;
704 * @param seq DOCUMENT ME!
706 public void setEndSeq(int seq)
708 if (seq > alignment.getHeight())
710 seq = alignment.getHeight();
724 * @return DOCUMENT ME!
726 public int getEndSeq()
734 * @param f DOCUMENT ME!
736 public void setFont(Font f)
740 Container c = new Container();
742 java.awt.FontMetrics fm = c.getFontMetrics(font);
743 setCharHeight(fm.getHeight());
744 setCharWidth(fm.charWidth('M'));
745 validCharWidth = true;
751 * @return DOCUMENT ME!
753 public Font getFont()
761 * @param w DOCUMENT ME!
763 public void setCharWidth(int w)
771 * @return DOCUMENT ME!
773 public int getCharWidth()
781 * @param h DOCUMENT ME!
783 public void setCharHeight(int h)
791 * @return DOCUMENT ME!
793 public int getCharHeight()
801 * @param w DOCUMENT ME!
803 public void setWrappedWidth(int w)
805 this.wrappedWidth = w;
811 * @return DOCUMENT ME!
813 public int getWrappedWidth()
822 * @return DOCUMENT ME!
824 public AlignmentI getAlignment()
832 * @param align DOCUMENT ME!
834 public void setAlignment(AlignmentI align)
836 this.alignment = align;
842 * @param state DOCUMENT ME!
844 public void setWrapAlignment(boolean state)
846 wrapAlignment = state;
852 * @param state DOCUMENT ME!
854 public void setShowText(boolean state)
862 * @param state DOCUMENT ME!
864 public void setRenderGaps(boolean state)
872 * @return DOCUMENT ME!
874 public boolean getColourText()
876 return showColourText;
882 * @param state DOCUMENT ME!
884 public void setColourText(boolean state)
886 showColourText = state;
892 * @param state DOCUMENT ME!
894 public void setShowBoxes(boolean state)
902 * @return DOCUMENT ME!
904 public boolean getWrapAlignment()
906 return wrapAlignment;
912 * @return DOCUMENT ME!
914 public boolean getShowText()
922 * @return DOCUMENT ME!
924 public boolean getShowBoxes()
932 * @return DOCUMENT ME!
934 public char getGapCharacter()
936 return getAlignment().getGapCharacter();
942 * @param gap DOCUMENT ME!
944 public void setGapCharacter(char gap)
946 if (getAlignment() != null)
948 getAlignment().setGapCharacter(gap);
955 * @param thresh DOCUMENT ME!
957 public void setThreshold(int thresh)
965 * @return DOCUMENT ME!
967 public int getThreshold()
975 * @param inc DOCUMENT ME!
977 public void setIncrement(int inc)
985 * @return DOCUMENT ME!
987 public int getIncrement()
996 * @return DOCUMENT ME!
998 public ColumnSelection getColumnSelection()
1007 * @param tree DOCUMENT ME!
1009 public void setCurrentTree(NJTree tree)
1017 * @return DOCUMENT ME!
1019 public NJTree getCurrentTree()
1027 * @param b DOCUMENT ME!
1029 public void setColourAppliesToAllGroups(boolean b)
1031 colourAppliesToAllGroups = b;
1037 * @return DOCUMENT ME!
1039 public boolean getColourAppliesToAllGroups()
1041 return colourAppliesToAllGroups;
1047 * @return DOCUMENT ME!
1049 public boolean getShowJVSuffix()
1051 return showJVSuffix;
1057 * @param b DOCUMENT ME!
1059 public void setShowJVSuffix(boolean b)
1068 * @return DOCUMENT ME!
1070 public boolean getShowAnnotation()
1072 return showAnnotation;
1078 * @param b DOCUMENT ME!
1080 public void setShowAnnotation(boolean b)
1088 * @return DOCUMENT ME!
1090 public boolean getScaleAboveWrapped()
1092 return scaleAboveWrapped;
1098 * @return DOCUMENT ME!
1100 public boolean getScaleLeftWrapped()
1102 return scaleLeftWrapped;
1108 * @return DOCUMENT ME!
1110 public boolean getScaleRightWrapped()
1112 return scaleRightWrapped;
1118 * @param b DOCUMENT ME!
1120 public void setScaleAboveWrapped(boolean b)
1122 scaleAboveWrapped = b;
1128 * @param b DOCUMENT ME!
1130 public void setScaleLeftWrapped(boolean b)
1132 scaleLeftWrapped = b;
1138 * @param b DOCUMENT ME!
1140 public void setScaleRightWrapped(boolean b)
1142 scaleRightWrapped = b;
1146 * Property change listener for changes in alignment
1148 * @param listener DOCUMENT ME!
1150 public void addPropertyChangeListener(
1151 java.beans.PropertyChangeListener listener)
1153 changeSupport.addPropertyChangeListener(listener);
1159 * @param listener DOCUMENT ME!
1161 public void removePropertyChangeListener(
1162 java.beans.PropertyChangeListener listener)
1164 changeSupport.removePropertyChangeListener(listener);
1168 * Property change listener for changes in alignment
1170 * @param prop DOCUMENT ME!
1171 * @param oldvalue DOCUMENT ME!
1172 * @param newvalue DOCUMENT ME!
1174 public void firePropertyChange(String prop, Object oldvalue, Object newvalue)
1176 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
1179 public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
1181 ignoreGapsInConsensusCalculation = b;
1182 updateConsensus(ap);
1183 if(globalColourScheme!=null)
1185 globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation);
1189 public boolean getIgnoreGapsConsensus()
1191 return ignoreGapsInConsensusCalculation;
1194 public void setDataset(boolean b)
1199 public boolean isDataset()
1205 public void hideSelectedColumns()
1207 if (colSel.size() < 1)
1210 colSel.hideSelectedColumns();
1211 setSelectionGroup(null);
1213 hasHiddenColumns = true;
1217 public void hideColumns(int start, int end)
1220 colSel.hideColumns(start);
1222 colSel.hideColumns(start, end);
1224 hasHiddenColumns = true;
1227 public void hideAllSelectedSeqs()
1229 if (selectionGroup == null)
1232 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1236 setSelectionGroup(null);
1239 public void hideSequence(SequenceI [] seq)
1243 for (int i = 0; i < seq.length; i++)
1244 alignment.getHiddenSequences().hideSequence(seq[i]);
1246 hasHiddenRows = true;
1247 firePropertyChange("alignment", null, alignment.getSequences());
1251 public void showSequence(int index)
1253 Vector tmp = alignment.getHiddenSequences().showSequence(index);
1256 if(selectionGroup==null)
1258 selectionGroup = new SequenceGroup();
1259 selectionGroup.setEndRes(alignment.getWidth()-1);
1262 for (int t = 0; t < tmp.size(); t++)
1264 selectionGroup.addSequence(
1265 (SequenceI) tmp.elementAt(t), false
1268 firePropertyChange("alignment", null, alignment.getSequences());
1271 if(alignment.getHiddenSequences().getSize()<1)
1272 hasHiddenRows = false;
1275 public void showColumn(int col)
1277 colSel.revealHiddenColumns(col);
1278 if(colSel.getHiddenColumns()==null)
1279 hasHiddenColumns = false;
1282 public void showAllHiddenColumns()
1284 colSel.revealAllHiddenColumns();
1285 hasHiddenColumns = false;
1288 public void showAllHiddenSeqs()
1290 if(alignment.getHiddenSequences().getSize()>0)
1292 if(selectionGroup==null)
1294 selectionGroup = new SequenceGroup();
1295 selectionGroup.setEndRes(alignment.getWidth()-1);
1297 Vector tmp = alignment.getHiddenSequences().showAll();
1298 for(int t=0; t<tmp.size(); t++)
1300 selectionGroup.addSequence(
1301 (SequenceI)tmp.elementAt(t), false
1304 firePropertyChange("alignment", null, alignment.getSequences());
1305 hasHiddenRows = false;
1309 public void invertColumnSelection()
1312 for(int i=0; i<alignment.getWidth(); i++)
1316 if(colSel.contains(column))
1317 colSel.removeElement(column);
1319 colSel.addElement(column);
1325 public int adjustForHiddenSeqs(int alignmentIndex)
1327 return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex);
1331 * This method returns the a new SequenceI [] with
1332 * the selection sequence and start and end points adjusted
1335 public SequenceI[] getSelectionAsNewSequence()
1337 SequenceI[] sequences;
1339 if (selectionGroup == null)
1340 sequences = alignment.getSequencesArray();
1342 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1348 * This method returns the visible alignment as text, as
1349 * seen on the GUI, ie if columns are hidden they will not
1350 * be returned in the result.
1351 * Use this for calculating trees, PCA, redundancy etc on views
1352 * which contain hidden columns.
1355 public jalview.datamodel.CigarArray getViewAsCigars(boolean selectedRegionOnly)
1357 CigarArray selection=null;
1358 SequenceI [] seqs= null;
1360 int start = 0, end = 0;
1361 if(selectedRegionOnly && selectionGroup!=null)
1363 iSize = selectionGroup.getSize(false);
1364 seqs = selectionGroup.getSequencesInOrder(alignment);
1365 start = selectionGroup.getStartRes();
1366 end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor
1370 iSize = alignment.getHeight();
1371 seqs = alignment.getSequencesArray();
1372 end = alignment.getWidth()-1;
1374 SeqCigar[] selseqs = new SeqCigar[iSize];
1375 for(i=0; i<iSize; i++)
1377 selseqs[i] = new SeqCigar(seqs[i], start, end);
1379 selection=new CigarArray(selseqs);
1380 // now construct the CigarArray operations
1381 if (hasHiddenColumns) {
1382 Vector regions = colSel.getHiddenColumns();
1384 int hideStart, hideEnd;
1386 for (int j = 0; last<end & j < regions.size(); j++)
1388 region = (int[]) regions.elementAt(j);
1389 hideStart = region[0];
1390 hideEnd = region[1];
1391 // edit hidden regions to selection range
1392 if(hideStart<last) {
1406 if (hideStart>hideEnd)
1409 * form operations...
1412 selection.addOperation(CigarArray.M, hideStart-last);
1413 selection.addOperation(CigarArray.D, 1+hideEnd-hideStart);
1416 // Final match if necessary.
1418 selection.addOperation(CigarArray.M, end-last+1);
1420 selection.addOperation(CigarArray.M, end-start+1);
1425 * return a compact representation of the current alignment selection to
1426 * pass to an analysis function
1427 * @param selectedOnly boolean true to just return the selected view
1428 * @return AlignmentView
1430 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly) {
1432 // this is here because the AlignmentView constructor modifies the CigarArray
1433 // object. Refactoring of Cigar and alignment view representation should
1434 // be done to remove redundancy.
1435 CigarArray aligview = getViewAsCigars(selectedOnly);
1436 if (aligview!=null) {
1437 return new AlignmentView(aligview,
1438 (selectedOnly && selectionGroup!=null) ? selectionGroup.getStartRes() : 0);
1443 * This method returns the visible alignment as text, as
1444 * seen on the GUI, ie if columns are hidden they will not
1445 * be returned in the result.
1446 * Use this for calculating trees, PCA, redundancy etc on views
1447 * which contain hidden columns.
1450 public String [] getViewAsString(boolean selectedRegionOnly)
1452 String [] selection = null;
1453 SequenceI [] seqs= null;
1455 int start = 0, end = 0;
1456 if(selectedRegionOnly && selectionGroup!=null)
1458 iSize = selectionGroup.getSize(false);
1459 seqs = selectionGroup.getSequencesInOrder(alignment);
1460 start = selectionGroup.getStartRes();
1461 end = selectionGroup.getEndRes()+1;
1465 iSize = alignment.getHeight();
1466 seqs = alignment.getSequencesArray();
1467 end = alignment.getWidth();
1470 selection = new String[iSize];
1471 if (hasHiddenColumns) {
1472 selection = colSel.getVisibleSequenceStrings(start, end, seqs);
1474 for(i=0; i<iSize; i++)
1476 selection[i] = seqs[i].getSequence(start, end);
1483 public boolean getShowHiddenMarkers()
1485 return showHiddenMarkers;
1488 public void setShowHiddenMarkers(boolean show)
1490 showHiddenMarkers = show;
1493 public String getSequenceSetId()
1495 if(sequenceSetID==null)
1496 sequenceSetID = alignment.hashCode()+"";
1498 return sequenceSetID;
1501 public void alignmentChanged(AlignmentPanel ap)
1504 alignment.padGaps();
1506 if (hconsensus != null && autoCalculateConsensus)
1508 updateConsensus(ap);
1509 updateConservation(ap);
1512 resetAllColourSchemes();
1514 alignment.adjustSequenceAnnotations();
1519 void resetAllColourSchemes()
1521 ColourSchemeI cs = globalColourScheme;
1524 if (cs instanceof ClustalxColourScheme)
1526 ( (ClustalxColourScheme) cs).
1527 resetClustalX(alignment.getSequences(),
1528 alignment.getWidth());
1531 cs.setConsensus(hconsensus);
1532 if (cs.conservationApplied())
1534 Alignment al = (Alignment) alignment;
1535 Conservation c = new Conservation("All",
1536 ResidueProperties.propHash, 3,
1537 al.getSequences(), 0,
1540 c.verdict(false, ConsPercGaps);
1542 cs.setConservation(c);
1546 int s, sSize = alignment.getGroups().size();
1547 for(s=0; s<sSize; s++)
1549 SequenceGroup sg = (SequenceGroup)alignment.getGroups().elementAt(s);
1550 if(sg.cs!=null && sg.cs instanceof ClustalxColourScheme)
1552 ((ClustalxColourScheme)sg.cs).resetClustalX(
1553 sg.getSequences(true), sg.getWidth());
1555 sg.recalcConservation();