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 showConservation = true;
55 boolean showQuality = true;
56 boolean showIdentity = true;
57 boolean colourAppliesToAllGroups = true;
58 ColourSchemeI globalColourScheme = null;
59 boolean conservationColourSelected = false;
60 boolean abovePIDThreshold = false;
61 SequenceGroup selectionGroup;
64 boolean validCharWidth;
68 ColumnSelection colSel = new ColumnSelection();
71 NJTree currentTree = null;
72 boolean scaleAboveWrapped = false;
73 boolean scaleLeftWrapped = true;
74 boolean scaleRightWrapped = true;
75 boolean hasHiddenColumns = false;
76 boolean hasHiddenRows = false;
77 boolean showHiddenMarkers = true;
79 boolean cursorMode = false;
81 // The following vector holds the features which are
82 // currently visible, in the correct order or rendering
83 Hashtable featuresDisplayed = null;
87 public Hashtable [] hconsensus;
88 AlignmentAnnotation consensus;
89 AlignmentAnnotation conservation;
90 AlignmentAnnotation quality;
91 boolean autoCalculateConsensus = true;
94 public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!
96 // JBPNote Prolly only need this in the applet version.
97 private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);
99 boolean ignoreGapsInConsensusCalculation = false;
101 boolean isDataset = false;
103 boolean antiAlias = false;
105 boolean padGaps = false;
107 Rectangle explodedPosition;
111 String sequenceSetID;
113 boolean gatherViewsHere = false;
116 public AlignViewport(AlignmentI al, boolean dataset)
123 * Creates a new AlignViewport object.
125 * @param al DOCUMENT ME!
127 public AlignViewport(AlignmentI al)
133 * Create a new AlignViewport with hidden regions
134 * @param al AlignmentI
135 * @param hiddenColumns ColumnSelection
137 public AlignViewport(AlignmentI al, ColumnSelection hiddenColumns) {
139 if (hiddenColumns!=null) {
140 this.colSel = hiddenColumns;
141 if (hiddenColumns.getHiddenColumns() != null)
142 hasHiddenColumns = true;
150 this.endRes = alignment.getWidth() - 1;
152 this.endSeq = alignment.getHeight() - 1;
154 antiAlias = Cache.getDefault("ANTI_ALIAS", false);
156 showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true);
157 showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true);
158 showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
160 showQuality = Cache.getDefault("SHOW_QUALITY", true);
161 showIdentity = Cache.getDefault("SHOW_IDENTITY", true);
163 autoCalculateConsensus = Cache.getDefault("AUTO_CALC_CONSENSUS", true);
165 padGaps = Cache.getDefault("PAD_GAPS", false);
167 String fontName = Cache.getDefault("FONT_NAME", "SansSerif");
168 String fontStyle = Cache.getDefault("FONT_STYLE", Font.PLAIN + "") ;
169 String fontSize = Cache.getDefault("FONT_SIZE", "10");
173 if (fontStyle.equals("bold"))
177 else if (fontStyle.equals("italic"))
182 setFont(new Font(fontName, style, Integer.parseInt(fontSize)));
185 alignment.setGapCharacter( Cache.getDefault("GAP_SYMBOL", "-").charAt(0) );
188 // We must set conservation and consensus before setting colour,
189 // as Blosum and Clustal require this to be done
190 if(hconsensus==null && !isDataset)
192 if(!alignment.isNucleotide())
194 conservation = new AlignmentAnnotation("Conservation",
195 "Conservation of total alignment less than " +
196 ConsPercGaps + "% gaps",
197 new Annotation[1], 0f,
199 AlignmentAnnotation.BAR_GRAPH);
200 conservation.hasText = true;
202 if (showConservation)
204 alignment.addAnnotation(conservation);
209 quality = new AlignmentAnnotation("Quality",
210 "Alignment Quality based on Blosum62 scores",
214 AlignmentAnnotation.BAR_GRAPH);
216 alignment.addAnnotation(quality);
220 consensus = new AlignmentAnnotation("Consensus", "PID",
221 new Annotation[1], 0f, 100f,
222 AlignmentAnnotation.BAR_GRAPH);
223 consensus.hasText = true;
227 alignment.addAnnotation(consensus);
232 if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
234 globalColourScheme = ColourSchemeProperty.getColour(alignment,
235 jalview.bin.Cache.getProperty("DEFAULT_COLOUR"));
237 if (globalColourScheme instanceof UserColourScheme)
239 globalColourScheme = UserDefinedColours.loadDefaultColours();
240 ((UserColourScheme)globalColourScheme).setThreshold(0, getIgnoreGapsConsensus());
243 if (globalColourScheme != null)
245 globalColourScheme.setConsensus(hconsensus);
255 * @param b DOCUMENT ME!
257 public void setShowSequenceFeatures(boolean b)
259 showSequenceFeatures = b;
262 public boolean getShowSequenceFeatures()
264 return showSequenceFeatures;
269 class ConservationThread extends Thread
272 public ConservationThread(AlignmentPanel ap)
281 long t = System.currentTimeMillis();
283 int alWidth = alignment.getWidth();
285 Conservation cons = new jalview.analysis.Conservation("All",
286 jalview.schemes.ResidueProperties.propHash, 3,
287 alignment.getSequences(), 0, alWidth -1);
290 cons.verdict(false, ConsPercGaps);
297 System.out.println("Conservation took " + (System.currentTimeMillis() - t) +
301 String sequence = cons.getConsSequence().getSequence();
313 maxB = 0f - minB; // scalable range for colouring both Conservation and Quality
322 conservation.annotations = new Annotation[alWidth];
326 quality.annotations = new Annotation[alWidth];
327 qmin = cons.qualityRange[0].floatValue();
328 qmax = cons.qualityRange[1].floatValue();
331 for (int i = 0; i < alWidth; i++)
335 c = sequence.charAt(i);
337 if (Character.isDigit(c))
338 value = (int) (c - '0');
344 float vprop = value - min;
346 conservation.annotations[i] =
347 new Annotation(String.valueOf(c),
348 String.valueOf(value), ' ', value,
349 new Color(minR + (maxR * vprop),
350 minG + (maxG * vprop),
351 minB + (maxB * vprop)));
356 value = ( (Double) cons.quality.get(i)).floatValue();
357 vprop = value - qmin;
359 quality.annotations[i] = new Annotation(" ", String.valueOf(value), ' ',
361 new Color(minR + (maxR * vprop),
362 minG + (maxG * vprop),
363 minB + (maxB * vprop)));
369 quality.graphMax = cons.qualityRange[1].floatValue();
372 catch (OutOfMemoryError error)
374 javax.swing.SwingUtilities.invokeLater(new Runnable()
378 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
379 "Out of memory calculating conservation!!"
381 "\nSee help files for increasing Java Virtual Machine memory."
383 javax.swing.JOptionPane.WARNING_MESSAGE);
387 System.out.println("Conservation calculation: " + error);
396 updatingConservation = false;
401 ConservationThread conservationThread;
403 ConsensusThread consensusThread;
405 boolean consUpdateNeeded = false;
407 boolean updatingConsensus = false;
409 boolean updatingConservation = false;
414 public void updateConservation(AlignmentPanel ap)
416 if (alignment.isNucleotide())
419 updatingConservation = true;
421 if (conservationThread == null || !conservationThread.isAlive())
423 conservationThread = new ConservationThread(ap);
424 conservationThread.start();
428 consUpdateNeeded = true;
429 System.out.println("come back later");
436 public void updateConsensus(AlignmentPanel ap)
438 updatingConsensus = true;
440 if (consensusThread == null || !consensusThread.isAlive())
442 consensusThread = new ConsensusThread(ap);
443 consensusThread.start();
447 consUpdateNeeded = true;
448 System.out.println("come back later");
453 class ConsensusThread extends Thread
456 public ConsensusThread(AlignmentPanel ap)
464 int aWidth = alignment.getWidth();
466 consensus.annotations = null;
467 consensus.annotations = new Annotation[aWidth];
469 long t = System.currentTimeMillis();
470 hconsensus = new Hashtable[aWidth];
471 AAFrequency.calculate(alignment.getSequencesArray(),
473 alignment.getWidth(),
476 System.out.println("Consensus took " +
477 (System.currentTimeMillis() - t) + "ms");
479 for (int i = 0; i < aWidth; i++)
482 if (ignoreGapsInConsensusCalculation)
483 value = ( (Float) hconsensus[i].get(AAFrequency.PID_NOGAPS)).
486 value = ( (Float) hconsensus[i].get(AAFrequency.PID_GAPS)).
489 String maxRes = hconsensus[i].get(AAFrequency.MAXRESIDUE).toString();
490 String mouseOver = hconsensus[i].get(AAFrequency.MAXRESIDUE) + " ";
492 if (maxRes.length() > 1)
494 mouseOver = "[" + maxRes + "] ";
498 mouseOver += ( (int) value + "%");
499 consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);
503 if (globalColourScheme != null)
504 globalColourScheme.setConsensus(hconsensus);
507 catch (OutOfMemoryError error)
509 javax.swing.SwingUtilities.invokeLater(new Runnable()
513 javax.swing.JOptionPane.showInternalMessageDialog(Desktop.desktop,
514 "Out of memory calculating consensus!!"
516 "\nSee help files for increasing Java Virtual Machine memory."
518 javax.swing.JOptionPane.WARNING_MESSAGE);
522 System.out.println("Consensus calculation: " + error);
532 updatingConsensus = false;
536 * get the consensus sequence as displayed under the PID consensus annotation row.
537 * @return consensus sequence as a new sequence object
539 public SequenceI getConsensusSeq() {
541 updateConsensus(null);
544 StringBuffer seqs=new StringBuffer();
545 for (int i=0; i<consensus.annotations.length; i++) {
546 if (consensus.annotations[i]!=null) {
547 if (consensus.annotations[i].description.charAt(0) == '[')
548 seqs.append(consensus.annotations[i].description.charAt(1));
550 seqs.append(consensus.annotations[i].displayCharacter);
553 SequenceI sq = new Sequence("Consensus", seqs.toString());
554 sq.setDescription("Percentage Identity Consensus "+((ignoreGapsInConsensusCalculation) ? " without gaps" : ""));
560 * @return DOCUMENT ME!
562 public SequenceGroup getSelectionGroup()
564 return selectionGroup;
570 * @param sg DOCUMENT ME!
572 public void setSelectionGroup(SequenceGroup sg)
580 * @return DOCUMENT ME!
582 public boolean getConservationSelected()
584 return conservationColourSelected;
590 * @param b DOCUMENT ME!
592 public void setConservationSelected(boolean b)
594 conservationColourSelected = b;
600 * @return DOCUMENT ME!
602 public boolean getAbovePIDThreshold()
604 return abovePIDThreshold;
610 * @param b DOCUMENT ME!
612 public void setAbovePIDThreshold(boolean b)
614 abovePIDThreshold = b;
620 * @return DOCUMENT ME!
622 public int getStartRes()
630 * @return DOCUMENT ME!
632 public int getEndRes()
640 * @return DOCUMENT ME!
642 public int getStartSeq()
650 * @param cs DOCUMENT ME!
652 public void setGlobalColourScheme(ColourSchemeI cs)
654 globalColourScheme = cs;
660 * @return DOCUMENT ME!
662 public ColourSchemeI getGlobalColourScheme()
664 return globalColourScheme;
670 * @param res DOCUMENT ME!
672 public void setStartRes(int res)
680 * @param seq DOCUMENT ME!
682 public void setStartSeq(int seq)
690 * @param res DOCUMENT ME!
692 public void setEndRes(int res)
694 if (res > (alignment.getWidth() - 1))
696 // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));
697 res = alignment.getWidth() - 1;
711 * @param seq DOCUMENT ME!
713 public void setEndSeq(int seq)
715 if (seq > alignment.getHeight())
717 seq = alignment.getHeight();
731 * @return DOCUMENT ME!
733 public int getEndSeq()
741 * @param f DOCUMENT ME!
743 public void setFont(Font f)
747 Container c = new Container();
749 java.awt.FontMetrics fm = c.getFontMetrics(font);
750 setCharHeight(fm.getHeight());
751 setCharWidth(fm.charWidth('M'));
752 validCharWidth = true;
758 * @return DOCUMENT ME!
760 public Font getFont()
768 * @param w DOCUMENT ME!
770 public void setCharWidth(int w)
778 * @return DOCUMENT ME!
780 public int getCharWidth()
788 * @param h DOCUMENT ME!
790 public void setCharHeight(int h)
798 * @return DOCUMENT ME!
800 public int getCharHeight()
808 * @param w DOCUMENT ME!
810 public void setWrappedWidth(int w)
812 this.wrappedWidth = w;
818 * @return DOCUMENT ME!
820 public int getWrappedWidth()
829 * @return DOCUMENT ME!
831 public AlignmentI getAlignment()
839 * @param align DOCUMENT ME!
841 public void setAlignment(AlignmentI align)
843 this.alignment = align;
849 * @param state DOCUMENT ME!
851 public void setWrapAlignment(boolean state)
853 wrapAlignment = state;
859 * @param state DOCUMENT ME!
861 public void setShowText(boolean state)
869 * @param state DOCUMENT ME!
871 public void setRenderGaps(boolean state)
879 * @return DOCUMENT ME!
881 public boolean getColourText()
883 return showColourText;
889 * @param state DOCUMENT ME!
891 public void setColourText(boolean state)
893 showColourText = state;
899 * @param state DOCUMENT ME!
901 public void setShowBoxes(boolean state)
909 * @return DOCUMENT ME!
911 public boolean getWrapAlignment()
913 return wrapAlignment;
919 * @return DOCUMENT ME!
921 public boolean getShowText()
929 * @return DOCUMENT ME!
931 public boolean getShowBoxes()
939 * @return DOCUMENT ME!
941 public char getGapCharacter()
943 return getAlignment().getGapCharacter();
949 * @param gap DOCUMENT ME!
951 public void setGapCharacter(char gap)
953 if (getAlignment() != null)
955 getAlignment().setGapCharacter(gap);
962 * @param thresh DOCUMENT ME!
964 public void setThreshold(int thresh)
972 * @return DOCUMENT ME!
974 public int getThreshold()
982 * @param inc DOCUMENT ME!
984 public void setIncrement(int inc)
992 * @return DOCUMENT ME!
994 public int getIncrement()
1003 * @return DOCUMENT ME!
1005 public ColumnSelection getColumnSelection()
1014 * @param tree DOCUMENT ME!
1016 public void setCurrentTree(NJTree tree)
1024 * @return DOCUMENT ME!
1026 public NJTree getCurrentTree()
1034 * @param b DOCUMENT ME!
1036 public void setColourAppliesToAllGroups(boolean b)
1038 colourAppliesToAllGroups = b;
1044 * @return DOCUMENT ME!
1046 public boolean getColourAppliesToAllGroups()
1048 return colourAppliesToAllGroups;
1054 * @return DOCUMENT ME!
1056 public boolean getShowJVSuffix()
1058 return showJVSuffix;
1064 * @param b DOCUMENT ME!
1066 public void setShowJVSuffix(boolean b)
1075 * @return DOCUMENT ME!
1077 public boolean getShowAnnotation()
1079 return showAnnotation;
1085 * @param b DOCUMENT ME!
1087 public void setShowAnnotation(boolean b)
1095 * @return DOCUMENT ME!
1097 public boolean getScaleAboveWrapped()
1099 return scaleAboveWrapped;
1105 * @return DOCUMENT ME!
1107 public boolean getScaleLeftWrapped()
1109 return scaleLeftWrapped;
1115 * @return DOCUMENT ME!
1117 public boolean getScaleRightWrapped()
1119 return scaleRightWrapped;
1125 * @param b DOCUMENT ME!
1127 public void setScaleAboveWrapped(boolean b)
1129 scaleAboveWrapped = b;
1135 * @param b DOCUMENT ME!
1137 public void setScaleLeftWrapped(boolean b)
1139 scaleLeftWrapped = b;
1145 * @param b DOCUMENT ME!
1147 public void setScaleRightWrapped(boolean b)
1149 scaleRightWrapped = b;
1153 * Property change listener for changes in alignment
1155 * @param listener DOCUMENT ME!
1157 public void addPropertyChangeListener(
1158 java.beans.PropertyChangeListener listener)
1160 changeSupport.addPropertyChangeListener(listener);
1166 * @param listener DOCUMENT ME!
1168 public void removePropertyChangeListener(
1169 java.beans.PropertyChangeListener listener)
1171 changeSupport.removePropertyChangeListener(listener);
1175 * Property change listener for changes in alignment
1177 * @param prop DOCUMENT ME!
1178 * @param oldvalue DOCUMENT ME!
1179 * @param newvalue DOCUMENT ME!
1181 public void firePropertyChange(String prop, Object oldvalue, Object newvalue)
1183 changeSupport.firePropertyChange(prop, oldvalue, newvalue);
1186 public void setIgnoreGapsConsensus(boolean b, AlignmentPanel ap)
1188 ignoreGapsInConsensusCalculation = b;
1189 updateConsensus(ap);
1190 if(globalColourScheme!=null)
1192 globalColourScheme.setThreshold(globalColourScheme.getThreshold(), ignoreGapsInConsensusCalculation);
1196 public boolean getIgnoreGapsConsensus()
1198 return ignoreGapsInConsensusCalculation;
1201 public void setDataset(boolean b)
1206 public boolean isDataset()
1212 public void hideSelectedColumns()
1214 if (colSel.size() < 1)
1217 colSel.hideSelectedColumns();
1218 setSelectionGroup(null);
1220 hasHiddenColumns = true;
1224 public void hideColumns(int start, int end)
1227 colSel.hideColumns(start);
1229 colSel.hideColumns(start, end);
1231 hasHiddenColumns = true;
1234 public void hideAllSelectedSeqs()
1236 if (selectionGroup == null)
1239 SequenceI[] seqs = selectionGroup.getSequencesInOrder(alignment);
1243 setSelectionGroup(null);
1246 public void hideSequence(SequenceI [] seq)
1250 for (int i = 0; i < seq.length; i++)
1251 alignment.getHiddenSequences().hideSequence(seq[i]);
1253 hasHiddenRows = true;
1254 firePropertyChange("alignment", null, alignment.getSequences());
1258 public void showSequence(int index)
1260 Vector tmp = alignment.getHiddenSequences().showSequence(index);
1263 if(selectionGroup==null)
1265 selectionGroup = new SequenceGroup();
1266 selectionGroup.setEndRes(alignment.getWidth()-1);
1269 for (int t = 0; t < tmp.size(); t++)
1271 selectionGroup.addSequence(
1272 (SequenceI) tmp.elementAt(t), false
1275 firePropertyChange("alignment", null, alignment.getSequences());
1278 if(alignment.getHiddenSequences().getSize()<1)
1279 hasHiddenRows = false;
1282 public void showColumn(int col)
1284 colSel.revealHiddenColumns(col);
1285 if(colSel.getHiddenColumns()==null)
1286 hasHiddenColumns = false;
1289 public void showAllHiddenColumns()
1291 colSel.revealAllHiddenColumns();
1292 hasHiddenColumns = false;
1295 public void showAllHiddenSeqs()
1297 if(alignment.getHiddenSequences().getSize()>0)
1299 if(selectionGroup==null)
1301 selectionGroup = new SequenceGroup();
1302 selectionGroup.setEndRes(alignment.getWidth()-1);
1304 Vector tmp = alignment.getHiddenSequences().showAll();
1305 for(int t=0; t<tmp.size(); t++)
1307 selectionGroup.addSequence(
1308 (SequenceI)tmp.elementAt(t), false
1311 firePropertyChange("alignment", null, alignment.getSequences());
1312 hasHiddenRows = false;
1316 public void invertColumnSelection()
1319 for(int i=0; i<alignment.getWidth(); i++)
1323 if(colSel.contains(column))
1324 colSel.removeElement(column);
1326 colSel.addElement(column);
1332 public int adjustForHiddenSeqs(int alignmentIndex)
1334 return alignment.getHiddenSequences().adjustForHiddenSeqs(alignmentIndex);
1338 * This method returns the a new SequenceI [] with
1339 * the selection sequence and start and end points adjusted
1342 public SequenceI[] getSelectionAsNewSequence()
1344 SequenceI[] sequences;
1346 if (selectionGroup == null)
1347 sequences = alignment.getSequencesArray();
1349 sequences = selectionGroup.getSelectionAsNewSequences(alignment);
1355 * This method returns the visible alignment as text, as
1356 * seen on the GUI, ie if columns are hidden they will not
1357 * be returned in the result.
1358 * Use this for calculating trees, PCA, redundancy etc on views
1359 * which contain hidden columns.
1362 public jalview.datamodel.CigarArray getViewAsCigars(boolean selectedRegionOnly)
1364 CigarArray selection=null;
1365 SequenceI [] seqs= null;
1367 int start = 0, end = 0;
1368 if(selectedRegionOnly && selectionGroup!=null)
1370 iSize = selectionGroup.getSize(false);
1371 seqs = selectionGroup.getSequencesInOrder(alignment);
1372 start = selectionGroup.getStartRes();
1373 end = selectionGroup.getEndRes(); // inclusive for start and end in SeqCigar constructor
1377 iSize = alignment.getHeight();
1378 seqs = alignment.getSequencesArray();
1379 end = alignment.getWidth()-1;
1381 SeqCigar[] selseqs = new SeqCigar[iSize];
1382 for(i=0; i<iSize; i++)
1384 selseqs[i] = new SeqCigar(seqs[i], start, end);
1386 selection=new CigarArray(selseqs);
1387 // now construct the CigarArray operations
1388 if (hasHiddenColumns) {
1389 Vector regions = colSel.getHiddenColumns();
1391 int hideStart, hideEnd;
1393 for (int j = 0; last<end & j < regions.size(); j++)
1395 region = (int[]) regions.elementAt(j);
1396 hideStart = region[0];
1397 hideEnd = region[1];
1398 // edit hidden regions to selection range
1399 if(hideStart<last) {
1413 if (hideStart>hideEnd)
1416 * form operations...
1419 selection.addOperation(CigarArray.M, hideStart-last);
1420 selection.addOperation(CigarArray.D, 1+hideEnd-hideStart);
1423 // Final match if necessary.
1425 selection.addOperation(CigarArray.M, end-last+1);
1427 selection.addOperation(CigarArray.M, end-start+1);
1432 * return a compact representation of the current alignment selection to
1433 * pass to an analysis function
1434 * @param selectedOnly boolean true to just return the selected view
1435 * @return AlignmentView
1437 jalview.datamodel.AlignmentView getAlignmentView(boolean selectedOnly) {
1439 // this is here because the AlignmentView constructor modifies the CigarArray
1440 // object. Refactoring of Cigar and alignment view representation should
1441 // be done to remove redundancy.
1442 CigarArray aligview = getViewAsCigars(selectedOnly);
1443 if (aligview!=null) {
1444 return new AlignmentView(aligview,
1445 (selectedOnly && selectionGroup!=null) ? selectionGroup.getStartRes() : 0);
1450 * This method returns the visible alignment as text, as
1451 * seen on the GUI, ie if columns are hidden they will not
1452 * be returned in the result.
1453 * Use this for calculating trees, PCA, redundancy etc on views
1454 * which contain hidden columns.
1457 public String [] getViewAsString(boolean selectedRegionOnly)
1459 String [] selection = null;
1460 SequenceI [] seqs= null;
1462 int start = 0, end = 0;
1463 if(selectedRegionOnly && selectionGroup!=null)
1465 iSize = selectionGroup.getSize(false);
1466 seqs = selectionGroup.getSequencesInOrder(alignment);
1467 start = selectionGroup.getStartRes();
1468 end = selectionGroup.getEndRes()+1;
1472 iSize = alignment.getHeight();
1473 seqs = alignment.getSequencesArray();
1474 end = alignment.getWidth();
1477 selection = new String[iSize];
1478 if (hasHiddenColumns) {
1479 selection = colSel.getVisibleSequenceStrings(start, end, seqs);
1481 for(i=0; i<iSize; i++)
1483 selection[i] = seqs[i].getSequence(start, end);
1490 public boolean getShowHiddenMarkers()
1492 return showHiddenMarkers;
1495 public void setShowHiddenMarkers(boolean show)
1497 showHiddenMarkers = show;
1500 public String getSequenceSetId()
1502 if(sequenceSetID==null)
1503 sequenceSetID = alignment.hashCode()+"";
1505 return sequenceSetID;