label.invalid_name = Invalid Name !
label.output_seq_details = Output Sequence Details to list all database references
label.urllinks = Links
-label.togglehidden = Toggle hidden columns on/off
\ No newline at end of file
+label.togglehidden = Toggle hidden regions on/off
\ No newline at end of file
label.invalid_name = Nombre inválido !
label.output_seq_details = Seleccionar Detalles de la secuencia para ver todas
label.urllinks = Enlaces
-label.togglehidden = Toggle hidden columns on/off
\ No newline at end of file
+label.togglehidden = Toggle hidden regions on/off
\ No newline at end of file
copiedHiddenColumns = new Vector();
int hiddenOffset = viewport.getSelectionGroup().getStartRes();
for (int[] region : viewport.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
copiedHiddenColumns.addElement(new int[] {
region[0] - hiddenOffset, region[1] - hiddenOffset });
HiddenColumns oldHidden = av
.getAnnotationColumnSelectionState()
.getOldHiddenColumns();
- if (oldHidden != null && oldHidden.getListOfCols() != null
- && !oldHidden.getListOfCols().isEmpty())
+ if (oldHidden != null && oldHidden.getHiddenRegions() != null
+ && !oldHidden.getHiddenRegions().isEmpty())
{
- for (Iterator<int[]> itr = oldHidden.getListOfCols()
+ for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
.iterator(); itr.hasNext();)
{
int positions[] = itr.next();
{
jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();
for (int[] region : av.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
jalview.appletgui.AlignFrame.copiedHiddenColumns
.addElement(new int[] { region[0], region[1] });
private void mouseAction(MouseEvent evt)
{
od.updateViewportFromMouse(evt.getX(), evt.getY(), av.getAlignment()
- .getHiddenSequences(), av.getAlignment().getHiddenColumns(), av
- .getRanges());
+ .getHiddenSequences(), av.getAlignment().getHiddenColumns());
ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
ap.paintAlignment(false);
}
}
setSize(new Dimension(od.getWidth(), od.getHeight()));
- if (updateRunning)
+ synchronized (this)
{
- oviewCanvas.restartDraw();
- return;
- }
+ if (updateRunning)
+ {
+ oviewCanvas.restartDraw();
+ return;
+ }
- updateRunning = true;
+ updateRunning = true;
+ }
Thread thread = new Thread(this);
thread.start();
repaint();
{
od.setBoxPosition(av.getAlignment()
.getHiddenSequences(), av
- .getAlignment().getHiddenColumns(), av.getRanges());
+ .getAlignment().getHiddenColumns());
repaint();
}
}
reveal = null;
for (int[] region : av.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
if (res + 1 == region[0] || res - 1 == region[1])
{
if (av.getShowHiddenMarkers())
{
int widthx = 1 + endx - startx;
- for (int i = 0; i < hidden.getListOfCols().size(); i++)
+ for (int i = 0; i < hidden.getHiddenRegions().size(); i++)
{
res = hidden.findHiddenRegionPosition(i) - startx;
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
g.setColor(Color.blue);
int res;
- for (int i = 0; i < hidden.getListOfCols()
+ for (int i = 0; i < hidden.getHiddenRegions()
.size(); i++)
{
res = hidden.findHiddenRegionPosition(i)
if (av.hasHiddenColumns())
{
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- for (int[] region : hidden.getListOfCols())
+ for (int[] region : hidden.getHiddenRegions())
{
int hideStart = region[0];
int hideEnd = region[1];
if (copycolsel
&& av.hasHiddenColumns()
&& (av.getColumnSelection() == null || av.getAlignment()
- .getHiddenColumns().getListOfCols() == null))
+ .getHiddenColumns().getHiddenRegions() == null))
{
System.err.println("Bad things");
}
{
this(constructSeqCigarArray(alignment, selectionGroup));
constructFromAlignment(alignment,
- hidden != null ? hidden.getListOfCols()
+ hidden != null ? hidden.getHiddenRegions()
: null, selectionGroup);
}
*
* @return empty list or List of hidden column intervals
*/
- public List<int[]> getListOfCols()
+ public List<int[]> getHiddenRegions()
{
return hiddenColumns == null ? Collections.<int[]> emptyList()
: hiddenColumns;
}
+ /**
+ * Find the number of hidden columns
+ *
+ * @return number of hidden columns
+ */
+ public int getSize()
+ {
+ int size = 0;
+ if (hasHidden())
+ {
+ for (int[] range : hiddenColumns)
+ {
+ size += range[1] - range[0] + 1;
+ }
+ }
+ return size;
+ }
+
+ /**
+ * Answers if there are any hidden columns
+ *
+ * @return true if there are hidden columns
+ */
public boolean hasHidden()
{
return (hiddenColumns != null) && (!hiddenColumns.isEmpty());
if (hiddenColumns != null && hiddenColumns.size() > 0)
{
List<int[]> visiblecontigs = new ArrayList<int[]>();
- List<int[]> regions = getListOfCols();
+ List<int[]> regions = getHiddenRegions();
int vstart = start;
int[] region;
for (i = 0; i < iSize; i++)
{
StringBuffer visibleSeq = new StringBuffer();
- List<int[]> regions = getListOfCols();
+ List<int[]> regions = getHiddenRegions();
int blockStart = start, blockEnd = end;
int[] region;
// Simply walk along the sequence whilst watching for hidden column
// boundaries
- List<int[]> regions = getListOfCols();
+ List<int[]> regions = getHiddenRegions();
int spos = fpos, lastvispos = -1, rcount = 0, hideStart = seq
.getLength(), hideEnd = -1;
int visPrev = 0, visNext = 0, firstP = -1, lastP = -1;
// then mangle the alignmentAnnotation annotation array
Vector<Annotation[]> annels = new Vector<Annotation[]>();
Annotation[] els = null;
- List<int[]> regions = getListOfCols();
+ List<int[]> regions = getHiddenRegions();
int blockStart = start, blockEnd = end;
int[] region;
int hideStart, hideEnd, w = 0;
last = lastcol;
current = firstcol;
next = firstcol;
- hidden = hiddenCols.getListOfCols();
+ hidden = hiddenCols.getHiddenRegions();
lasthiddenregion = -1;
if (hidden != null)
@Override
public SequenceI getSequence(int seq)
{
- return alignment.getSequenceAt(seq);
+ return alignment.getSequenceAtAbsoluteIndex(seq);
}
}
current = firstrow;
last = lastrow;
hidden = al.getHiddenSequences();
- while (hidden.isHidden(last) && last > current)
+ while (last > current && hidden.isHidden(last))
{
last--;
}
current = firstrow;
- while (hidden.isHidden(current) && current < last)
+ while (current < last && hidden.isHidden(current))
{
current++;
}
do
{
next++;
- } while (hidden.isHidden(next) && next <= last);
+ } while (next <= last && hidden.isHidden(next));
return current;
}
alignmentStartEnd = alignmentToExport
.getVisibleStartAndEndIndex(viewport.getAlignment()
.getHiddenColumns()
- .getListOfCols());
+ .getHiddenRegions());
AlignmentExportData ed = new AlignmentExportData(alignmentToExport,
omitHidden, alignmentStartEnd, settings);
return ed;
int hiddenOffset = viewport.getSelectionGroup().getStartRes(), hiddenCutoff = viewport
.getSelectionGroup().getEndRes();
for (int[] region : viewport.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
if (region[0] >= hiddenOffset && region[1] <= hiddenCutoff)
{
HiddenColumns oldHidden = av
.getAnnotationColumnSelectionState()
.getOldHiddenColumns();
- if (oldHidden != null && oldHidden.getListOfCols() != null
- && !oldHidden.getListOfCols().isEmpty())
+ if (oldHidden != null && oldHidden.getHiddenRegions() != null
+ && !oldHidden.getHiddenRegions().isEmpty())
{
- for (Iterator<int[]> itr = oldHidden.getListOfCols()
+ for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
.iterator(); itr.hasNext();)
{
int positions[] = itr.next();
int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 };
List<int[]> hiddenCols = av.getAlignment().getHiddenColumns()
- .getListOfCols();
+ .getHiddenRegions();
if (hiddenCols != null)
{
alignmentStartEnd = av.getAlignment().getVisibleStartAndEndIndex(
{
hiddenColumns = new ArrayList<int[]>();
for (int[] region : av.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
hiddenColumns.add(new int[] { region[0], region[1] });
}
{
jalview.datamodel.HiddenColumns hidden = av.getAlignment()
.getHiddenColumns();
- if (hidden == null || hidden.getListOfCols() == null)
+ if (hidden == null || hidden.getHiddenRegions() == null)
{
warn("REPORT BUG: avoided null columnselection bug (DMAM reported). Please contact Jim about this.");
}
else
{
- for (int c = 0; c < hidden.getListOfCols()
+ for (int c = 0; c < hidden.getHiddenRegions()
.size(); c++)
{
- int[] region = hidden.getListOfCols()
+ int[] region = hidden.getHiddenRegions()
.get(c);
HiddenColumns hc = new HiddenColumns();
hc.setStart(region[0]);
setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
OverviewRenderer or = new OverviewRenderer(sr, finder, od);
- miniMe = or.draw(od.getRows(av.getRanges(), av.getAlignment()),
- od
- .getColumns(av.getRanges(), av.getAlignment()
- .getHiddenColumns()));
+ miniMe = or.draw(od.getRows(av.getAlignment()),
+ od.getColumns(av.getAlignment().getHiddenColumns()));
Graphics mg = miniMe.getGraphics();
mg.translate(0, od.getSequencesHeight());
or.drawGraph(mg, av.getAlignmentConservationAnnotation(),
av.getCharWidth(), od.getGraphHeight(),
- od.getColumns(
- av.getRanges(), av.getAlignment().getHiddenColumns()));
+ od.getColumns(av.getAlignment().getHiddenColumns()));
mg.translate(0, -od.getSequencesHeight());
}
System.gc();
{
od.updateViewportFromMouse(evt.getX(), evt.getY(), av
.getAlignment().getHiddenSequences(), av.getAlignment()
- .getHiddenColumns(), av.getRanges());
+ .getHiddenColumns());
ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
}
}
{
od.updateViewportFromMouse(evt.getX(), evt.getY(), av
.getAlignment().getHiddenSequences(), av.getAlignment()
- .getHiddenColumns(), av.getRanges());
+ .getHiddenColumns());
ap.setScrollValues(od.getScrollCol(), od.getScrollRow());
}
}
od.setWidth(getWidth());
od.setHeight(getHeight());
}
-
+
setPreferredSize(new Dimension(od.getWidth(), od.getHeight()));
if (oviewCanvas.restartDraw())
*/
public void setBoxPosition()
{
- od.setBoxPosition(av.getAlignment()
-.getHiddenSequences(), av
- .getAlignment().getHiddenColumns(), av.getRanges());
+ od.setBoxPosition(av.getAlignment().getHiddenSequences(), av
+ .getAlignment().getHiddenColumns());
repaint();
}
}
res = av.getAlignment().getHiddenColumns().adjustForHiddenColumns(res);
- if (av.getAlignment().getHiddenColumns().getListOfCols() != null)
+ if (av.getAlignment().getHiddenColumns().getHiddenRegions() != null)
{
for (int[] region : av.getAlignment().getHiddenColumns()
- .getListOfCols())
+ .getHiddenRegions())
{
if (res + 1 == region[0] || res - 1 == region[1])
{
gg.setColor(Color.blue);
int res;
- if (av.getShowHiddenMarkers() && hidden.getListOfCols() != null)
+ if (av.getShowHiddenMarkers() && hidden.getHiddenRegions() != null)
{
- for (int i = 0; i < hidden.getListOfCols()
+ for (int i = 0; i < hidden.getHiddenRegions()
.size(); i++)
{
res = hidden.findHiddenRegionPosition(i)
g.setColor(Color.blue);
int res;
HiddenColumns hidden = av.getAlignment().getHiddenColumns();
- for (int i = 0; i < hidden.getListOfCols().size(); i++)
+ for (int i = 0; i < hidden.getHiddenRegions().size(); i++)
{
res = hidden.findHiddenRegionPosition(i) - startRes;
else
{
List<int[]> regions = av.getAlignment().getHiddenColumns()
- .getListOfCols();
+ .getHiddenRegions();
int screenY = 0;
int blockStart = startRes;
if (copycolsel
&& av.hasHiddenColumns()
&& (av.getAlignment().getHiddenColumns() == null || av
- .getAlignment().getHiddenColumns().getListOfCols() == null))
+ .getAlignment().getHiddenColumns().getHiddenRegions() == null))
{
System.err.println("Bad things");
}
if (cs != null && cs.hasHiddenColumns())
{
text.append("VIEW_HIDECOLS\t");
- List<int[]> hc = cs.getListOfCols();
+ List<int[]> hc = cs.getHiddenRegions();
boolean comma = false;
for (int[] r : hc)
{
{
List<int[]> hiddenCols = getViewport().getAlignment()
.getHiddenColumns()
- .getListOfCols();
+ .getHiddenRegions();
StringBuilder hiddenColsBuilder = new StringBuilder();
for (int[] range : hiddenCols)
{
toSequences, fromGapChar);
}
- for (int[] hidden : hiddencols.getListOfCols())
+ for (int[] hidden : hiddencols.getHiddenRegions())
{
mapHiddenColumns(hidden, codonFrames, newHidden, fromSequences,
toSequences, fromGapChar);
public float getPixelsPerCol()
{
+ resetAlignmentDims();
return (float) width / alwidth;
}
public float getPixelsPerSeq()
{
+ resetAlignmentDims();
return (float) sequencesHeight / alheight;
}
* the alignment's hidden sequences
* @param hiddenCols
* the alignment's hidden columns
- * @param ranges
- * the alignment's width and height ranges
*/
public abstract void updateViewportFromMouse(int mousex, int mousey,
- HiddenSequences hiddenSeqs, HiddenColumns hiddenCols,
- ViewportRanges ranges);
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols);
/**
* Set the overview panel's box position to match the viewport
* the alignment's hidden sequences
* @param hiddenCols
* the alignment's hidden columns
- * @param ranges
- * the alignment's width and height ranges
*/
public abstract void setBoxPosition(HiddenSequences hiddenSeqs,
- HiddenColumns hiddenCols, ViewportRanges ranges);
+ HiddenColumns hiddenCols);
/**
* Get the collection of columns used by this overview dimensions object
*
- * @param ranges
- * the alignment's width and height ranges
* @param hiddenCols
* the alignment's hidden columns
* @return a column collection
*/
public abstract AlignmentColsCollectionI getColumns(
- ViewportRanges ranges, HiddenColumns hiddenCols);
+ HiddenColumns hiddenCols);
/**
* Get the collection of rows used by this overview dimensions object
*
- * @param ranges
- * the alignment's width and height ranges
* @param al
* the alignment
* @return a row collection
*/
- public abstract AlignmentRowsCollectionI getRows(
- ViewportRanges ranges, AlignmentI al);
+ public abstract AlignmentRowsCollectionI getRows(AlignmentI al);
+
+ /**
+ * Updates overview dimensions to account for current alignment dimensions
+ */
+ protected abstract void resetAlignmentDims();
}
\ No newline at end of file
public class OverviewDimensionsAllVisible extends OverviewDimensions
{
+ private ViewportRanges alRanges;
+
public OverviewDimensionsAllVisible(ViewportRanges ranges,
boolean showAnnotationPanel)
{
super(ranges, showAnnotationPanel);
-
- alwidth = ranges.getVisibleAlignmentWidth();
- alheight = ranges.getVisibleAlignmentHeight();
+ alRanges = ranges;
+ resetAlignmentDims();
}
@Override
public void updateViewportFromMouse(int mousex, int mousey,
- HiddenSequences hiddenSeqs, HiddenColumns hiddenCols,
- ViewportRanges ranges)
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
{
+ resetAlignmentDims();
+
int x = mousex;
int y = mousey;
- alwidth = ranges.getVisibleAlignmentWidth();
- alheight = ranges.getVisibleAlignmentHeight();
-
if (x < 0)
{
x = 0;
int xAsRes = Math.round((float) x * alwidth / width);
// get viewport width in residues
- int vpwidth = ranges.getEndRes() - ranges.getStartRes() + 1;
+ int vpwidth = alRanges.getEndRes() - alRanges.getStartRes() + 1;
if (xAsRes + vpwidth > alwidth)
{
// get viewport height in sequences
// add 1 because height includes both endSeq and startSeq
- int vpheight = ranges.getEndSeq() - ranges.getStartSeq() + 1;
+ int vpheight = alRanges.getEndSeq() - alRanges.getStartSeq() + 1;
if (yAsSeq + vpheight > alheight)
{
@Override
public void setBoxPosition(HiddenSequences hiddenSeqs,
- HiddenColumns hiddenCols, ViewportRanges ranges)
+ HiddenColumns hiddenCols)
{
- alwidth = ranges.getVisibleAlignmentWidth();
- alheight = ranges.getVisibleAlignmentHeight();
+ resetAlignmentDims();
// work with visible values of startRes and endRes
- int startRes = ranges.getStartRes();
- int endRes = ranges.getEndRes();
+ int startRes = alRanges.getStartRes();
+ int endRes = alRanges.getEndRes();
// work with visible values of startSeq and endSeq
- int startSeq = ranges.getStartSeq();
- int endSeq = ranges.getEndSeq();
+ int startSeq = alRanges.getStartSeq();
+ int endSeq = alRanges.getEndSeq();
// boxX, boxY is the x,y location equivalent to startRes, startSeq
boxX = Math.round((float) startRes * width / alwidth);
}
@Override
- public AlignmentColsCollectionI getColumns(ViewportRanges ranges,
- HiddenColumns hiddenCols)
+ public AlignmentColsCollectionI getColumns(HiddenColumns hiddenCols)
{
return new VisibleColsCollection(0,
- ranges.getVisibleAlignmentWidth() - 1, hiddenCols);
+ alRanges.getAbsoluteAlignmentWidth() - 1, hiddenCols);
}
@Override
- public AlignmentRowsCollectionI getRows(ViewportRanges ranges,
- AlignmentI al)
+ public AlignmentRowsCollectionI getRows(AlignmentI al)
{
return new VisibleRowsCollection(0,
- ranges.getVisibleAlignmentHeight() - 1, al);
+ alRanges.getAbsoluteAlignmentHeight() - 1, al);
+ }
+
+ @Override
+ protected void resetAlignmentDims()
+ {
+ alwidth = alRanges.getVisibleAlignmentWidth();
+ alheight = alRanges.getVisibleAlignmentHeight();
}
}
public class OverviewDimensionsWithHidden extends OverviewDimensions
{
+ private ViewportRanges alRanges;
+
/**
* Create an OverviewDimensions object
*
boolean showAnnotationPanel)
{
super(ranges, showAnnotationPanel);
-
- alwidth = ranges.getAbsoluteAlignmentWidth();
- alheight = ranges.getAbsoluteAlignmentHeight();
+ alRanges = ranges;
+ resetAlignmentDims();
}
/**
*/
@Override
public void updateViewportFromMouse(int mousex, int mousey,
- HiddenSequences hiddenSeqs, HiddenColumns hiddenCols,
- ViewportRanges ranges)
+ HiddenSequences hiddenSeqs, HiddenColumns hiddenCols)
{
int x = mousex;
int y = mousey;
- alwidth = ranges.getAbsoluteAlignmentWidth();
- alheight = ranges.getAbsoluteAlignmentHeight();
+ resetAlignmentDims();
if (x < 0)
{
int xAsRes = Math.round((float) x * alwidth / width);
// get viewport width in residues
- int vpwidth = ranges.getEndRes() - ranges.getStartRes() + 1;
+ int vpwidth = alRanges.getEndRes() - alRanges.getStartRes() + 1;
// get where x should be when accounting for hidden cols
// if x is in a hidden col region, shift to left - but we still need
// get viewport height in sequences
// add 1 because height includes both endSeq and startSeq
- int vpheight = ranges.getEndSeq() - ranges.getStartSeq() + 1;
+ int vpheight = alRanges.getEndSeq() - alRanges.getStartSeq() + 1;
// get where y should be when accounting for hidden rows
// if y is in a hidden row region, shift up - but we still need absolute
*/
@Override
public void setBoxPosition(HiddenSequences hiddenSeqs,
- HiddenColumns hiddenCols, ViewportRanges ranges)
+ HiddenColumns hiddenCols)
{
- alwidth = ranges.getAbsoluteAlignmentWidth();
- alheight = ranges.getAbsoluteAlignmentHeight();
+ resetAlignmentDims();
// work with absolute values of startRes and endRes
- int startRes = hiddenCols.adjustForHiddenColumns(ranges.getStartRes());
- int endRes = hiddenCols.adjustForHiddenColumns(ranges.getEndRes());
+ int startRes = hiddenCols
+ .adjustForHiddenColumns(alRanges.getStartRes());
+ int endRes = hiddenCols.adjustForHiddenColumns(alRanges.getEndRes());
// work with absolute values of startSeq and endSeq
- int startSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getStartSeq());
- int endSeq = hiddenSeqs.adjustForHiddenSeqs(ranges.getEndSeq());
+ int startSeq = hiddenSeqs.adjustForHiddenSeqs(alRanges.getStartSeq());
+ int endSeq = hiddenSeqs.adjustForHiddenSeqs(alRanges.getEndSeq());
// boxX, boxY is the x,y location equivalent to startRes, startSeq
boxX = Math.round((float) startRes * width / alwidth);
}
@Override
- public AlignmentColsCollectionI getColumns(ViewportRanges ranges,
- HiddenColumns hiddenCols)
+ public AlignmentColsCollectionI getColumns(HiddenColumns hiddenCols)
{
return new AllColsCollection(0,
- ranges.getAbsoluteAlignmentWidth() - 1,
+ alRanges.getAbsoluteAlignmentWidth() - 1,
hiddenCols);
}
@Override
- public AlignmentRowsCollectionI getRows(ViewportRanges ranges,
- AlignmentI al)
+ public AlignmentRowsCollectionI getRows(AlignmentI al)
{
return new AllRowsCollection(0,
- ranges.getAbsoluteAlignmentHeight() - 1,
+ alRanges.getAbsoluteAlignmentHeight() - 1,
al);
}
+
+ @Override
+ protected void resetAlignmentDims()
+ {
+ alwidth = alRanges.getAbsoluteAlignmentWidth();
+ alheight = alRanges.getAbsoluteAlignmentHeight();
+ }
}
*/
public int getVisibleAlignmentWidth()
{
- // TODO need access to hidden columns here
- return al.getWidth(); // - hidden columns
+ return al.getWidth() - al.getHiddenColumns().getSize();
}
/**
// hide column 5 (and adjacent):
cs.hideSelectedColumns(5, al.getHiddenColumns());
// 4,5,6 now hidden:
- List<int[]> hidden = al.getHiddenColumns().getListOfCols();
+ List<int[]> hidden = al.getHiddenColumns().getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[4, 6]", Arrays.toString(hidden.get(0)));
// none now selected:
cs.addElement(5);
cs.addElement(6);
cs.hideSelectedColumns(4, al.getHiddenColumns());
- hidden = al.getHiddenColumns().getListOfCols();
+ hidden = al.getHiddenColumns().getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[4, 6]", Arrays.toString(hidden.get(0)));
assertTrue(cs.getSelected().isEmpty());
cs.addElement(5);
cs.addElement(6);
cs.hideSelectedColumns(6, al.getHiddenColumns());
- hidden = al.getHiddenColumns().getListOfCols();
+ hidden = al.getHiddenColumns().getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[4, 6]", Arrays.toString(hidden.get(0)));
assertTrue(cs.getSelected().isEmpty());
cs.addElement(4);
cs.addElement(6);
cs.hideSelectedColumns(5, al.getHiddenColumns());
- hidden = al.getHiddenColumns().getListOfCols();
+ hidden = al.getHiddenColumns().getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[4, 6]", Arrays.toString(hidden.get(0)));
assertTrue(cs.getSelected().isEmpty());
cs.hideSelectedColumns(al);
assertTrue(cs.getSelected().isEmpty());
- List<int[]> hidden = cols.getListOfCols();
+ List<int[]> hidden = cols.getHiddenRegions();
assertEquals(4, hidden.size());
assertEquals("[2, 4]", Arrays.toString(hidden.get(0)));
assertEquals("[7, 9]", Arrays.toString(hidden.get(1)));
}
/**
+ * Test the method which counts the number of hidden columns
+ */
+ @Test(groups = { "Functional" })
+ public void testGetSize()
+ {
+ HiddenColumns hidden = new HiddenColumns();
+ assertEquals(0, hidden.getSize());
+
+ hidden.hideColumns(3, 5);
+ assertEquals(3, hidden.getSize());
+
+ hidden.hideColumns(8, 8);
+ assertEquals(4, hidden.getSize());
+
+ hidden.hideColumns(9, 14);
+ assertEquals(10, hidden.getSize());
+
+ ColumnSelection cs = new ColumnSelection();
+ hidden.revealAllHiddenColumns(cs);
+ assertEquals(0, hidden.getSize());
+ }
+
+ /**
* Test the method that finds the visible column position of an alignment
* column, allowing for hidden columns.
*/
HiddenColumns cs = new HiddenColumns();
cs.hideColumns(10, 11);
cs.hideColumns(5, 7);
- assertEquals("[5, 7]", Arrays.toString(cs.getListOfCols().get(0)));
+ assertEquals("[5, 7]", Arrays.toString(cs.getHiddenRegions().get(0)));
HiddenColumns cs2 = new HiddenColumns(cs);
assertTrue(cs2.hasHiddenColumns());
- assertEquals(2, cs2.getListOfCols().size());
+ assertEquals(2, cs2.getHiddenRegions().size());
// hidden columns are held in column order
- assertEquals("[5, 7]", Arrays.toString(cs2.getListOfCols().get(0)));
- assertEquals("[10, 11]", Arrays.toString(cs2.getListOfCols().get(1)));
+ assertEquals("[5, 7]", Arrays.toString(cs2.getHiddenRegions().get(0)));
+ assertEquals("[10, 11]", Arrays.toString(cs2.getHiddenRegions().get(1)));
}
/**
ColumnSelection colsel = new ColumnSelection();
HiddenColumns cs = al.getHiddenColumns();
colsel.hideSelectedColumns(5, al.getHiddenColumns());
- List<int[]> hidden = cs.getListOfCols();
+ List<int[]> hidden = cs.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[5, 5]", Arrays.toString(hidden.get(0)));
colsel.hideSelectedColumns(3, al.getHiddenColumns());
assertEquals(2, hidden.size());
// two hidden ranges, in order:
- assertSame(hidden, cs.getListOfCols());
+ assertSame(hidden, cs.getHiddenRegions());
assertEquals("[3, 3]", Arrays.toString(hidden.get(0)));
assertEquals("[5, 5]", Arrays.toString(hidden.get(1)));
// hiding column 4 expands [3, 3] to [3, 4]
// and merges to [5, 5] to make [3, 5]
colsel.hideSelectedColumns(4, al.getHiddenColumns());
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[3, 5]", Arrays.toString(hidden.get(0)));
// clear hidden columns (note they are added to selected)
cs.revealAllHiddenColumns(colsel);
// it is now actually null but getter returns an empty list
- assertTrue(cs.getListOfCols().isEmpty());
+ assertTrue(cs.getHiddenRegions().isEmpty());
cs.hideColumns(3, 6);
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
int[] firstHiddenRange = hidden.get(0);
assertEquals("[3, 6]", Arrays.toString(firstHiddenRange));
// adding a subrange of already hidden should do nothing
cs.hideColumns(4, 5);
assertEquals(1, hidden.size());
- assertSame(firstHiddenRange, cs.getListOfCols().get(0));
+ assertSame(firstHiddenRange, cs.getHiddenRegions().get(0));
cs.hideColumns(3, 5);
assertEquals(1, hidden.size());
- assertSame(firstHiddenRange, cs.getListOfCols().get(0));
+ assertSame(firstHiddenRange, cs.getHiddenRegions().get(0));
cs.hideColumns(4, 6);
assertEquals(1, hidden.size());
- assertSame(firstHiddenRange, cs.getListOfCols().get(0));
+ assertSame(firstHiddenRange, cs.getHiddenRegions().get(0));
cs.hideColumns(3, 6);
assertEquals(1, hidden.size());
- assertSame(firstHiddenRange, cs.getListOfCols().get(0));
+ assertSame(firstHiddenRange, cs.getHiddenRegions().get(0));
cs.revealAllHiddenColumns(colsel);
cs.hideColumns(2, 4);
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[2, 4]", Arrays.toString(hidden.get(0)));
colsel.addElement(10);
cs.revealHiddenColumns(5, colsel);
// hidden columns list now null but getter returns empty list:
- assertTrue(cs.getListOfCols().isEmpty());
+ assertTrue(cs.getHiddenRegions().isEmpty());
// revealed columns are marked as selected (added to selection):
assertEquals("[10, 5, 6, 7, 8]", colsel.getSelected().toString());
colsel = new ColumnSelection();
cs = new HiddenColumns();
cs.hideColumns(5, 8);
- List<int[]> hidden = cs.getListOfCols();
+ List<int[]> hidden = cs.getHiddenRegions();
cs.revealHiddenColumns(6, colsel);
- assertSame(hidden, cs.getListOfCols());
+ assertSame(hidden, cs.getHiddenRegions());
assertTrue(colsel.getSelected().isEmpty());
}
* revealing hidden columns adds them (in order) to the (unordered)
* selection list
*/
- assertTrue(cs.getListOfCols().isEmpty());
+ assertTrue(cs.getHiddenRegions().isEmpty());
assertEquals("[11, 1, 2, 3, 5, 6, 7, 8]", colsel.getSelected()
.toString());
}
HiddenColumns cs = new HiddenColumns();
cs.hideColumns(49, 59);
cs.hideColumns(69, 79);
- List<int[]> hidden = cs.getListOfCols();
+ List<int[]> hidden = cs.getHiddenRegions();
assertEquals(2, hidden.size());
assertEquals("[49, 59]", Arrays.toString(hidden.get(0)));
assertEquals("[69, 79]", Arrays.toString(hidden.get(1)));
cs.hideColumns(48, 80);
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[48, 80]", Arrays.toString(hidden.get(0)));
cs.hideColumns(50, 60);
// hiding 21-49 should merge to one range
cs.hideColumns(21, 49);
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[10, 60]", Arrays.toString(hidden.get(0)));
cs.hideColumns(60, 70);
cs.hideColumns(15, 45);
- hidden = cs.getListOfCols();
+ hidden = cs.getHiddenRegions();
assertEquals(2, hidden.size());
assertEquals("[10, 50]", Arrays.toString(hidden.get(0)));
assertEquals("[60, 70]", Arrays.toString(hidden.get(1)));
assertFalse(alignFrame.hideFeatureColumns("exon", true));
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
assertTrue(alignFrame.getViewport().getAlignment().getHiddenColumns()
- .getListOfCols()
+ .getHiddenRegions()
.isEmpty());
assertFalse(alignFrame.hideFeatureColumns("exon", false));
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
assertTrue(alignFrame.getViewport().getAlignment().getHiddenColumns()
- .getListOfCols()
+ .getHiddenRegions()
.isEmpty());
/*
assertTrue(alignFrame.getViewport().getColumnSelection().isEmpty());
List<int[]> hidden = alignFrame.getViewport().getAlignment()
.getHiddenColumns()
- .getListOfCols();
+ .getHiddenRegions();
assertTrue(hidden.isEmpty());
/*
*/
assertTrue(alignFrame.hideFeatureColumns("Turn", true));
hidden = alignFrame.getViewport().getAlignment().getHiddenColumns()
- .getListOfCols();
+ .getHiddenRegions();
assertEquals(hidden.size(), 2);
assertEquals(hidden.get(0)[0], 1);
assertEquals(hidden.get(0)[1], 3);
TEST_SEQ_HEIGHT = expectedSeqs.size();
TEST_GRP_HEIGHT = expectedGrps.size();
TEST_ANOT_HEIGHT = expectedAnnots.size();
- TEST_CS_HEIGHT = expectedColSel.getListOfCols().size();
+ TEST_CS_HEIGHT = expectedColSel.getHiddenRegions().size();
AlignExportSettingI exportSettings = new AlignExportSettingI()
{
{
HiddenColumns cs = testJsonFile.getHiddenColumns();
Assert.assertNotNull(cs);
- Assert.assertNotNull(cs.getListOfCols());
- List<int[]> hiddenCols = cs.getListOfCols();
+ Assert.assertNotNull(cs.getHiddenRegions());
+ List<int[]> hiddenCols = cs.getHiddenRegions();
Assert.assertEquals(hiddenCols.size(), TEST_CS_HEIGHT);
Assert.assertEquals(hiddenCols.get(0), expectedColSel
- .getListOfCols().get(0),
+ .getHiddenRegions().get(0),
"Mismatched hidden columns!");
}
MappingUtils.mapColumnSelection(proteinSelection, hiddenCols,
proteinView, dnaView, dnaSelection, dnaHidden);
assertEquals("[]", dnaSelection.getSelected().toString());
- List<int[]> hidden = dnaHidden.getListOfCols();
+ List<int[]> hidden = dnaHidden.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[0, 4]", Arrays.toString(hidden.get(0)));
proteinSelection.hideSelectedColumns(1, hiddenCols);
MappingUtils.mapColumnSelection(proteinSelection, hiddenCols,
proteinView, dnaView, dnaSelection, dnaHidden);
- hidden = dnaHidden.getListOfCols();
+ hidden = dnaHidden.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[0, 3]", Arrays.toString(hidden.get(0)));
proteinSelection.hideSelectedColumns(2, hiddenCols);
MappingUtils.mapColumnSelection(proteinSelection, hiddenCols,
proteinView, dnaView, dnaSelection, dnaHidden);
- assertTrue(dnaHidden.getListOfCols().isEmpty());
+ assertTrue(dnaHidden.getHiddenRegions().isEmpty());
/*
* Column 3 in protein picks up Seq1/P, Seq2/Q, Seq3/S which map to columns
MappingUtils.mapColumnSelection(proteinSelection, hiddenCols,
proteinView, dnaView, dnaSelection, dnaHidden);
assertEquals("[0, 1, 2, 3]", dnaSelection.getSelected().toString());
- hidden = dnaHidden.getListOfCols();
+ hidden = dnaHidden.getHiddenRegions();
assertEquals(1, hidden.size());
assertEquals("[5, 10]", Arrays.toString(hidden.get(0)));
proteinSelection.hideSelectedColumns(3, hiddenCols);
MappingUtils.mapColumnSelection(proteinSelection, hiddenCols,
proteinView, dnaView, dnaSelection, dnaHidden);
- hidden = dnaHidden.getListOfCols();
+ hidden = dnaHidden.getHiddenRegions();
assertEquals(2, hidden.size());
assertEquals("[0, 3]", Arrays.toString(hidden.get(0)));
assertEquals("[5, 10]", Arrays.toString(hidden.get(1)));
od = new OverviewDimensionsWithHidden(vpranges, true);
// Initial box sizing - default path through code
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
mouseClick(od, 0, 0);
moveViewport(0, 0);
@Test(groups = { "Functional" })
public void testSetBoxFromMouseClick()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenColsAtStart()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
int lastHiddenCol = 30;
hiddenCols.hideColumns(0, lastHiddenCol);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(),
Math.round((float) (lastHiddenCol + 1) * od.getWidth()
/ alwidth));
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenColsInMiddle()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
int lastHidden = 73;
hiddenCols.hideColumns(firstHidden, lastHidden);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenColsAtEnd()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
int firstHidden = 140;
int lastHidden = 164;
hiddenCols.hideColumns(firstHidden, lastHidden);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenRowsAtStart()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxHeight(), boxHeight);
int lastHiddenRow = 30;
hideSequences(0, lastHiddenRow);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(),
Math.round((float) (lastHiddenRow + 1)
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenRowsInMiddle()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
int lastHiddenRow = 54;
hideSequences(firstHiddenRow, lastHiddenRow);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
@Test(groups = { "Functional" })
public void testFromMouseWithHiddenRowsAtEnd()
{
- od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
int lastHidden = 524;
hideSequences(firstHidden, lastHidden);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
assertEquals(od.getBoxX(), 0);
assertEquals(od.getBoxY(), 0);
assertEquals(od.getBoxWidth(), boxWidth);
{
vpranges.setStartRes(startRes);
vpranges.setEndRes(startRes + viewWidth - 1);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
}
/*
{
vpranges.setStartSeq(startSeq);
vpranges.setEndSeq(startSeq + viewHeight - 1);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
}
/*
vpranges.setEndRes(startRes + viewWidth - 1);
vpranges.setStartSeq(startSeq);
vpranges.setEndSeq(startSeq + viewHeight - 1);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
}
/*
*/
private void mouseClick(OverviewDimensionsWithHidden od, int x, int y)
{
- od.updateViewportFromMouse(x, y, al.getHiddenSequences(), hiddenCols,
- vpranges);
+ od.updateViewportFromMouse(x, y, al.getHiddenSequences(), hiddenCols);
// updates require an OverviewPanel to exist which it doesn't here
// so call setBoxPosition() as it would be called by the AlignmentPanel
vpranges.setEndRes(od.getScrollCol() + viewWidth - 1);
vpranges.setStartSeq(od.getScrollRow());
vpranges.setEndSeq(od.getScrollRow() + viewHeight - 1);
- od.setBoxPosition(al.getHiddenSequences(), hiddenCols, vpranges);
+ od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
}
/*