/*
* try to parse m..n (or simply m)
+ * also handles <m..n or m..>n (discarding < or >)
*/
String[] range = location.split("\\.\\.");
if (range.length == 1 || range.length == 2)
{
try
{
- int start = Integer.valueOf(range[0]);
- int end = range.length == 1 ? start : Integer.valueOf(range[1]);
+ int start = parseRangeEnd(range[0]);
+ int end = range.length == 1 ? start : parseRangeEnd(range[1]);
return Collections.singletonList(new int[] { start, end });
} catch (NumberFormatException e)
{
}
/**
+ * Returns the integer value of a locus, discarding any < or > prefix
+ *
+ * @throws NumberFormatException
+ * if value is not numeric
+ */
+ static int parseRangeEnd(String loc)
+ {
+
+ if (loc.startsWith("<") || loc.startsWith(">"))
+ {
+ loc = loc.substring(1);
+ }
+ return Integer.valueOf(loc);
+ }
+
+ /**
* Parses a complement(locationSpec) into a list of start-end ranges
*
* @param location