Clover icon

Coverage Report

  1. Project Clover database Thu Nov 7 2024 17:01:39 GMT
  2. Package jalview.viewmodel

File OverviewDimensionsHideHiddenTest.java

 

Code metrics

4
496
26
1
1,059
707
28
0.06
19.08
26
1.08

Classes

Class Line # Actions
OverviewDimensionsHideHiddenTest 45 496 28
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.viewmodel;
22   
23    import static org.testng.Assert.assertEquals;
24    import static org.testng.Assert.assertFalse;
25    import static org.testng.Assert.assertTrue;
26   
27    import jalview.analysis.AlignmentGenerator;
28    import jalview.datamodel.Alignment;
29    import jalview.datamodel.AlignmentI;
30    import jalview.datamodel.ColumnSelection;
31    import jalview.datamodel.HiddenColumns;
32    import jalview.datamodel.Sequence;
33    import jalview.datamodel.SequenceCollectionI;
34    import jalview.datamodel.SequenceGroup;
35    import jalview.datamodel.SequenceI;
36   
37    import java.util.Hashtable;
38   
39    import org.testng.annotations.AfterClass;
40    import org.testng.annotations.BeforeClass;
41    import org.testng.annotations.BeforeMethod;
42    import org.testng.annotations.Test;
43   
44    @Test(singleThreaded = true)
 
