@Test(groups = { "Functional" })
public void testCopyConstructors()
{
- SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33,
- 12.5f, "group");
+ SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
sf1.setValue("STRAND", "+");
sf1.setValue("Note", "Testing");
Integer count = Integer.valueOf(7);
/*
* copy constructor modifying type/begin/end/group/score
*/
- SequenceFeature sf4 = new SequenceFeature(sf1, "Disulfide bond", 12,
- 15, "group3", -9.1f);
+ SequenceFeature sf4 = new SequenceFeature(sf1, "Disulfide bond", 12, 15,
+ "group3", -9.1f);
assertEquals("Disulfide bond", sf4.getType());
assertTrue(sf4.isContactFeature());
assertEquals("desc", sf4.getDescription());
@Test(groups = { "Functional" })
public void testGetValue()
{
- SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33,
- 12.5f, "group");
+ SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
sf1.setValue("STRAND", "+");
assertEquals("+", sf1.getValue("STRAND"));
assertNull(sf1.getValue("strand")); // case-sensitive
@Test(groups = { "Functional" })
public void testEqualsAndHashCode()
{
- SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33,
- 12.5f, "group");
+ SequenceFeature sf1 = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
sf1.setValue("ID", "id");
sf1.setValue("Name", "name");
sf1.setValue("Parent", "parent");
sf1.setStrand("+");
sf1.setPhase("1");
- SequenceFeature sf2 = new SequenceFeature("type", "desc", 22, 33,
- 12.5f, "group");
+ SequenceFeature sf2 = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
sf2.setValue("ID", "id");
sf2.setValue("Name", "name");
sf2.setValue("Parent", "parent");
assertEquals(sf1.hashCode(), sf2.hashCode());
// changing type breaks equals:
- SequenceFeature sf3 = new SequenceFeature("type", "desc", 22, 33,
- 12.5f, "group");
- SequenceFeature sf4 = new SequenceFeature("Type", "desc", 22, 33,
- 12.5f, "group");
+ SequenceFeature sf3 = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
+ SequenceFeature sf4 = new SequenceFeature("Type", "desc", 22, 33, 12.5f,
+ "group");
assertFalse(sf3.equals(sf4));
// changing description breaks equals:
// changing start position breaks equals:
int restorei = sf2.getBegin();
- sf2 = new SequenceFeature(sf2, 21, sf2.getEnd(), sf2.getFeatureGroup(), sf2.getScore());
+ sf2 = new SequenceFeature(sf2, 21, sf2.getEnd(), sf2.getFeatureGroup(),
+ sf2.getScore());
assertFalse(sf1.equals(sf2));
sf2 = new SequenceFeature(sf2, restorei, sf2.getEnd(),
sf2.getFeatureGroup(), sf2.getScore());
// changing feature group breaks equals:
restores = sf2.getFeatureGroup();
- sf2 = new SequenceFeature(sf2, sf2.getBegin(), sf2.getEnd(), "Group", sf2.getScore());
+ sf2 = new SequenceFeature(sf2, sf2.getBegin(), sf2.getEnd(), "Group",
+ sf2.getScore());
assertFalse(sf1.equals(sf2));
- sf2 = new SequenceFeature(sf2, sf2.getBegin(), sf2.getEnd(), restores, sf2.getScore());
+ sf2 = new SequenceFeature(sf2, sf2.getBegin(), sf2.getEnd(), restores,
+ sf2.getScore());
// changing ID breaks equals:
restores = (String) sf2.getValue("ID");
String seqName = seq.getName();
// single locus, no group, no score
- SequenceFeature sf = new SequenceFeature("variant", "G,C", 22, 22, null);
+ SequenceFeature sf = new SequenceFeature("variant", "G,C", 22, 22,
+ null);
String expected = "<br><table><tr><td>Location</td><td>TestSeq</td><td>22</td></tr>"
+ "<tr><td>Type</td><td>variant</td><td></td></tr>"
+ "<tr><td>Description</td><td>G,C</td><td></td></tr></table>";
+ "<tr><td>Description</td><td>a description</td><td></td></tr></table>";
assertEquals(expected, sf.getDetailsReport(seqName, null));
- sf = new SequenceFeature("variant", "G,C", 22, 33,
- 12.5f, "group");
+ sf = new SequenceFeature("variant", "G,C", 22, 33, 12.5f, "group");
sf.setValue("Parent", "ENSG001");
sf.setValue("Child", "ENSP002");
expected = "<br><table><tr><td>Location</td><td>TestSeq</td><td>22-33</td></tr>"
+ "<tr><td>Type</td><td>variant</td><td></td></tr>"
+ "<tr><td>Description</td><td>G,C</td><td></td></tr>"
+ "<tr><td>Consequence</td><td><i>Translated by Jalview</i></td><td>p.Leu9Phe</td></tr>"
- + "<tr><td>alleles</td><td></td><td>G,C</td></tr>"
+ + "<tr><td>alleles</td><td></td><td>G,C</td></tr>"
+ "</table>";
assertEquals(expected, sf.getDetailsReport(seq.getName(), mf));
+
+
+ /*
+ * exon feature extending beyond mapped range; mapped location should be
+ * restricted to peptide mapped range limit i.e. 10-13
+ */
+ SequenceFeature sf2 = new SequenceFeature("exon", "exon 1", 109, 230, null);
+ features.add(sf2);
+ expected = "<br><table><tr><td>Location</td><td>Cds</td><td>109-230</td></tr>"
+ + "<tr><td>Peptide Location</td><td>TestSeq</td><td>10-13</td></tr>"
+ + "<tr><td>Type</td><td>exon</td><td></td></tr>"
+ + "<tr><td>Description</td><td>exon 1</td><td></td></tr>"
+ + "</table>";
+ assertEquals(expected, sf2.getDetailsReport(seq.getName(), mf));
}
}