BugFix: byte overflow in SyntheticRead compressed base counts

* fixed and added unit test
This commit is contained in:
Mauricio Carneiro 2011-11-21 14:50:51 -05:00
parent 44554b2bfd
commit 5ad3dfcd62
2 changed files with 6 additions and 2 deletions

View File

@ -188,6 +188,10 @@ public class MathUtils {
return ! Double.isInfinite(val) && ! Double.isNaN(val);
}
public static double bound(double value, double minBoundary, double maxBoundary) {
return Math.max(Math.min(value, maxBoundary), minBoundary);
}
public static boolean isBounded(double val, double lower, double upper) {
return val >= lower && val <= upper;
}

View File

@ -16,8 +16,8 @@ public class ReadUtilsUnitTest extends BaseTest {
GATKSAMRecord read, reducedRead;
final static String BASES = "ACTG";
final static String QUALS = "!+5?";
final private static byte[] REDUCED_READ_COUNTS = new byte[]{10, 20, 30, 40};
final private static byte[] REDUCED_READ_COUNTS_TAG = new byte[]{10, 10, 20, 30}; // just the offsets
final private static byte[] REDUCED_READ_COUNTS = new byte[]{10, 20, 30, 40, 1};
final private static byte[] REDUCED_READ_COUNTS_TAG = new byte[]{10, 10, 20, 30, -9}; // just the offsets
@BeforeTest
public void init() {