@Override
public ContiguousI findPositions(int fromColumn, int toColumn)
{
- if (toColumn < fromColumn || fromColumn < 1)
+ fromColumn = Math.max(fromColumn, 1);
+ if (toColumn < fromColumn)
{
return null;
}
* from 1), or null if no residues are included in the range
*
* @param fromColum
- * - first column base 1
+ * - first column base 1. (0 and negative positions are rounded up)
* @param toColumn
* - last column, base 1
- * @return
+ * @return null if fromColum>toColumn
*/
public ContiguousI findPositions(int fromColum, int toColumn);
* invalid inputs
*/
assertNull(sq.findPositions(6, 5));
- assertNull(sq.findPositions(0, 5));
- assertNull(sq.findPositions(-1, 5));
/*
* all gapped ranges
assertEquals(new Range(11, 12), sq.findPositions(5, 10)); // DE
assertEquals(new Range(8, 13), sq.findPositions(1, 13)); // the lot
assertEquals(new Range(8, 13), sq.findPositions(1, 99));
+
+ /**
+ * now try on a sequence with no gaps
+ */
+ sq.createDatasetSequence();
+ assertEquals(new Range(8, 13),
+ sq.getDatasetSequence().findPositions(1, 99));
+ assertEquals(new Range(8, 13),
+ sq.getDatasetSequence().findPositions(0, 99));
+
}
/**