}
- /**
+ /*
* Contains the start-end pairs mapping from the associated sequence to the
* sequence in the database coordinate system. It also takes care of step
* difference between coordinate systems.
*/
MapList map = null;
- /**
+ /*
* The sequence that map maps the associated sequence to (if any).
*/
SequenceI to = null;
+ /*
+ * optional sequence id for the 'from' ranges
+ */
+ private String mappedFromId;
+
public Mapping(MapList map)
{
super();
map = new MapList(map2.map);
}
to = map2.to;
+ mappedFromId = map2.mappedFromId;
}
}
: this.to.getName());
}
+ /**
+ * Returns the identifier for the 'from' range sequence, or null if not set
+ *
+ * @return
+ */
+ public String getMappedFromId()
+ {
+ return mappedFromId;
+ }
+
+ /**
+ * Sets the identifier for the 'from' range sequence
+ */
+ public void setMappedFromId(String mappedFromId)
+ {
+ this.mappedFromId = mappedFromId;
+ }
+
}
package jalview.datamodel;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
import jalview.util.MapList;
m = new Mapping(seq, fk);
assertEquals("[ [1, 6] [8, 13] ] 3:1 to [ [4, 7] ] Seq1", m.toString());
}
+
+ @Test(groups = { "Functional" })
+ public void testCopyConstructor()
+ {
+ MapList ml = new MapList(new int[] { 1, 6, 8, 13 }, new int[] { 4, 7 },
+ 3, 1);
+ SequenceI seq = new Sequence("seq1", "agtacg");
+ Mapping m = new Mapping(seq, ml);
+ m.setMappedFromId("abc");
+ Mapping copy = new Mapping(m);
+ assertEquals("abc", copy.getMappedFromId());
+ assertEquals(ml, copy.getMap());
+ assertSame(seq, copy.getTo());
+ }
}