45    public class OverviewDimensionsHideHiddenTest
46    {
47    AlignmentI al;
48   
49    OverviewDimensionsHideHidden od;
50   
51    // cached widths and heights
52    int boxWidth;
53   
54    int boxHeight;
55   
56    int viewHeight;
57   
58    int viewWidth;
59   
60    int alheight;
61   
62    int alwidth;
63   
64    ViewportRanges vpranges;
65   
66    Hashtable<SequenceI, SequenceCollectionI> hiddenRepSequences = new Hashtable<>();
67   
68    HiddenColumns hiddenCols = new HiddenColumns();
69   
 
70  0 toggle @BeforeClass(alwaysRun = true)
71    public void setUpAlignment()
72    {
73    // create random alignment
74  0 AlignmentGenerator gen = new AlignmentGenerator(false);
75  0 al = gen.generate(157, 525, 123, 5, 5);
76    }
77   
 
78  0 toggle @BeforeMethod(alwaysRun = true)
79    public void setUp()
80    {
81  0 if (!hiddenRepSequences.isEmpty())
82    {
83  0 al.getHiddenSequences().showAll(hiddenRepSequences);
84    }
85  0 ColumnSelection colsel = new ColumnSelection();
86  0 hiddenCols.revealAllHiddenColumns(colsel);
87   
88  0 vpranges = new ViewportRanges(al);
89  0 vpranges.setViewportStartAndHeight(0, 18);
90  0 vpranges.setViewportStartAndWidth(0, 63);
91   
92  0 viewHeight = vpranges.getEndSeq() - vpranges.getStartSeq() + 1;
93  0 viewWidth = vpranges.getEndRes() - vpranges.getStartRes() + 1;
94   
95  0 HiddenColumns hiddenCols = new HiddenColumns();
96   
97  0 od = new OverviewDimensionsHideHidden(vpranges, true);
98    // Initial box sizing - default path through code
99  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
100   
101  0 mouseClick(od, 0, 0);
102  0 moveViewport(0, 0);
103   
104    // calculate with visible values
105  0 alheight = vpranges.getVisibleAlignmentHeight();
106  0 alwidth = vpranges.getVisibleAlignmentWidth();
107   
108  0 boxWidth = Math.round(
109    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
110    * od.getWidth() / alwidth);
111  0 boxHeight = Math.round(
112    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
113    * od.getSequencesHeight() / alheight);
114    }
115   
 
116  0 toggle @AfterClass(alwaysRun = true)
117    public void cleanUp()
118    {
119  0 al = null;
120    }
121   
122    /**
123    * Test that the OverviewDimensions constructor sets width and height
124    * correctly
125    */
 
126  0 toggle @Test(groups = { "Functional" })
127    public void testConstructor()
128    {
129  0 SequenceI seqa = new Sequence("Seq1", "ABC");
130  0 SequenceI seqb = new Sequence("Seq2", "ABC");
131  0 SequenceI seqc = new Sequence("Seq3", "ABC");
132  0 SequenceI seqd = new Sequence("Seq4", "ABC");
133  0 SequenceI seqe = new Sequence("Seq5",
134    "ABCABCABCABCABCABCABCABCBACBACBACBAC");
135   
136  0 int defaultGraphHeight = 20;
137  0 int maxWidth = 400;
138  0 int minWidth = 120;
139  0 int maxSeqHeight = 300;
140  0 int minSeqHeight = 40;
141   
142    // test for alignment with width > height
143  0 SequenceI[] seqs1 = new SequenceI[] { seqa, seqb };
144  0 Alignment al1 = new Alignment(seqs1);
145  0 ViewportRanges props = new ViewportRanges(al1);
146   
147  0 OverviewDimensions od = new OverviewDimensionsHideHidden(props, true);
148  0 int scaledHeight = 267;
149  0 assertEquals(od.getGraphHeight(), defaultGraphHeight);
150  0 assertEquals(od.getSequencesHeight(), scaledHeight);
151  0 assertEquals(od.getWidth(), maxWidth);
152  0 assertEquals(od.getHeight(), scaledHeight + defaultGraphHeight);
153   
154    // test for alignment with width < height
155  0 SequenceI[] seqs2 = new SequenceI[] { seqa, seqb, seqc, seqd };
156  0 Alignment al2 = new Alignment(seqs2);
157  0 props = new ViewportRanges(al2);
158   
159  0 od = new OverviewDimensionsHideHidden(props, true);
160  0 int scaledWidth = 300;
161  0 assertEquals(od.getGraphHeight(), defaultGraphHeight);
162  0 assertEquals(od.getSequencesHeight(), maxSeqHeight);
163  0 assertEquals(od.getWidth(), scaledWidth);
164  0 assertEquals(od.getHeight(), scaledWidth + defaultGraphHeight);
165   
166    // test for alignment with width > height and sequence height scaled below
167    // min value
168  0 SequenceI[] seqs3 = new SequenceI[] { seqe };
169  0 Alignment al3 = new Alignment(seqs3);
170  0 props = new ViewportRanges(al3);
171   
172  0 od = new OverviewDimensionsHideHidden(props, true);
173  0 assertEquals(od.getGraphHeight(), defaultGraphHeight);
174  0 assertEquals(od.getSequencesHeight(), minSeqHeight);
175  0 assertEquals(od.getWidth(), maxWidth);
176  0 assertEquals(od.getHeight(), minSeqHeight + defaultGraphHeight);
177   
178    // test for alignment with width < height and width scaled below min value
179  0 SequenceI[] seqs4 = new SequenceI[] { seqa, seqb, seqc, seqd, seqa,
180    seqb, seqc, seqd, seqa, seqb, seqc, seqd, seqa, seqb, seqc, seqd };
181  0 Alignment al4 = new Alignment(seqs4);
182  0 props = new ViewportRanges(al4);
183   
184  0 od = new OverviewDimensionsHideHidden(props, true);
185  0 assertEquals(od.getGraphHeight(), defaultGraphHeight);
186  0 assertEquals(od.getSequencesHeight(), maxSeqHeight);
187  0 assertEquals(od.getWidth(), minWidth);
188  0 assertEquals(od.getHeight(), maxSeqHeight + defaultGraphHeight);
189   
190  0 Alignment al5 = new Alignment(seqs4);
191  0 props = new ViewportRanges(al5);
192   
193  0 od = new OverviewDimensionsHideHidden(props, false);
194  0 assertEquals(od.getGraphHeight(), 0);
195  0 assertEquals(od.getSequencesHeight(), maxSeqHeight);
196  0 assertEquals(od.getWidth(), minWidth);
197  0 assertEquals(od.getHeight(), maxSeqHeight);
198    }
199   
200    /**
201    * Test that validation after mouse adjustments to boxX and boxY sets box
202    * dimensions and scroll values correctly, when there are no hidden rows or
203    * columns.
204    */
 
205  0 toggle @Test(groups = { "Functional" })
206    public void testSetBoxFromMouseClick()
207    {
208  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
209  0 assertEquals(od.getBoxX(), 0);
210  0 assertEquals(od.getBoxY(), 0);
211  0 assertEquals(od.getBoxWidth(), boxWidth);
212  0 assertEquals(vpranges.getStartRes(), 0);
213  0 assertEquals(vpranges.getStartSeq(), 0);
214   
215    // negative boxX value reset to 0
216  0 mouseClick(od, -5, 10);
217  0 assertEquals(od.getBoxX(), 0);
218  0 assertEquals(od.getBoxWidth(), boxWidth);
219  0 assertEquals(od.getBoxHeight(), boxHeight);
220  0 assertEquals(vpranges.getStartSeq() + vpranges.getViewportHeight() / 2,
221    Math.round((float) 10 * alheight / od.getSequencesHeight()));
222  0 assertEquals(vpranges.getStartRes(), 0);
223   
224    // negative boxY value reset to 0
225  0 mouseClick(od, 6, -2);
226  0 assertEquals(od.getBoxY(), 0);
227  0 assertEquals(od.getBoxWidth(), boxWidth);
228  0 assertEquals(od.getBoxHeight(), boxHeight);
229  0 assertEquals(vpranges.getStartRes(), 0);
230  0 assertEquals(vpranges.getStartSeq(), 0);
231   
232    // overly large boxX value reset to width-boxWidth
233  0 mouseClick(od, 101, 6);
234  0 assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
235  0 assertEquals(od.getBoxY(), 1);
236  0 assertEquals(od.getBoxWidth(), boxWidth);
237  0 assertEquals(od.getBoxHeight(), boxHeight);
238  0 assertEquals(vpranges.getStartRes(),
239    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
240  0 assertEquals(vpranges.getStartSeq(), Math.round(
241    (float) od.getBoxY() * alheight / od.getSequencesHeight()));
242   
243    // overly large boxY value reset to sequenceHeight - boxHeight
244  0 mouseClick(od, 10, 520);
245  0 assertEquals(od.getBoxX(), 0);
246  0 assertEquals(od.getBoxY(), od.getSequencesHeight() - od.getBoxHeight());
247  0 assertEquals(od.getBoxWidth(), boxWidth);
248  0 assertEquals(od.getBoxHeight(), boxHeight);
249  0 assertEquals(vpranges.getStartRes(),
250    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
251   
252    // here (float) od.getBoxY() * alheight / od.getSequencesHeight() = 507.5
253    // and round rounds to 508; however we get 507 working with row values
254    // hence the subtraction of 1
255  0 assertEquals(vpranges.getStartSeq(), Math.round(
256    (float) od.getBoxY() * alheight / od.getSequencesHeight()) - 1);
257   
258    // click past end of alignment, as above
259  0 mouseClick(od, 3000, 5);
260  0 assertEquals(od.getBoxX(), od.getWidth() - od.getBoxWidth());
261  0 assertEquals(od.getBoxWidth(), boxWidth);
262  0 assertEquals(od.getBoxHeight(), boxHeight);
263  0 assertEquals(vpranges.getStartRes(),
264    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
265  0 assertEquals(vpranges.getStartSeq(), Math.round(
266    (float) od.getBoxY() * alheight / od.getSequencesHeight()));
267   
268    // move viewport so startRes non-zero and then mouseclick
269  0 moveViewportH(20);
270   
271    // click at viewport position
272  0 int oldboxx = od.getBoxX();
273  0 int oldboxy = od.getBoxY();
274  0 mouseClick(od, od.getBoxX() + od.getBoxWidth() / 2 + 6,
275    od.getBoxY() + od.getBoxHeight() / 2 + 3);
276  0 assertEquals(od.getBoxX(), oldboxx + 6);
277  0 assertEquals(od.getBoxWidth(), boxWidth);
278  0 assertEquals(od.getBoxHeight(), boxHeight);
279  0 assertEquals(vpranges.getStartRes(),
280    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
281  0 assertEquals(od.getBoxY(), oldboxy + 3);
282  0 assertEquals(vpranges.getStartSeq(), Math.round(
283    (float) od.getBoxY() * alheight / od.getSequencesHeight()));
284   
285    // click at top corner
286  0 mouseClick(od, 0, 0);
287  0 assertEquals(od.getBoxX(), 0);
288  0 assertEquals(vpranges.getStartRes(), 0);
289  0 assertEquals(od.getBoxY(), 0);
290  0 assertEquals(vpranges.getStartSeq(), 0);
291  0 assertEquals(od.getBoxWidth(), boxWidth);
292  0 assertEquals(od.getBoxHeight(), boxHeight);
293    }
294   
295    /**
296    * Test setting of the box position, when there are hidden cols at the start
297    * of the alignment
298    */
 
299  0 toggle @Test(groups = { "Functional" })
300    public void testFromMouseWithHiddenColsAtStart()
301    {
302  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
303  0 assertEquals(od.getBoxX(), 0);
304  0 assertEquals(od.getBoxY(), 0);
305  0 assertEquals(od.getBoxWidth(), boxWidth);
306  0 assertEquals(vpranges.getStartRes(), 0);
307  0 assertEquals(vpranges.getStartSeq(), 0);
308   
309    // hide cols at start and check updated box position is correct
310  0 int lastHiddenCol = 30;
311  0 hiddenCols.hideColumns(0, lastHiddenCol);
312   
313  0 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
314   
315    // click to right of hidden columns, box moves to click point
316  0 testBoxIsAtClickPoint(41 + boxWidth / 2, boxHeight / 2);
317  0 assertEquals(vpranges.getStartSeq(), 0);
318  0 assertEquals(vpranges.getStartRes(),
319    Math.round((float) 41 * alwidth / od.getWidth()));
320   
321    // click to right of hidden columns such that box runs over right hand side
322    // of alignment
323    // box position is adjusted away from the edge
324    // overly large boxX value reset to width-boxWidth
325  0 int xpos = 100 + boxWidth / 2;
326  0 mouseClick(od, xpos, boxHeight / 2);
327  0 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
328  0 assertEquals(od.getBoxY(), 0);
329  0 assertEquals(od.getBoxWidth(), boxWidth);
330  0 assertEquals(od.getBoxHeight(), boxHeight);
331  0 assertEquals(vpranges.getStartRes(),
332    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
333  0 assertEquals(vpranges.getStartSeq(), 0);
334    }
335   
336    /**
337    * Test setting of the box position, when there are hidden cols in the middle
338    * of the alignment
339    */
 
340  0 toggle @Test(groups = { "Functional" })
341    public void testFromMouseWithHiddenColsInMiddle()
342    {
343  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
344  0 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
345  0 assertEquals(od.getBoxX(), 0);
346  0 assertEquals(od.getBoxY(), 0);
347  0 assertEquals(od.getBoxWidth(), boxWidth);
348  0 assertEquals(vpranges.getStartRes(), 0);
349  0 assertEquals(vpranges.getStartSeq(), 0);
350   
351    // hide columns 63-73, no change to box position or dimensions
352  0 int firstHidden = 63;
353  0 int lastHidden = 73;
354  0 hiddenCols.hideColumns(firstHidden, lastHidden);
355   
356  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
357  0 testBoxIsAtClickPoint(boxWidth / 2, boxHeight / 2);
358  0 assertEquals(od.getBoxX(), 0);
359  0 assertEquals(od.getBoxY(), 0);
360  0 assertEquals(od.getBoxWidth(), boxWidth);
361  0 assertEquals(vpranges.getStartRes(), 0);
362  0 assertEquals(vpranges.getStartSeq(), 0);
363   
364    // move box so that it overlaps with hidden cols on one side
365    // box width, boxX and scrollCol as for unhidden case
366  0 int xpos = 54 - boxWidth / 2; // 54 is position in overview approx halfway
367    // between cols 60 and 70
368  0 mouseClick(od, xpos, boxHeight / 2);
369  0 testBoxIsAtClickPoint(xpos, boxHeight / 2);
370  0 assertEquals(vpranges.getStartRes(), 1 + // rounding
371    Math.round((xpos - boxWidth / 2) * alwidth / od.getWidth()));
372  0 assertEquals(vpranges.getStartSeq(), 0);
373   
374    // move box so that it completely covers hidden cols
375    // box width, boxX and scrollCol as for unhidden case
376  0 xpos = 33;
377  0 mouseClick(od, xpos, boxHeight / 2);
378  0 testBoxIsAtClickPoint(xpos, boxHeight / 2);
379  0 assertEquals(vpranges.getStartRes(), Math.round(
380    (float) (xpos - boxWidth / 2) * alwidth / od.getWidth()));
381  0 assertEquals(vpranges.getStartSeq(), 0);
382   
383    // move box so boxX is in hidden cols, box overhangs at right
384    // boxX and scrollCol at left of hidden area, box width unchanged
385  0 xpos = Math.round((float) 50 * od.getWidth() / alwidth) + boxWidth / 2;
386  0 mouseClick(od, xpos, boxHeight / 2);
387  0 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
388  0 assertEquals(od.getBoxY(), 0);
389  0 assertEquals(od.getBoxWidth(), boxWidth);
390  0 assertEquals(od.getBoxHeight(), boxHeight);
391  0 assertEquals(vpranges.getStartRes(), 50);
392  0 assertEquals(vpranges.getStartSeq(), 0);
393   
394    // move box so boxX is to right of hidden cols, but does not go beyond full
395    // width of alignment
396    // box width, boxX and scrollCol all as for non-hidden case
397  0 xpos = Math.round((float) 75 * od.getWidth() / alwidth) + boxWidth / 2;
398  0 mouseClick(od, xpos, boxHeight / 2);
399  0 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
400  0 assertEquals(od.getBoxY(), 0);
401  0 assertEquals(od.getBoxWidth(), boxWidth);
402  0 assertEquals(od.getBoxHeight(), boxHeight);
403  0 assertEquals(vpranges.getStartSeq(), 0);
404  0 assertEquals(vpranges.getStartRes(), 75);
405   
406    // move box so it goes beyond full width of alignment
407    // boxX, scrollCol adjusted back, box width normal
408  0 xpos = 3000;
409  0 mouseClick(od, xpos, boxHeight / 2);
410  0 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
411  0 assertEquals(od.getBoxY(), 0);
412  0 assertEquals(od.getBoxWidth(), boxWidth);
413  0 assertEquals(od.getBoxHeight(), boxHeight);
414  0 assertEquals(vpranges.getStartRes(),
415    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
416  0 assertEquals(vpranges.getStartSeq(), 0);
417   
418    }
419   
420    /**
421    * Test setting of the box position, when there are hidden cols at the end of
422    * the alignment
423    */
 
424  0 toggle @Test(groups = { "Functional" })
425    public void testFromMouseWithHiddenColsAtEnd()
426    {
427  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
428  0 assertEquals(od.getBoxX(), 0);
429  0 assertEquals(od.getBoxY(), 0);
430  0 assertEquals(od.getBoxWidth(), boxWidth);
431  0 assertEquals(vpranges.getStartRes(), 0);
432  0 assertEquals(vpranges.getStartSeq(), 0);
433   
434    // hide columns 140-164, no change to box position or dimensions
435  0 int firstHidden = 140;
436  0 int lastHidden = 164;
437  0 hiddenCols.hideColumns(firstHidden, lastHidden);
438  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
439  0 assertEquals(od.getBoxX(), 0);
440  0 assertEquals(od.getBoxY(), 0);
441  0 assertEquals(od.getBoxWidth(), boxWidth);
442  0 assertEquals(vpranges.getStartRes(), 0);
443  0 assertEquals(vpranges.getStartSeq(), 0);
444   
445    // click to left of hidden cols, without overlapping
446    // boxX, scrollCol and width as normal
447  0 int xpos = 30;
448  0 int ypos = 6;
449  0 testBoxIsAtClickPoint(xpos, ypos);
450  0 assertEquals(vpranges.getStartSeq(), Math.round(
451    (float) (ypos - boxHeight / 2) * alheight / od.getHeight()));
452  0 assertEquals(vpranges.getStartRes(), Math.round(
453    (float) (xpos - boxWidth / 2) * alwidth / od.getWidth()));
454   
455    // click to left of hidden cols, with overlap
456    // boxX and scrollCol adjusted for hidden cols, width normal
457  0 xpos = Math.round((float) 144 * od.getWidth() / alwidth) - boxWidth;
458  0 mouseClick(od, xpos, boxHeight / 2);
459  0 testBoxIsAtClickPoint(xpos, boxHeight / 2);
460  0 assertEquals(vpranges.getStartRes(), Math.round(
461    (float) (xpos - boxWidth / 2) * alwidth / od.getWidth()));
462  0 assertEquals(vpranges.getStartSeq(), 0);
463   
464    // click off end of alignment
465    // boxX and scrollCol adjusted backwards, width normal
466  0 xpos = 3000;
467  0 mouseClick(od, xpos, 0);
468  0 assertEquals(od.getBoxX(), Math.round(od.getWidth()) - boxWidth);
469  0 assertEquals(od.getBoxY(), 0);
470  0 assertEquals(od.getBoxWidth(), boxWidth);
471  0 assertEquals(od.getBoxHeight(), boxHeight);
472  0 assertEquals(vpranges.getStartRes(),
473    Math.round((float) od.getBoxX() * alwidth / od.getWidth()));
474  0 assertEquals(vpranges.getStartSeq(), 0);
475    }
476   
477    /**
478    * Test that the box position is set correctly when set from the viewport,
479    * with no hidden rows or columns
480    */
 
481  0 toggle @Test(groups = { "Functional" })
482    public void testSetBoxFromViewport()
483    {
484    // move viewport to start of alignment
485  0 moveViewport(0, 0);
486  0 assertEquals(od.getBoxX(), 0);
487  0 assertEquals(od.getBoxY(), 0);
488  0 assertEquals(od.getBoxWidth(), boxWidth);
489  0 assertEquals(od.getBoxHeight(), boxHeight);
490   
491    // move viewport to right
492  0 moveViewportH(70);
493  0 assertEquals(od.getBoxX(),
494    Math.round((float) 70 * od.getWidth() / alwidth));
495  0 assertEquals(od.getBoxY(), 0);
496  0 assertEquals(od.getBoxWidth(), boxWidth);
497  0 assertEquals(od.getBoxHeight(), boxHeight);
498   
499    // move viewport down
500  0 moveViewportV(100);
501  0 assertEquals(od.getBoxX(),
502    Math.round((float) 70 * od.getWidth() / alwidth));
503  0 assertEquals(od.getBoxY(),
504    Math.round(100 * od.getSequencesHeight() / alheight));
505  0 assertEquals(od.getBoxWidth(), boxWidth);
506  0 assertEquals(od.getBoxHeight(), boxHeight);
507   
508    // move viewport to bottom right
509  0 moveViewport(98, 508);
510  0 assertEquals(od.getBoxX(),
511    Math.round((float) 98 * od.getWidth() / alwidth));
512  0 assertEquals(od.getBoxY(),
513    Math.round((float) 508 * od.getSequencesHeight() / alheight));
514  0 assertEquals(od.getBoxWidth(), boxWidth);
515  0 assertEquals(od.getBoxHeight(), boxHeight);
516    }
517   
518    /**
519    * Test that the box position is set correctly when there are hidden columns
520    * at the start
521    */
 
522  0 toggle @Test(groups = { "Functional" })
523    public void testSetBoxFromViewportHiddenColsAtStart()
524    {
525  0 int firstHidden = 0;
526  0 int lastHidden = 20;
527  0 hiddenCols.hideColumns(firstHidden, lastHidden);
528   
529    // move viewport to start of alignment
530  0 moveViewport(0, 0);
531  0 assertEquals(od.getBoxX(), 0);
532  0 assertEquals(od.getBoxY(), 0);
533  0 assertEquals(od.getBoxWidth(), boxWidth);
534  0 assertEquals(od.getBoxHeight(), boxHeight);
535   
536    // move viewport to end of alignment - need to make startRes by removing
537    // hidden cols because of how viewport/overview are implemented
538  0 moveViewport(98 - lastHidden - 1, 0);
539  0 assertEquals(od.getBoxX(), Math.round(
540    (float) (98 - lastHidden - 1) * od.getWidth() / alwidth));
541  0 assertEquals(od.getBoxY(), 0);
542  0 assertEquals(od.getBoxWidth(), boxWidth);
543  0 assertEquals(od.getBoxHeight(), boxHeight);
544    }
545   
546    /**
547    * Test that the box position is set correctly when there are hidden columns
548    * in the middle
549    */
 
550  0 toggle @Test(groups = { "Functional" })
551    public void testSetBoxFromViewportHiddenColsInMiddle()
552    {
553  0 int firstHidden = 68;
554  0 int lastHidden = 78;
555  0 hiddenCols.hideColumns(firstHidden, lastHidden);
556   
557    // move viewport before hidden columns
558  0 moveViewport(3, 0);
559   
560  0 assertEquals(od.getBoxX(),
561    Math.round((float) 3 * od.getWidth() / alwidth));
562  0 assertEquals(od.getBoxY(), 0);
563  0 assertEquals(od.getBoxWidth(), boxWidth);
564  0 assertEquals(od.getBoxHeight(), boxHeight);
565   
566    // move viewport to left of hidden columns with overlap
567  0 moveViewport(10, 0);
568  0 assertEquals(od.getBoxX(),
569    Math.round((float) 10 * od.getWidth() / alwidth));
570  0 assertEquals(od.getBoxY(), 0);
571  0 assertEquals(od.getBoxWidth(), boxWidth);
572  0 assertEquals(od.getBoxHeight(), boxHeight);
573   
574    // move viewport to straddle hidden columns
575  0 moveViewport(63, 0);
576  0 assertEquals(od.getBoxX(),
577    Math.round((float) 63 * od.getWidth() / alwidth));
578  0 assertEquals(od.getBoxY(), 0);
579  0 assertEquals(od.getBoxWidth(), boxWidth);
580  0 assertEquals(od.getBoxHeight(), boxHeight);
581   
582    // move viewport to right of hidden columns, no overlap
583  0 moveViewport(80 - (lastHidden - firstHidden + 1), 0);
584  0 assertEquals(od.getBoxX(),
585    Math.round((float) (80 - (lastHidden - firstHidden + 1))
586    * od.getWidth() / alwidth));
587  0 assertEquals(od.getBoxY(), 0);
588  0 assertEquals(od.getBoxWidth(), boxWidth);
589  0 assertEquals(od.getBoxHeight(), boxHeight);
590   
591    }
592   
593    /**
594    * Test that the box position is set correctly when there are hidden columns
595    * at the end
596    */
 
597  0 toggle @Test(groups = { "Functional" })
598    public void testSetBoxFromViewportHiddenColsAtEnd()
599    {
600  0 int firstHidden = 152;
601  0 int lastHidden = 164;
602  0 hiddenCols.hideColumns(firstHidden, lastHidden);
603   
604    // move viewport before hidden columns
605  0 moveViewport(3, 0);
606  0 assertEquals(od.getBoxX(),
607    Math.round((float) 3 * od.getWidth() / alwidth));
608  0 assertEquals(od.getBoxY(), 0);
609  0 assertEquals(od.getBoxWidth(), boxWidth);
610  0 assertEquals(od.getBoxHeight(), boxHeight);
611   
612    // move viewport to hidden columns
613    // viewport can't actually extend into hidden cols,
614    // so move to the far right edge of the viewport
615  0 moveViewport(firstHidden - viewWidth, 0);
616  0 assertEquals(od.getBoxX(), Math.round(
617    (float) (firstHidden - viewWidth) * od.getWidth() / alwidth));
618  0 assertEquals(od.getBoxY(), 0);
619  0 assertEquals(od.getBoxWidth(), boxWidth);
620  0 assertEquals(od.getBoxHeight(), boxHeight);
621    }
622   
623    /**
624    * Test that the box position is set correctly when there are hidden rows at
625    * the start
626    */
 
627  0 toggle @Test(groups = { "Functional" })
628    public void testSetBoxFromViewportHiddenRowsAtStart()
629    {
630  0 int firstHidden = 0;
631  0 int lastHidden = 20;
632  0 hideSequences(firstHidden, lastHidden);
633   
634    // calculate with visible values
635  0 alheight = vpranges.getVisibleAlignmentHeight();
636  0 alwidth = vpranges.getVisibleAlignmentWidth();
637   
638  0 boxWidth = Math.round(
639    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
640    * od.getWidth() / alwidth);
641  0 boxHeight = Math.round(
642    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
643    * od.getSequencesHeight() / alheight);
644   
645    // move viewport to start of alignment:
646    // box moves to below hidden rows, height remains same
647  0 moveViewport(0, 0);
648  0 assertEquals(od.getBoxX(), 0);
649  0 assertEquals(od.getBoxY(), 0);
650  0 assertEquals(od.getBoxWidth(), boxWidth);
651  0 assertEquals(od.getBoxHeight(), boxHeight);
652   
653    // move viewport to end of alignment
654  0 moveViewport(0, 525 - viewHeight - lastHidden - 1);
655  0 assertEquals(od.getBoxX(), 0);
656  0 assertEquals(od.getBoxY(),
657    Math.round((float) (525 - viewHeight - lastHidden - 1)
658    * od.getSequencesHeight() / alheight));
659  0 assertEquals(od.getBoxWidth(), boxWidth);
660  0 assertEquals(od.getBoxHeight(), boxHeight);
661    }
662   
663    /**
664    * Test that the box position is set correctly when there are hidden rows in
665    * the middle
666    */
 
667  0 toggle @Test(groups = { "Functional" })
668    public void testSetBoxFromViewportHiddenRowsInMiddle()
669    {
670  0 int firstHidden = 200;
671  0 int lastHidden = 210;
672  0 hideSequences(firstHidden, lastHidden);
673   
674    // calculate with visible values
675  0 alheight = vpranges.getVisibleAlignmentHeight();
676  0 alwidth = vpranges.getVisibleAlignmentWidth();
677   
678  0 boxWidth = Math.round(
679    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
680    * od.getWidth() / alwidth);
681  0 boxHeight = Math.round(
682    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
683    * od.getSequencesHeight() / alheight);
684   
685    // move viewport to start of alignment:
686    // box, height etc as in non-hidden case
687  0 moveViewport(0, 0);
688  0 assertEquals(od.getBoxX(), 0);
689  0 assertEquals(od.getBoxY(), 0);
690  0 assertEquals(od.getBoxWidth(), boxWidth);
691  0 assertEquals(od.getBoxHeight(), boxHeight);
692   
693    // move viewport to straddle hidden rows
694  0 moveViewport(0, 198);
695  0 assertEquals(od.getBoxX(), 0);
696  0 assertEquals(od.getBoxY(),
697    Math.round((float) 198 * od.getSequencesHeight() / alheight));
698  0 assertEquals(od.getBoxWidth(), boxWidth);
699  0 assertEquals(od.getBoxHeight(), boxHeight);
700    }
701   
702    /**
703    * Test that the box position is set correctly when there are hidden rows at
704    * the bottom
705    */
 
706  0 toggle @Test(groups = { "Functional" })
707    public void testSetBoxFromViewportHiddenRowsAtEnd()
708    {
709  0 int firstHidden = 500;
710  0 int lastHidden = 524;
711  0 hideSequences(firstHidden, lastHidden);
712   
713    // calculate with visible values
714  0 alheight = vpranges.getVisibleAlignmentHeight();
715  0 alwidth = vpranges.getVisibleAlignmentWidth();
716   
717  0 boxWidth = Math.round(
718    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
719    * od.getWidth() / alwidth);
720  0 boxHeight = Math.round(
721    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
722    * od.getSequencesHeight() / alheight);
723   
724    // move viewport to start of alignment:
725    // box, height etc as in non-hidden case
726  0 moveViewport(0, 0);
727  0 assertEquals(od.getBoxX(), 0);
728  0 assertEquals(od.getBoxY(), 0);
729  0 assertEquals(od.getBoxWidth(), boxWidth);
730  0 assertEquals(od.getBoxHeight(), boxHeight);
731   
732    // move viewport to end of alignment
733    // viewport sits above hidden rows and does not include them
734  0 moveViewport(0, firstHidden - viewHeight - 1);
735  0 assertEquals(od.getBoxX(), 0);
736  0 assertEquals(od.getBoxY(),
737    Math.round((float) (firstHidden - viewHeight - 1)
738    * od.getSequencesHeight() / alheight));
739  0 assertEquals(od.getBoxWidth(), boxWidth);
740  0 assertEquals(od.getBoxHeight(), boxHeight);
741   
742    }
743   
744    /**
745    * Test setting of the box position, when there are hidden rows at the start
746    * of the alignment
747    */
 
748  0 toggle @Test(groups = { "Functional" })
749    public void testFromMouseWithHiddenRowsAtStart()
750    {
751  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
752  0 assertEquals(od.getBoxX(), 0);
753  0 assertEquals(od.getBoxY(), 0);
754  0 assertEquals(od.getBoxHeight(), boxHeight);
755  0 assertEquals(od.getBoxWidth(), boxWidth);
756  0 assertEquals(vpranges.getStartRes(), 0);
757  0 assertEquals(vpranges.getStartSeq(), 0);
758   
759    // hide rows at start and check updated box position is correct
760  0 int lastHiddenRow = 30;
761  0 hideSequences(0, lastHiddenRow);
762   
763    // calculate with visible values
764  0 alheight = vpranges.getVisibleAlignmentHeight();
765  0 alwidth = vpranges.getVisibleAlignmentWidth();
766   
767  0 boxWidth = Math.round(
768    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
769    * od.getWidth() / alwidth);
770  0 boxHeight = Math.round(
771    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
772    * od.getSequencesHeight() / alheight);
773   
774  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
775  0 assertEquals(od.getBoxX(), 0);
776  0 assertEquals(od.getBoxY(), 0);
777  0 assertEquals(od.getBoxWidth(), boxWidth);
778  0 assertEquals(od.getBoxHeight(), boxHeight);
779   
780    // click below hidden rows
781  0 mouseClick(od, 0, 151 + boxHeight / 2);
782  0 assertEquals(od.getBoxX(), 0);
783  0 assertEquals(od.getBoxY(), 151);
784  0 assertEquals(od.getBoxWidth(), boxWidth);
785  0 assertEquals(od.getBoxHeight(), boxHeight);
786    }
787   
788    /**
789    * Test setting of the box position, when there are hidden rows at the middle
790    * of the alignment
791    */
 
792  0 toggle @Test(groups = { "Functional" })
793    public void testFromMouseWithHiddenRowsInMiddle()
794    {
795  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
796   
797  0 assertEquals(od.getBoxX(), 0);
798  0 assertEquals(od.getBoxY(), 0);
799  0 assertEquals(od.getBoxWidth(), boxWidth);
800  0 assertEquals(od.getBoxHeight(), boxHeight);
801  0 assertEquals(vpranges.getStartRes(), 0);
802  0 assertEquals(vpranges.getStartSeq(), 0);
803   
804    // hide rows in middle and check updated box position is correct
805    // no changes
806  0 int firstHiddenRow = 50;
807  0 int lastHiddenRow = 54;
808  0 hideSequences(firstHiddenRow, lastHiddenRow);
809   
810    // calculate with visible values
811  0 alheight = vpranges.getVisibleAlignmentHeight();
812  0 alwidth = vpranges.getVisibleAlignmentWidth();
813   
814  0 boxWidth = Math.round(
815    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
816    * od.getWidth() / alwidth);
817  0 boxHeight = Math.round(
818    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
819    * od.getSequencesHeight() / alheight);
820   
821  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
822   
823  0 assertEquals(od.getBoxX(), 0);
824  0 assertEquals(od.getBoxY(), 0);
825  0 assertEquals(od.getBoxWidth(), boxWidth);
826  0 assertEquals(od.getBoxHeight(), boxHeight);
827   
828    // click above hidden rows, so that box overlaps
829  0 int ypos = 35 + viewHeight / 2; // row value in residues
830  0 mouseClick(od, 0,
831    Math.round((float) ypos * od.getSequencesHeight() / alheight));
832  0 assertEquals(od.getBoxX(), 0);
833  0 assertEquals(od.getBoxY(),
834    Math.round((float) 35 * od.getSequencesHeight() / alheight));
835  0 assertEquals(od.getBoxWidth(), boxWidth);
836  0 assertEquals(od.getBoxHeight(), boxHeight);
837   
838    // click so that box straddles hidden rows
839  0 ypos = 45 + viewHeight / 2; // row value in residues
840  0 mouseClick(od, 0,
841    Math.round((float) ypos * od.getSequencesHeight() / alheight));
842  0 assertEquals(od.getBoxX(), 0);
843  0 assertEquals(od.getBoxY(),
844    Math.round((float) 45 * od.getSequencesHeight() / alheight));
845  0 assertEquals(od.getBoxWidth(), boxWidth);
846  0 assertEquals(od.getBoxHeight(), boxHeight);
847    }
848   
849    /**
850    * Test setting of the box position, when there are hidden rows at the end of
851    * the alignment
852    */
 
853  0 toggle @Test(groups = { "Functional" })
854    public void testFromMouseWithHiddenRowsAtEnd()
855    {
856  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
857  0 assertEquals(od.getBoxX(), 0);
858  0 assertEquals(od.getBoxY(), 0);
859  0 assertEquals(od.getBoxWidth(), boxWidth);
860  0 assertEquals(od.getBoxHeight(), boxHeight);
861  0 assertEquals(vpranges.getStartRes(), 0);
862  0 assertEquals(vpranges.getStartSeq(), 0);
863   
864    // hide rows at end and check updated box position is correct
865    // no changes
866  0 int firstHidden = 500;
867  0 int lastHidden = 524;
868  0 hideSequences(firstHidden, lastHidden);
869   
870    // calculate with visible values
871  0 alheight = vpranges.getVisibleAlignmentHeight();
872  0 alwidth = vpranges.getVisibleAlignmentWidth();
873   
874  0 boxWidth = Math.round(
875    (float) (vpranges.getEndRes() - vpranges.getStartRes() + 1)
876    * od.getWidth() / alwidth);
877  0 boxHeight = Math.round(
878    (float) (vpranges.getEndSeq() - vpranges.getStartSeq() + 1)
879    * od.getSequencesHeight() / alheight);
880   
881  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
882  0 assertEquals(od.getBoxX(), 0);
883  0 assertEquals(od.getBoxY(), 0);
884  0 assertEquals(od.getBoxWidth(), boxWidth);
885  0 assertEquals(od.getBoxHeight(), boxHeight);
886   
887    // click above hidden rows
888  0 int ypos = 41 + viewHeight / 2; // row 41
889  0 mouseClick(od, 0,
890    Math.round((float) ypos * od.getSequencesHeight() / alheight));
891  0 assertEquals(od.getBoxX(), 0);
892  0 assertEquals(od.getBoxY(),
893    Math.round((float) 41 * od.getSequencesHeight() / alheight));
894  0 assertEquals(od.getBoxWidth(), boxWidth);
895  0 assertEquals(od.getBoxHeight(), boxHeight);
896   
897    // click above hidden rows so box overlaps
898    // boxY, boxHeight remains same
899  0 ypos = 497 + viewHeight / 2; // row 497
900  0 mouseClick(od, 0,
901    Math.round((float) ypos * od.getSequencesHeight() / alheight));
902  0 assertEquals(od.getBoxX(), 0);
903  0 assertEquals(od.getBoxY(), Math
904    .round((float) firstHidden * od.getSequencesHeight() / alheight)
905    - boxHeight);
906  0 assertEquals(od.getBoxWidth(), boxWidth);
907  0 assertEquals(od.getBoxHeight(), boxHeight);
908    }
909   
910    /**
911    * Test the function to determine if a point is in the overview's box or not
912    */
 
913  0 toggle @Test(groups = { "Functional" })
914    public void testPositionInBox()
915    {
916  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
917   
918  0 assertFalse(od.isPositionInBox(0, 0));
919  0 assertTrue(od.isPositionInBox(10, 9));
920  0 assertFalse(od.isPositionInBox(0, 9));
921  0 assertFalse(od.isPositionInBox(9, 0));
922  0 assertFalse(od.isPositionInBox(75, 20));
923   
924    // hide columns in the box area
925    // makes absolutely no difference
926  0 hiddenCols.hideColumns(1, 4);
927  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
928  0 assertFalse(od.isPositionInBox(0, 0));
929  0 assertTrue(od.isPositionInBox(10, 9));
930  0 assertFalse(od.isPositionInBox(0, 9));
931  0 assertFalse(od.isPositionInBox(9, 0));
932  0 assertFalse(od.isPositionInBox(75, 20));
933   
934    // hide sequences in box area
935    // makes absolutely no difference
936  0 hideSequences(1, 3);
937  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
938  0 assertFalse(od.isPositionInBox(0, 0));
939  0 assertTrue(od.isPositionInBox(10, 9));
940  0 assertFalse(od.isPositionInBox(0, 9));
941  0 assertFalse(od.isPositionInBox(9, 0));
942  0 assertFalse(od.isPositionInBox(75, 20));
943    }
944   
945    /**
946    * Test the dragging functionality
947    */
 
948  0 toggle @Test(groups = { "Functional" })
949    public void testDragging()
950    {
951  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
952  0 od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
953  0 od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
954   
955    // updates require an OverviewPanel to exist which it doesn't here
956    // so call setBoxPosition() as it would be called by the AlignmentPanel
957    // normally
958  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
959   
960    // corner moves 16 (20-4) right and 6 (22-16) up
961  0 assertEquals(od.getBoxX(), 16);
962  0 assertEquals(od.getBoxY(), 6);
963   
964    // hide columns - makes no difference
965  0 hiddenCols.hideColumns(1, 4);
966  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
967  0 od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
968  0 od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
969  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
970   
971    // corner moves 16 (20-4) right and 6 (22-16) up
972  0 assertEquals(od.getBoxX(), 16);
973  0 assertEquals(od.getBoxY(), 6);
974   
975    // hide sequences in box area
976    // makes absolutely no difference
977  0 hideSequences(1, 3);
978  0 od.updateViewportFromMouse(0, 0, al.getHiddenSequences(), hiddenCols);
979  0 od.setDragPoint(4, 16, al.getHiddenSequences(), hiddenCols);
980  0 od.adjustViewportFromMouse(20, 22, al.getHiddenSequences(), hiddenCols);
981  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
982   
983    // corner moves 16 (20-4) right and 6 (22-16) up
984  0 assertEquals(od.getBoxX(), 16);
985  0 assertEquals(od.getBoxY(), 6);
986    }
987   
988    /*
989    * Move viewport horizontally: startRes + previous width gives new horizontal extent. Vertical extent stays the same.
990    */
 
991  0 toggle private void moveViewportH(int startRes)
992    {
993  0 vpranges.setViewportStartAndWidth(startRes, viewWidth);
994  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
995    }
996   
997    /*
998    * Move viewport vertically: startSeq and endSeq give new vertical extent. Horizontal extent stays the same.
999    */
 
1000  0 toggle private void moveViewportV(int startSeq)
1001    {
1002  0 vpranges.setViewportStartAndHeight(startSeq, viewHeight);
1003  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1004    }
1005   
1006    /*
1007    * Move viewport horizontally and vertically.
1008    */
 
1009  0 toggle private void moveViewport(int startRes, int startSeq)
1010    {
1011  0 vpranges.setViewportStartAndWidth(startRes, viewWidth);
1012  0 vpranges.setViewportStartAndHeight(startSeq, viewHeight);
1013  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1014    }
1015   
1016    /*
1017    * Mouse click as position x,y in overview window
1018    */
 
1019  0 toggle private void mouseClick(OverviewDimensions od, int x, int y)
1020    {
1021  0 od.updateViewportFromMouse(x, y, al.getHiddenSequences(), hiddenCols);
1022   
1023    // updates require an OverviewPanel to exist which it doesn't here
1024    // so call setBoxPosition() as it would be called by the AlignmentPanel
1025    // normally
1026  0 od.setBoxPosition(al.getHiddenSequences(), hiddenCols);
1027    }
1028   
1029    /*
1030    * Test that the box is positioned with the top left corner at xpos, ypos
1031    * and with the original width and height
1032    */
 
1033  0 toggle private void testBoxIsAtClickPoint(int xpos, int ypos)
1034    {
1035  0 mouseClick(od, xpos, ypos);
1036  0 assertEquals(od.getBoxX() + od.getBoxWidth() / 2, xpos);
1037  0 assertEquals(od.getBoxY() + od.getBoxHeight() / 2, ypos);
1038  0 assertEquals(od.getBoxWidth(), boxWidth);
1039  0 assertEquals(od.getBoxHeight(), boxHeight);
1040   
1041    }
1042   
1043    /*
1044    * Hide sequences between start and end
1045    */
 
1046  0 toggle private void hideSequences(int start, int end)
1047    {
1048  0 SequenceI[] allseqs = al.getSequencesArray();
1049  0 SequenceGroup theseSeqs = new SequenceGroup();
1050   
1051  0 for (int i = start; i <= end; i++)
1052    {
1053  0 theseSeqs.addSequence(allseqs[i], false);
1054  0 al.getHiddenSequences().hideSequence(allseqs[i]);
1055    }
1056   
1057  0 hiddenRepSequences.put(allseqs[start], theseSeqs);
1058    }
1059    }