From: gmungoc Date: Mon, 21 Nov 2016 11:58:49 +0000 (+0000) Subject: JAL-2333 test beefed up with gaps X-Git-Tag: Release_2_10_1~10^2~1^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a2fe8b63324a2907943cab8e5d4de2c81107b793;p=jalview.git JAL-2333 test beefed up with gaps --- diff --git a/test/jalview/controller/AlignViewControllerTest.java b/test/jalview/controller/AlignViewControllerTest.java index d7f7acb..8c81d51 100644 --- a/test/jalview/controller/AlignViewControllerTest.java +++ b/test/jalview/controller/AlignViewControllerTest.java @@ -37,10 +37,10 @@ public class AlignViewControllerTest @Test(groups = "Functional") public void testFindColumnsWithFeature() { - SequenceI seq1 = new Sequence("seq1", "aMMMaaaaaaaaaaaaaaaa"); - SequenceI seq2 = new Sequence("seq2", "aaaMMMMMMMaaaaaaaaaa"); - SequenceI seq3 = new Sequence("seq3", "aaaaaaaaaaMMMMMaaaaa"); - SequenceI seq4 = new Sequence("seq3", "aaaaaaaaaaaaaaaaaaaa"); + SequenceI seq1 = new Sequence("seq1", "-a-MMMaaaaaaaaaaaaaaaa"); + SequenceI seq2 = new Sequence("seq2", "aa--aMM-MMMMMaaaaaaaaaa"); + SequenceI seq3 = new Sequence("seq3", "abcab-caD-aaMMMMMaaaaa"); + SequenceI seq4 = new Sequence("seq4", "abc--abcaaaaaaaaaaaaaa"); /* * features start/end are base 1 @@ -58,11 +58,11 @@ public class AlignViewControllerTest 0f, null)); /* - * select the first three columns --> Metal in seq1 2-3 + * select the first five columns --> Metal in seq1 cols 4-5 */ SequenceGroup sg = new SequenceGroup(); sg.setStartRes(0); // base 0 - sg.setEndRes(2); + sg.setEndRes(4); sg.addSequence(seq1, false); sg.addSequence(seq2, false); sg.addSequence(seq3, false); @@ -73,36 +73,37 @@ public class AlignViewControllerTest bs); assertEquals(1, seqCount); assertEquals(2, bs.cardinality()); - assertTrue(bs.get(1)); - assertTrue(bs.get(2)); + assertTrue(bs.get(3)); // base 0 + assertTrue(bs.get(4)); /* - * select the first four columns: Metal in seq1 2:4, seq2 4:4 + * select the first seven columns: Metal in seq1 cols 4-6, seq2 cols 6-7 */ - sg.setEndRes(3); + sg.setEndRes(6); bs.clear(); seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, bs); assertEquals(2, seqCount); - assertEquals(3, bs.cardinality()); - assertTrue(bs.get(1)); - assertTrue(bs.get(2)); + assertEquals(4, bs.cardinality()); assertTrue(bs.get(3)); + assertTrue(bs.get(4)); + assertTrue(bs.get(5)); + assertTrue(bs.get(6)); /* - * select column 11: Metal in seq3 only + * select column 14: Metal in seq3 only */ - sg.setStartRes(10); - sg.setEndRes(10); + sg.setStartRes(13); + sg.setEndRes(13); bs.clear(); seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, bs); assertEquals(1, seqCount); assertEquals(1, bs.cardinality()); - assertTrue(bs.get(10)); + assertTrue(bs.get(13)); /* - * select columns 16-20: no Metal feature + * select columns 18-20: no Metal feature */ - sg.setStartRes(15); + sg.setStartRes(17); sg.setEndRes(19); bs.clear(); seqCount = AlignViewController.findColumnsWithFeature("Metal", sg, bs); @@ -110,10 +111,10 @@ public class AlignViewControllerTest assertEquals(0, bs.cardinality()); /* - * columns 9-11 should not match disulfide bond at 8/12 + * columns 11-13 should not match disulfide bond at 8/12 */ - sg.setStartRes(8); - sg.setEndRes(10); + sg.setStartRes(10); + sg.setEndRes(12); bs.clear(); seqCount = AlignViewController.findColumnsWithFeature("disulfide bond", sg, bs); @@ -121,17 +122,17 @@ public class AlignViewControllerTest assertEquals(0, bs.cardinality()); /* - * columns 6-14 should match disulfide bond at 8/12 + * columns 6-18 should match disulfide bond at columns 9, 14 */ sg.setStartRes(5); - sg.setEndRes(13); + sg.setEndRes(17); bs.clear(); seqCount = AlignViewController.findColumnsWithFeature("disulfide bond", sg, bs); assertEquals(1, seqCount); assertEquals(2, bs.cardinality()); - assertTrue(bs.get(7)); - assertTrue(bs.get(11)); + assertTrue(bs.get(8)); + assertTrue(bs.get(13)); /* * look for a feature that isn't there