return begin;
}
+ /**
+ * Return 1 for forward strand ('+' in GFF), -1 for reverse strand ('-' in
+ * GFF), and 0 for unknown or not (validly) specified
+ *
+ * @return
+ */
public int getStrand()
{
- String str;
- if (otherDetails == null
- || (str = otherDetails.get("STRAND").toString()) == null)
- {
- return 0;
- }
- if (str.equals("-"))
- {
- return -1;
- }
- if (str.equals("+"))
+ int strand = 0;
+ if (otherDetails != null)
{
- return 1;
+ Object str = otherDetails.get("STRAND");
+ if ("-".equals(str))
+ {
+ strand = -1;
+ }
+ else if ("+".equals(str))
+ {
+ strand = 1;
+ }
}
- return 0;
+ return strand;
}
}
Integer i = new Integer(27);
assertSame(i, sf1.getValue("Unknown", i));
}
+
+ /**
+ * Tests the method that returns 1 / -1 / 0 for strand "+" / "-" / other
+ */
+ @Test(groups = { "Functional" })
+ public void testGetStrand()
+ {
+ SequenceFeature sf = new SequenceFeature("type", "desc", 22, 33, 12.5f,
+ "group");
+ assertEquals(0, sf.getStrand());
+ sf.setValue("STRAND", "+");
+ assertEquals(1, sf.getStrand());
+ sf.setValue("STRAND", "-");
+ assertEquals(-1, sf.getStrand());
+ sf.setValue("STRAND", ".");
+ assertEquals(0, sf.getStrand());
+ }
}