Java Code Examples for htsjdk.samtools.util.SequenceUtil#calculateMD5String()
The following examples show how to use
htsjdk.samtools.util.SequenceUtil#calculateMD5String() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReferenceRegionTest.java From cramtools with Apache License 2.0 | 6 votes |
@Test public void test_Start_1() { int start = 1; ReferenceRegion region = new ReferenceRegion(data, 0, "chr1", start); Assert.assertEquals(start, region.alignmentStart); Assert.assertEquals(0, region.arrayPosition(start)); for (int pos = start, index = 0; pos < start + 10; pos++, index++) { Assert.assertEquals(data[index], region.base(pos)); } int len = 10; String expectedMD5 = SequenceUtil.calculateMD5String(data, 0, len); String md5 = region.md5(start, len); Assert.assertEquals(expectedMD5, md5); }
Example 2
Source File: ReferenceRegionTest.java From cramtools with Apache License 2.0 | 6 votes |
@Test public void test_Start_2() { int start = 2; ReferenceRegion region = new ReferenceRegion(data, 0, "chr1", start); Assert.assertEquals(start, region.alignmentStart); Assert.assertEquals(0, region.arrayPosition(start)); for (int pos = start, index = 0; pos < start + 10; pos++, index++) { Assert.assertEquals(data[index], region.base(pos)); } int len = 10; String expectedMD5 = SequenceUtil.calculateMD5String(data, 0, len); String md5 = region.md5(start, len); Assert.assertEquals(expectedMD5, md5); }
Example 3
Source File: ReferenceRegionTest.java From cramtools with Apache License 2.0 | 6 votes |
@Test public void test_HangingEnd() { int start = 2; ReferenceRegion region = new ReferenceRegion(data, 0, "chr1", start); Assert.assertEquals(start, region.alignmentStart); Assert.assertEquals(0, region.arrayPosition(start)); for (int pos = start, index = 0; pos < start + 10; pos++, index++) { Assert.assertEquals(data[index], region.base(pos)); } String expectedMD5 = SequenceUtil.calculateMD5String(data, 0, data.length); String md5 = region.md5(start, data.length + 10); Assert.assertEquals(expectedMD5, md5); md5 = region.md5(start, data.length + 100); Assert.assertEquals(expectedMD5, md5); }
Example 4
Source File: ReferenceRegion.java From cramtools with Apache License 2.0 | 5 votes |
public String md5(int alignmentStart, int alignmentSpan) { int from = (int) (alignmentStart - this.alignmentStart); if (from >= array.length) return SequenceUtil.calculateMD5String(new byte[0], 0, 0); // allow for hanging end: int to = (int) (alignmentStart + alignmentSpan - this.alignmentStart); return SequenceUtil.calculateMD5String(array, from, Math.min(to - from, array.length - from)); }
Example 5
Source File: ReferenceRegionTest.java From cramtools with Apache License 2.0 | 5 votes |
@Test public void test_HangingStartMD5() { ReferenceRegion region = new ReferenceRegion(data, 0, "chr1", 1); int start = data.length + 1; String expectedMD5 = SequenceUtil.calculateMD5String("".getBytes(), 0, 0); String md5 = region.md5(start, 10); Assert.assertEquals(expectedMD5, md5); }