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)
500 alignment.deleteAnnotation(consensus);
504 javax.swing.SwingUtilities.invokeLater(new Runnable()
508 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
509 "Out of memory calculating consensus!!"
511 "\nSee help files for increasing Java Virtual Machine memory."
513 javax.swing.JOptionPane.WARNING_MESSAGE);
517 System.out.println("Consensus calculation: " + error);
527 updatingConsensus = false;
531 * get the consensus sequence as displayed under the PID consensus annotation row.
532 * @return consensus sequence as a new sequence object
534 public SequenceI getConsensusSeq() {
536 updateConsensus(null);
539 StringBuffer seqs=new StringBuffer();
540 for (int i=0; i<consensus.annotations.length; i++) {
541 if (consensus.annotations[i]!=null) {
542 if (consensus.annotations[i].description.charAt(0) == '[')
543 seqs.append(consensus.annotations[i].description.charAt(1));
545 seqs.append(consensus.annotations[i].displayCharacter);
549 SequenceI sq = new Sequence("Consensus", seqs.toString());
550 sq.setDescription("Percentage Identity Consensus "+((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
556 * @return DOCUMENT ME!
558 public SequenceGroup getSelectionGroup()
560 return selectionGroup;
566 * @param sg DOCUMENT ME!
568 public void setSelectionGroup(SequenceGroup sg)
576 * @return DOCUMENT ME!
578 public boolean getConservationSelected()
580 return conservationColourSelected;
586 * @param b DOCUMENT ME!
588 public void setConservationSelected(boolean b)
590 conservationColourSelected = b;
596 * @return DOCUMENT ME!
598 public boolean getAbovePIDThreshold()
600 return abovePIDThreshold;
606 * @param b DOCUMENT ME!
608 public void setAbovePIDThreshold(boolean b)
610 abovePIDThreshold = b;
616 * @return DOCUMENT ME!
618 public int getStartRes()
626 * @return DOCUMENT ME!
628 public int getEndRes()
636 * @return DOCUMENT ME!
638 public int getStartSeq()
646 * @param cs DOCUMENT ME!
648 public void setGlobalColourScheme(ColourSchemeI cs)
650 globalColourScheme = cs;
656 * @return DOCUMENT ME!
658 public ColourSchemeI getGlobalColourScheme()
660 return globalColourScheme;
666 * @param res DOCUMENT ME!
668 public void setStartRes(int res)
676 * @param seq DOCUMENT ME!
678 public void setStartSeq(int seq)
686 * @param res DOCUMENT ME!
688 public void setEndRes(int res)
690 if (res > (alignment.getWidth() - 1))
692 // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));
693 res = alignment.getWidth() - 1;
707 * @param seq DOCUMENT ME!
709 public void setEndSeq(int seq)
711 if (seq > alignment.getHeight())
713 seq = alignment.getHeight();
727 * @return DOCUMENT ME!
729 public int getEndSeq()
737 * @param f DOCUMENT ME!
739 public void setFont(Font f)
743 Container c = new Container();
745 java.awt.FontMetrics fm = c.getFontMetrics(font);
746 setCharHeight(fm.getHeight());
747 setCharWidth(fm.charWidth('M'));
748 validCharWidth = true;
754 * @return DOCUMENT ME!
756 public Font getFont()
764 * @param w DOCUMENT ME!
766 public void setCharWidth(int w)
774 * @return DOCUMENT ME!
776 public int getCharWidth()
784 * @param h DOCUMENT ME!
786 public void setCharHeight(int h)
794 * @return DOCUMENT ME!
796 public int getCharHeight()
804 * @param w DOCUMENT ME!
806 public void setWrappedWidth(int w)
808 this.wrappedWidth = w;
814 * @return DOCUMENT ME!
816 public int getWrappedWidth()
825 * @return DOCUMENT ME!
827 public AlignmentI getAlignment()
835 * @param align DOCUMENT ME!
837 public void setAlignment(AlignmentI align)
839 this.alignment = align;
845 * @param state DOCUMENT ME!
847 public void setWrapAlignment(boolean state)
849 wrapAlignment = state;
855 * @param state DOCUMENT ME!
857 public void setShowText(boolean state)
865 * @param state DOCUMENT ME!
867 public void setRenderGaps(boolean state)
875 * @return DOCUMENT ME!
877 public boolean getColourText()
879 return showColourText;
885 * @param state DOCUMENT ME!
887 public void setColourText(boolean state)
889 showColourText = state;
895 * @param state DOCUMENT ME!
897 public void setShowBoxes(boolean state)
905 * @return DOCUMENT ME!
907 public boolean getWrapAlignment()
909 return wrapAlignment;
915 * @return DOCUMENT ME!
917 public boolean getShowText()
925 * @return DOCUMENT ME!
927 public boolean getShowBoxes()
935 * @return DOCUMENT ME!
937 public char getGapCharacter()
939 return getAlignment().getGapCharacter();
945 * @param gap DOCUMENT ME!
947 public void setGapCharacter(char gap)
949 if (getAlignment() != null)
951 getAlignment().setGapCharacter(gap);
958 * @param thresh DOCUMENT ME!
960 public void setThreshold(int thresh)
968 * @return DOCUMENT ME!
970 public int getThreshold()
978 * @param inc DOCUMENT ME!
980 public void setIncrement(int inc)
988 * @return DOCUMENT ME!
990 public int getIncrement()
999 * @return DOCUMENT ME!
1001 public ColumnSelection getColumnSelection()
1010 * @param tree DOCUMENT ME!
1012 public void setCurrentTree(NJTree tree)
1020 * @return DOCUMENT ME!
1022 public NJTree getCurrentTree()
1030 * @param b DOCUMENT ME!
1032 public void setColourAppliesToAllGroups(boolean b)
1034 colourAppliesToAllGroups = b;
1040 * @return DOCUMENT ME!
1042 public boolean getColourAppliesToAllGroups()
1044 return colourAppliesToAllGroups;
1050 * @return DOCUMENT ME!
1052 public boolean getShowJVSuffix()
1054 return showJVSuffix;
1060 * @param b DOCUMENT ME!
1062 public void setShowJVSuffix(boolean b)
1071 * @return DOCUMENT ME!
1073 public boolean getShowAnnotation()
1075 return showAnnotation;
1081 * @param b DOCUMENT ME!
1083 public void setShowAnnotation(boolean b)
1091 * @return DOCUMENT ME!
1093 public boolean getScaleAboveWrapped()
1095 return scaleAboveWrapped;
1101 * @return DOCUMENT ME!
1103 public boolean getScaleLeftWrapped()
1105 return scaleLeftWrapped;
1111 * @return DOCUMENT ME!
1113 public boolean getScaleRightWrapped()
1115 return scaleRightWrapped;
1121 * @param b DOCUMENT ME!
1123 public void setScaleAboveWrapped(boolean b)
1125 scaleAboveWrapped = b;
1131 * @param b DOCUMENT ME!
1133 public void setScaleLeftWrapped(boolean b)
1135 scaleLeftWrapped = b;
1141 * @param b DOCUMENT ME!
1143 public void setScaleRightWrapped(boolean b)
1145 scaleRightWrapped = b;
1149 * Property change listener for changes in alignment
1151 * @param listener DOCUMENT ME!
1153 public void addPropertyChangeListener(
1154 java.beans.PropertyChangeListener listener)
1156 changeSupport.addPropertyChangeListener(listener);
1162 * @param listener DOCUMENT ME!
1164 public void removePropertyChangeListener(
1165 java.beans.PropertyChangeListener listener)
1167 changeSupport.removePropertyChangeListener(listener);
1171 * Property change listener for changes in alignment
1173 * @param prop DOCUMENT ME!
1174 * @param oldvalue DOCUMENT ME!
1175 * @param newvalue DOCUMENT ME!
1177 public void firePropertyChange(String prop, Object oldvalue, Object newvalue)
1179 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
1182 public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
1184 ignoreGapsInConsensusCalculation = b;
1185 updateConsensus(ap);
1186 if(globalColourScheme!=null)
1188 globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation);
1192 public boolean getIgnoreGapsConsensus()
1194 return ignoreGapsInConsensusCalculation;
1197 public void setDataset(boolean b)
1202 public boolean isDataset()
1208 public void hideSelectedColumns()
1210 if (colSel.size() < 1)
1213 colSel.hideSelectedColumns();
1214 setSelectionGroup(null);
1216 hasHiddenColumns = true;
1220 public void hideColumns(int start, int end)
1223 colSel.hideColumns(start);
1225 colSel.hideColumns(start, end);
1227 hasHiddenColumns = true;
1230 public void hideAllSelectedSeqs()
1232 if (selectionGroup == null)
1235 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1239 setSelectionGroup(null);
1242 public void hideSequence(SequenceI [] seq)
1246 for (int i = 0; i < seq.length; i++)
1247 alignment.getHiddenSequences().hideSequence(seq[i]);
1249 hasHiddenRows = true;
1250 firePropertyChange("alignment", null, alignment.getSequences());
1254 public void showSequence(int index)
1256 Vector tmp = alignment.getHiddenSequences().showSequence(index);
1259 if(selectionGroup==null)
1261 selectionGroup = new SequenceGroup();
1262 selectionGroup.setEndRes(alignment.getWidth()-1);
1265 for (int t = 0; t < tmp.size(); t++)
1267 selectionGroup.addSequence(
1268 (SequenceI) tmp.elementAt(t), false
1271 firePropertyChange("alignment", null, alignment.getSequences());
1274 if(alignment.getHiddenSequences().getSize()<1)
1275 hasHiddenRows = false;
1278 public void showColumn(int col)
1280 colSel.revealHiddenColumns(col);
1281 if(colSel.getHiddenColumns()==null)
1282 hasHiddenColumns = false;
1285 public void showAllHiddenColumns()
1287 colSel.revealAllHiddenColumns();
1288 hasHiddenColumns = false;
1291 public void showAllHiddenSeqs()
1293 if(alignment.getHiddenSequences().getSize()>0)
1295 if(selectionGroup==null)
1297 selectionGroup = new SequenceGroup();
1298 selectionGroup.setEndRes(alignment.getWidth()-1);
1300 Vector tmp = alignment.getHiddenSequences().showAll();
1301 for(int t=0; t<tmp.size(); t++)
1303 selectionGroup.addSequence(
1304 (SequenceI)tmp.elementAt(t), false
1307 firePropertyChange("alignment", null, alignment.getSequences());
1308 hasHiddenRows = false;
1312 public void invertColumnSelection()
1315 for(int i=0; i<alignment.getWidth(); i++)
1319 if(colSel.contains(column))
1320 colSel.removeElement(column);
1322 colSel.addElement(column);
1328 public int adjustForHiddenSeqs(int alignmentIndex)
1330 return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex);
1334 * This method returns the a new SequenceI [] with
1335 * the selection sequence and start and end points adjusted
1338 public SequenceI[] getSelectionAsNewSequence()
1340 SequenceI[] sequences;
1342 if (selectionGroup == null)
1343 sequences = alignment.getSequencesArray();
1345 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1351 * This method returns the visible alignment as text, as
1352 * seen on the GUI, ie if columns are hidden they will not
1353 * be returned in the result.
1354 * Use this for calculating trees, PCA, redundancy etc on views
1355 * which contain hidden columns.
1358 public jalview.datamodel.CigarArray getViewAsCigars(boolean selectedRegionOnly)
1360 CigarArray selection=null;
1361 SequenceI [] seqs= null;
1363 int start = 0, end = 0;
1364 if(selectedRegionOnly && selectionGroup!=null)
1366 iSize = selectionGroup.getSize(false);
1367 seqs = selectionGroup.getSequencesInOrder(alignment);
1368 start = selectionGroup.getStartRes();
1369 end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor
1373 iSize = alignment.getHeight();
1374 seqs = alignment.getSequencesArray();
1375 end = alignment.getWidth()-1;
1377 SeqCigar[] selseqs = new SeqCigar[iSize];
1378 for(i=0; i<iSize; i++)
1380 selseqs[i] = new SeqCigar(seqs[i], start, end);
1382 selection=new CigarArray(selseqs);
1383 // now construct the CigarArray operations
1384 if (hasHiddenColumns) {
1385 Vector regions = colSel.getHiddenColumns();
1387 int hideStart, hideEnd;
1389 for (int j = 0; last<end & j < regions.size(); j++)
1391 region = (int[]) regions.elementAt(j);
1392 hideStart = region[0];
1393 hideEnd = region[1];
1394 // edit hidden regions to selection range
1395 if(hideStart<last) {
1409 if (hideStart>hideEnd)
1412 * form operations...
1415 selection.addOperation(CigarArray.M, hideStart-last);
1416 selection.addOperation(CigarArray.D, 1+hideEnd-hideStart);
1419 // Final match if necessary.
1421 selection.addOperation(CigarArray.M, end-last+1);
1423 selection.addOperation(CigarArray.M, end-start+1);
1428 * return a compact representation of the current alignment selection to
1429 * pass to an analysis function
1430 * @param selectedOnly boolean true to just return the selected view
1431 * @return AlignmentView
1433 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly) {
1435 // this is here because the AlignmentView constructor modifies the CigarArray
1436 // object. Refactoring of Cigar and alignment view representation should
1437 // be done to remove redundancy.
1438 CigarArray aligview = getViewAsCigars(selectedOnly);
1439 if (aligview!=null) {
1440 return new AlignmentView(aligview,
1441 (selectedOnly && selectionGroup!=null) ? selectionGroup.getStartRes() : 0);
1446 * This method returns the visible alignment as text, as
1447 * seen on the GUI, ie if columns are hidden they will not
1448 * be returned in the result.
1449 * Use this for calculating trees, PCA, redundancy etc on views
1450 * which contain hidden columns.
1453 public String [] getViewAsString(boolean selectedRegionOnly)
1455 String [] selection = null;
1456 SequenceI [] seqs= null;
1458 int start = 0, end = 0;
1459 if(selectedRegionOnly && selectionGroup!=null)
1461 iSize = selectionGroup.getSize(false);
1462 seqs = selectionGroup.getSequencesInOrder(alignment);
1463 start = selectionGroup.getStartRes();
1464 end = selectionGroup.getEndRes()+1;
1468 iSize = alignment.getHeight();
1469 seqs = alignment.getSequencesArray();
1470 end = alignment.getWidth();
1473 selection = new String[iSize];
1474 if (hasHiddenColumns) {
1475 selection = colSel.getVisibleSequenceStrings(start, end, seqs);
1477 for(i=0; i<iSize; i++)
1479 selection[i] = seqs[i].getSequence(start, end);
1486 public boolean getShowHiddenMarkers()
1488 return showHiddenMarkers;
1491 public void setShowHiddenMarkers(boolean show)
1493 showHiddenMarkers = show;
1496 public String getSequenceSetId()
1498 if(sequenceSetID==null)
1499 sequenceSetID = alignment.hashCode()+"";
1501 return sequenceSetID;
1504 public void alignmentChanged(AlignmentPanel ap)
1507 alignment.padGaps();
1509 if (hconsensus != null && autoCalculateConsensus)
1511 updateConsensus(ap);
1512 updateConservation(ap);
1515 resetAllColourSchemes();
1517 alignment.adjustSequenceAnnotations();
1522 void resetAllColourSchemes()
1524 ColourSchemeI cs = globalColourScheme;
1527 if (cs instanceof ClustalxColourScheme)
1529 ( (ClustalxColourScheme) cs).
1530 resetClustalX(alignment.getSequences(),
1531 alignment.getWidth());
1534 cs.setConsensus(hconsensus);
1535 if (cs.conservationApplied())
1537 Alignment al = (Alignment) alignment;
1538 Conservation c = new Conservation("All",
1539 ResidueProperties.propHash, 3,
1540 al.getSequences(), 0,
1543 c.verdict(false, ConsPercGaps);
1545 cs.setConservation(c);
1549 int s, sSize = alignment.getGroups().size();
1550 for(s=0; s<sSize; s++)
1552 SequenceGroup sg = (SequenceGroup)alignment.getGroups().elementAt(s);
1553 if(sg.cs!=null && sg.cs instanceof ClustalxColourScheme)
1555 ((ClustalxColourScheme)sg.cs).resetClustalX(
1556 sg.getSequences(true), sg.getWidth());
1558 sg.recalcConservation();