+
+ sf = sfs[5];
+ assertEquals("type9", sf.getType());
+ assertEquals(6, sf.getBegin());
+ assertEquals(6, sf.getEnd());
+ }
+
+ /**
+ * Tests for transferring features between mapped sequences
+ */
+ @Test(groups = { "Functional" })
+ public void testTransferFeatures_withOmit()
+ {
+ SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt");
+ SequenceI cds = new Sequence("cds/10-15", "TAGGCC");
+
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 6 }, 1, 1);
+
+ // [5, 11] maps to [2, 5]
+ dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f,
+ null));
+ // [4, 12] maps to [1, 6]
+ dna.addSequenceFeature(new SequenceFeature("type5", "desc5", 4, 12, 5f,
+ null));
+ // [12, 12] maps to [6, 6]
+ dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12,
+ 8f, null));
+
+ // desc4 and desc8 are the 'omit these' varargs
+ AlignmentUtils.transferFeatures(dna, cds, map, null, "type4", "type8");
+ SequenceFeature[] sfs = cds.getSequenceFeatures();
+ assertEquals(1, sfs.length);
+
+ SequenceFeature sf = sfs[0];
+ assertEquals("type5", sf.getType());
+ assertEquals(1, sf.getBegin());
+ assertEquals(6, sf.getEnd());
+ }
+
+ /**
+ * Tests for transferring features between mapped sequences
+ */
+ @Test(groups = { "Functional" })
+ public void testTransferFeatures_withSelect()
+ {
+ SequenceI dna = new Sequence("dna/20-34", "acgTAGcaaGCCcgt");
+ SequenceI cds = new Sequence("cds/10-15", "TAGGCC");
+
+ MapList map = new MapList(new int[] { 4, 6, 10, 12 },
+ new int[] { 1, 6 }, 1, 1);
+
+ // [5, 11] maps to [2, 5]
+ dna.addSequenceFeature(new SequenceFeature("type4", "desc4", 5, 11, 4f,
+ null));
+ // [4, 12] maps to [1, 6]
+ dna.addSequenceFeature(new SequenceFeature("type5", "desc5", 4, 12, 5f,
+ null));
+ // [12, 12] maps to [6, 6]
+ dna.addSequenceFeature(new SequenceFeature("type8", "desc8", 12, 12,
+ 8f, null));
+
+ // "type5" is the 'select this type' argument
+ AlignmentUtils.transferFeatures(dna, cds, map, "type5");
+ SequenceFeature[] sfs = cds.getSequenceFeatures();
+ assertEquals(1, sfs.length);
+
+ SequenceFeature sf = sfs[0];
+ assertEquals("type5", sf.getType());
+ assertEquals(1, sf.getBegin());
+ assertEquals(6, sf.getEnd());