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 int alWidth = alignment.getWidth();
271 Conservation cons = new jalview.analysis.Conservation("All",
272 jalview.schemes.ResidueProperties.propHash, 3,
273 alignment.getSequences(), 0, alWidth -1);
276 cons.verdict(false, ConsPercGaps);
283 String sequence = cons.getConsSequence().getSequence();
295 maxB = 0f - minB; // scalable range for colouring both Conservation and Quality
304 conservation.annotations = new Annotation[alWidth];
308 quality.graphMax = cons.qualityRange[1].floatValue();
309 quality.annotations = new Annotation[alWidth];
310 qmin = cons.qualityRange[0].floatValue();
311 qmax = cons.qualityRange[1].floatValue();
314 for (int i = 0; i < alWidth; i++)
318 c = sequence.charAt(i);
320 if (Character.isDigit(c))
321 value = (int) (c - '0');
327 float vprop = value - min;
329 conservation.annotations[i] =
330 new Annotation(String.valueOf(c),
331 String.valueOf(value), ' ', value,
332 new Color(minR + (maxR * vprop),
333 minG + (maxG * vprop),
334 minB + (maxB * vprop)));
339 value = ( (Double) cons.quality.get(i)).floatValue();
340 vprop = value - qmin;
342 quality.annotations[i] = new Annotation(" ", String.valueOf(value), ' ',
344 new Color(minR + (maxR * vprop),
345 minG + (maxG * vprop),
346 minB + (maxB * vprop)));
350 catch (OutOfMemoryError error)
352 javax.swing.SwingUtilities.invokeLater(new Runnable()
358 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
359 "Out of memory calculating conservation!!"
361 "\nSee help files for increasing Java Virtual Machine memory."
363 javax.swing.JOptionPane.WARNING_MESSAGE);
370 System.out.println("Conservation calculation: " + error);
379 updatingConservation = false;
384 static ConservationThread conservationThread;
386 static ConsensusThread consensusThread;
388 boolean consUpdateNeeded = false;
390 boolean updatingConsensus = false;
392 boolean updatingConservation = false;
397 public void updateConservation(final AlignmentPanel ap)
399 if (alignment.isNucleotide() || conservation==null)
402 updatingConservation = true;
403 // javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() {
404 while (conservationThread != null && conservationThread.isAlive())
408 // Thread.sleep(100);
414 conservationThread = new ConservationThread(ap);
415 conservationThread.start();
422 public void updateConsensus(final AlignmentPanel ap)
424 updatingConsensus = true;
426 // javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() {
427 while (consensusThread != null && consensusThread.isAlive())
431 // Thread.sleep(100);
437 consensusThread = new ConsensusThread(ap);
438 consensusThread.start();
443 class ConsensusThread extends Thread
446 public ConsensusThread(AlignmentPanel ap)
454 int aWidth = alignment.getWidth();
458 consensus.annotations = null;
459 consensus.annotations = new Annotation[aWidth];
462 hconsensus = new Hashtable[aWidth];
463 AAFrequency.calculate(alignment.getSequencesArray(),
465 alignment.getWidth(),
468 for (int i = 0; i < aWidth; i++)
471 if (ignoreGapsInConsensusCalculation)
472 value = ( (Float) hconsensus[i].get(AAFrequency.PID_NOGAPS)).
475 value = ( (Float) hconsensus[i].get(AAFrequency.PID_GAPS)).
478 String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
479 String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
481 if (maxRes.length() > 1)
483 mouseOver = "[" + maxRes + "] ";
487 mouseOver += ( (int) value + "%");
488 consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);
492 if (globalColourScheme != null)
493 globalColourScheme.setConsensus(hconsensus);
496 catch (OutOfMemoryError error)
500 javax.swing.SwingUtilities.invokeLater(new Runnable()
504 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
505 "Out of memory calculating consensus!!"
507 "\nSee help files for increasing Java Virtual Machine memory."
509 javax.swing.JOptionPane.WARNING_MESSAGE);
513 System.out.println("Consensus calculation: " + error);
523 updatingConsensus = false;
527 * get the consensus sequence as displayed under the PID consensus annotation row.
528 * @return consensus sequence as a new sequence object
530 public SequenceI getConsensusSeq() {
532 updateConsensus(null);
535 StringBuffer seqs=new StringBuffer();
536 for (int i=0; i<consensus.annotations.length; i++) {
537 if (consensus.annotations[i]!=null) {
538 if (consensus.annotations[i].description.charAt(0) == '[')
539 seqs.append(consensus.annotations[i].description.charAt(1));
541 seqs.append(consensus.annotations[i].displayCharacter);
544 SequenceI sq = new Sequence("Consensus", seqs.toString());
545 sq.setDescription("Percentage Identity Consensus "+((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
551 * @return DOCUMENT ME!
553 public SequenceGroup getSelectionGroup()
555 return selectionGroup;
561 * @param sg DOCUMENT ME!
563 public void setSelectionGroup(SequenceGroup sg)
571 * @return DOCUMENT ME!
573 public boolean getConservationSelected()
575 return conservationColourSelected;
581 * @param b DOCUMENT ME!
583 public void setConservationSelected(boolean b)
585 conservationColourSelected = b;
591 * @return DOCUMENT ME!
593 public boolean getAbovePIDThreshold()
595 return abovePIDThreshold;
601 * @param b DOCUMENT ME!
603 public void setAbovePIDThreshold(boolean b)
605 abovePIDThreshold = b;
611 * @return DOCUMENT ME!
613 public int getStartRes()
621 * @return DOCUMENT ME!
623 public int getEndRes()
631 * @return DOCUMENT ME!
633 public int getStartSeq()
641 * @param cs DOCUMENT ME!
643 public void setGlobalColourScheme(ColourSchemeI cs)
645 globalColourScheme = cs;
651 * @return DOCUMENT ME!
653 public ColourSchemeI getGlobalColourScheme()
655 return globalColourScheme;
661 * @param res DOCUMENT ME!
663 public void setStartRes(int res)
671 * @param seq DOCUMENT ME!
673 public void setStartSeq(int seq)
681 * @param res DOCUMENT ME!
683 public void setEndRes(int res)
685 if (res > (alignment.getWidth() - 1))
687 // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));
688 res = alignment.getWidth() - 1;
702 * @param seq DOCUMENT ME!
704 public void setEndSeq(int seq)
706 if (seq > alignment.getHeight())
708 seq = alignment.getHeight();
722 * @return DOCUMENT ME!
724 public int getEndSeq()
732 * @param f DOCUMENT ME!
734 public void setFont(Font f)
738 Container c = new Container();
740 java.awt.FontMetrics fm = c.getFontMetrics(font);
741 setCharHeight(fm.getHeight());
742 setCharWidth(fm.charWidth('M'));
743 validCharWidth = true;
749 * @return DOCUMENT ME!
751 public Font getFont()
759 * @param w DOCUMENT ME!
761 public void setCharWidth(int w)
769 * @return DOCUMENT ME!
771 public int getCharWidth()
779 * @param h DOCUMENT ME!
781 public void setCharHeight(int h)
789 * @return DOCUMENT ME!
791 public int getCharHeight()
799 * @param w DOCUMENT ME!
801 public void setWrappedWidth(int w)
803 this.wrappedWidth = w;
809 * @return DOCUMENT ME!
811 public int getWrappedWidth()
820 * @return DOCUMENT ME!
822 public AlignmentI getAlignment()
830 * @param align DOCUMENT ME!
832 public void setAlignment(AlignmentI align)
834 this.alignment = align;
840 * @param state DOCUMENT ME!
842 public void setWrapAlignment(boolean state)
844 wrapAlignment = state;
850 * @param state DOCUMENT ME!
852 public void setShowText(boolean state)
860 * @param state DOCUMENT ME!
862 public void setRenderGaps(boolean state)
870 * @return DOCUMENT ME!
872 public boolean getColourText()
874 return showColourText;
880 * @param state DOCUMENT ME!
882 public void setColourText(boolean state)
884 showColourText = state;
890 * @param state DOCUMENT ME!
892 public void setShowBoxes(boolean state)
900 * @return DOCUMENT ME!
902 public boolean getWrapAlignment()
904 return wrapAlignment;
910 * @return DOCUMENT ME!
912 public boolean getShowText()
920 * @return DOCUMENT ME!
922 public boolean getShowBoxes()
930 * @return DOCUMENT ME!
932 public char getGapCharacter()
934 return getAlignment().getGapCharacter();
940 * @param gap DOCUMENT ME!
942 public void setGapCharacter(char gap)
944 if (getAlignment() != null)
946 getAlignment().setGapCharacter(gap);
953 * @param thresh DOCUMENT ME!
955 public void setThreshold(int thresh)
963 * @return DOCUMENT ME!
965 public int getThreshold()
973 * @param inc DOCUMENT ME!
975 public void setIncrement(int inc)
983 * @return DOCUMENT ME!
985 public int getIncrement()
994 * @return DOCUMENT ME!
996 public ColumnSelection getColumnSelection()
1005 * @param tree DOCUMENT ME!
1007 public void setCurrentTree(NJTree tree)
1015 * @return DOCUMENT ME!
1017 public NJTree getCurrentTree()
1025 * @param b DOCUMENT ME!
1027 public void setColourAppliesToAllGroups(boolean b)
1029 colourAppliesToAllGroups = b;
1035 * @return DOCUMENT ME!
1037 public boolean getColourAppliesToAllGroups()
1039 return colourAppliesToAllGroups;
1045 * @return DOCUMENT ME!
1047 public boolean getShowJVSuffix()
1049 return showJVSuffix;
1055 * @param b DOCUMENT ME!
1057 public void setShowJVSuffix(boolean b)
1066 * @return DOCUMENT ME!
1068 public boolean getShowAnnotation()
1070 return showAnnotation;
1076 * @param b DOCUMENT ME!
1078 public void setShowAnnotation(boolean b)
1086 * @return DOCUMENT ME!
1088 public boolean getScaleAboveWrapped()
1090 return scaleAboveWrapped;
1096 * @return DOCUMENT ME!
1098 public boolean getScaleLeftWrapped()
1100 return scaleLeftWrapped;
1106 * @return DOCUMENT ME!
1108 public boolean getScaleRightWrapped()
1110 return scaleRightWrapped;
1116 * @param b DOCUMENT ME!
1118 public void setScaleAboveWrapped(boolean b)
1120 scaleAboveWrapped = b;
1126 * @param b DOCUMENT ME!
1128 public void setScaleLeftWrapped(boolean b)
1130 scaleLeftWrapped = b;
1136 * @param b DOCUMENT ME!
1138 public void setScaleRightWrapped(boolean b)
1140 scaleRightWrapped = b;
1144 * Property change listener for changes in alignment
1146 * @param listener DOCUMENT ME!
1148 public void addPropertyChangeListener(
1149 java.beans.PropertyChangeListener listener)
1151 changeSupport.addPropertyChangeListener(listener);
1157 * @param listener DOCUMENT ME!
1159 public void removePropertyChangeListener(
1160 java.beans.PropertyChangeListener listener)
1162 changeSupport.removePropertyChangeListener(listener);
1166 * Property change listener for changes in alignment
1168 * @param prop DOCUMENT ME!
1169 * @param oldvalue DOCUMENT ME!
1170 * @param newvalue DOCUMENT ME!
1172 public void firePropertyChange(String prop, Object oldvalue, Object newvalue)
1174 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
1177 public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
1179 ignoreGapsInConsensusCalculation = b;
1180 updateConsensus(ap);
1181 if(globalColourScheme!=null)
1183 globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation);
1187 public boolean getIgnoreGapsConsensus()
1189 return ignoreGapsInConsensusCalculation;
1192 public void setDataset(boolean b)
1197 public boolean isDataset()
1203 public void hideSelectedColumns()
1205 if (colSel.size() < 1)
1208 colSel.hideSelectedColumns();
1209 setSelectionGroup(null);
1211 hasHiddenColumns = true;
1215 public void hideColumns(int start, int end)
1218 colSel.hideColumns(start);
1220 colSel.hideColumns(start, end);
1222 hasHiddenColumns = true;
1225 public void hideAllSelectedSeqs()
1227 if (selectionGroup == null)
1230 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1234 setSelectionGroup(null);
1237 public void hideSequence(SequenceI [] seq)
1241 for (int i = 0; i < seq.length; i++)
1242 alignment.getHiddenSequences().hideSequence(seq[i]);
1244 hasHiddenRows = true;
1245 firePropertyChange("alignment", null, alignment.getSequences());
1249 public void showSequence(int index)
1251 Vector tmp = alignment.getHiddenSequences().showSequence(index);
1254 if(selectionGroup==null)
1256 selectionGroup = new SequenceGroup();
1257 selectionGroup.setEndRes(alignment.getWidth()-1);
1260 for (int t = 0; t < tmp.size(); t++)
1262 selectionGroup.addSequence(
1263 (SequenceI) tmp.elementAt(t), false
1266 firePropertyChange("alignment", null, alignment.getSequences());
1269 if(alignment.getHiddenSequences().getSize()<1)
1270 hasHiddenRows = false;
1273 public void showColumn(int col)
1275 colSel.revealHiddenColumns(col);
1276 if(colSel.getHiddenColumns()==null)
1277 hasHiddenColumns = false;
1280 public void showAllHiddenColumns()
1282 colSel.revealAllHiddenColumns();
1283 hasHiddenColumns = false;
1286 public void showAllHiddenSeqs()
1288 if(alignment.getHiddenSequences().getSize()>0)
1290 if(selectionGroup==null)
1292 selectionGroup = new SequenceGroup();
1293 selectionGroup.setEndRes(alignment.getWidth()-1);
1295 Vector tmp = alignment.getHiddenSequences().showAll();
1296 for(int t=0; t<tmp.size(); t++)
1298 selectionGroup.addSequence(
1299 (SequenceI)tmp.elementAt(t), false
1302 firePropertyChange("alignment", null, alignment.getSequences());
1303 hasHiddenRows = false;
1307 public void invertColumnSelection()
1310 for(int i=0; i<alignment.getWidth(); i++)
1314 if(colSel.contains(column))
1315 colSel.removeElement(column);
1317 colSel.addElement(column);
1323 public int adjustForHiddenSeqs(int alignmentIndex)
1325 return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex);
1329 * This method returns the a new SequenceI [] with
1330 * the selection sequence and start and end points adjusted
1333 public SequenceI[] getSelectionAsNewSequence()
1335 SequenceI[] sequences;
1337 if (selectionGroup == null)
1338 sequences = alignment.getSequencesArray();
1340 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1346 * This method returns the visible alignment as text, as
1347 * seen on the GUI, ie if columns are hidden they will not
1348 * be returned in the result.
1349 * Use this for calculating trees, PCA, redundancy etc on views
1350 * which contain hidden columns.
1353 public jalview.datamodel.CigarArray getViewAsCigars(boolean selectedRegionOnly)
1355 CigarArray selection=null;
1356 SequenceI [] seqs= null;
1358 int start = 0, end = 0;
1359 if(selectedRegionOnly && selectionGroup!=null)
1361 iSize = selectionGroup.getSize(false);
1362 seqs = selectionGroup.getSequencesInOrder(alignment);
1363 start = selectionGroup.getStartRes();
1364 end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor
1368 iSize = alignment.getHeight();
1369 seqs = alignment.getSequencesArray();
1370 end = alignment.getWidth()-1;
1372 SeqCigar[] selseqs = new SeqCigar[iSize];
1373 for(i=0; i<iSize; i++)
1375 selseqs[i] = new SeqCigar(seqs[i], start, end);
1377 selection=new CigarArray(selseqs);
1378 // now construct the CigarArray operations
1379 if (hasHiddenColumns) {
1380 Vector regions = colSel.getHiddenColumns();
1382 int hideStart, hideEnd;
1384 for (int j = 0; last<end & j < regions.size(); j++)
1386 region = (int[]) regions.elementAt(j);
1387 hideStart = region[0];
1388 hideEnd = region[1];
1389 // edit hidden regions to selection range
1390 if(hideStart<last) {
1404 if (hideStart>hideEnd)
1407 * form operations...
1410 selection.addOperation(CigarArray.M, hideStart-last);
1411 selection.addOperation(CigarArray.D, 1+hideEnd-hideStart);
1414 // Final match if necessary.
1416 selection.addOperation(CigarArray.M, end-last+1);
1418 selection.addOperation(CigarArray.M, end-start+1);
1423 * return a compact representation of the current alignment selection to
1424 * pass to an analysis function
1425 * @param selectedOnly boolean true to just return the selected view
1426 * @return AlignmentView
1428 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly) {
1430 // this is here because the AlignmentView constructor modifies the CigarArray
1431 // object. Refactoring of Cigar and alignment view representation should
1432 // be done to remove redundancy.
1433 CigarArray aligview = getViewAsCigars(selectedOnly);
1434 if (aligview!=null) {
1435 return new AlignmentView(aligview,
1436 (selectedOnly && selectionGroup!=null) ? selectionGroup.getStartRes() : 0);
1441 * This method returns the visible alignment as text, as
1442 * seen on the GUI, ie if columns are hidden they will not
1443 * be returned in the result.
1444 * Use this for calculating trees, PCA, redundancy etc on views
1445 * which contain hidden columns.
1448 public String [] getViewAsString(boolean selectedRegionOnly)
1450 String [] selection = null;
1451 SequenceI [] seqs= null;
1453 int start = 0, end = 0;
1454 if(selectedRegionOnly && selectionGroup!=null)
1456 iSize = selectionGroup.getSize(false);
1457 seqs = selectionGroup.getSequencesInOrder(alignment);
1458 start = selectionGroup.getStartRes();
1459 end = selectionGroup.getEndRes()+1;
1463 iSize = alignment.getHeight();
1464 seqs = alignment.getSequencesArray();
1465 end = alignment.getWidth();
1468 selection = new String[iSize];
1469 if (hasHiddenColumns) {
1470 selection = colSel.getVisibleSequenceStrings(start, end, seqs);
1472 for(i=0; i<iSize; i++)
1474 selection[i] = seqs[i].getSequence(start, end);
1481 public boolean getShowHiddenMarkers()
1483 return showHiddenMarkers;
1486 public void setShowHiddenMarkers(boolean show)
1488 showHiddenMarkers = show;
1491 public String getSequenceSetId()
1493 if(sequenceSetID==null)
1494 sequenceSetID = alignment.hashCode()+"";
1496 return sequenceSetID;
1499 public void alignmentChanged(AlignmentPanel ap)
1502 alignment.padGaps();
1504 if (hconsensus != null && autoCalculateConsensus)
1506 updateConsensus(ap);
1507 updateConservation(ap);
1510 resetAllColourSchemes();
1512 alignment.adjustSequenceAnnotations();
1516 void resetAllColourSchemes()
1518 ColourSchemeI cs = globalColourScheme;
1521 if (cs instanceof ClustalxColourScheme)
1523 ( (ClustalxColourScheme) cs).
1524 resetClustalX(alignment.getSequences(),
1525 alignment.getWidth());
1528 cs.setConsensus(hconsensus);
1529 if (cs.conservationApplied())
1531 Alignment al = (Alignment) alignment;
1532 Conservation c = new Conservation("All",
1533 ResidueProperties.propHash, 3,
1534 al.getSequences(), 0,
1537 c.verdict(false, ConsPercGaps);
1539 cs.setConservation(c);
1543 int s, sSize = alignment.getGroups().size();
1544 for(s=0; s<sSize; s++)
1546 SequenceGroup sg = (SequenceGroup)alignment.getGroups().elementAt(s);
1547 if(sg.cs!=null && sg.cs instanceof ClustalxColourScheme)
1549 ((ClustalxColourScheme)sg.cs).resetClustalX(
1550 sg.getSequences(true), sg.getWidth());
1552 sg.recalcConservation();