@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
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);
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);
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);
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