Java Code Examples for htsjdk.samtools.util.StringUtil#charsToBytes()

The following examples show how to use htsjdk.samtools.util.StringUtil#charsToBytes() . 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: SNPUMIBasePileupTest.java    From Drop-seq with MIT License 6 votes vote down vote up
@Test(enabled=true)
/**
 * Add an uneven number of bases and quals to trip the exception throw.
 */
public void testAddBaseQualsError () {
	int snpPos=76227022;
	Interval snpInterval = new Interval("HUMAN_1", snpPos, snpPos, true, "test");
	SNPUMIBasePileup p = new SNPUMIBasePileup(snpInterval, "ACADM", "fake_cell", "AAAAA");
	char [] bases = {'A', 'A'};
	byte [] quals = {27,17,55};
	byte [] bases2 = new byte [bases.length];
	StringUtil.charsToBytes(bases, 0, bases.length, bases2, 0);
	boolean passes=false;
	try {
		p.setBasesAndQualities(bases2, quals);
	} catch (IllegalArgumentException e) {
		Assert.assertNotNull(e);
		passes=true;
	}
	Assert.assertTrue(passes);
}
 
Example 2
Source File: SNPUMIBasePileupTest.java    From Drop-seq with MIT License 6 votes vote down vote up
@Test(enabled=true)
public void testAddBaseQuals () {
	int snpPos=76227022;
	Interval snpInterval = new Interval("HUMAN_1", snpPos, snpPos, true, "test");
	SNPUMIBasePileup p = new SNPUMIBasePileup(snpInterval, "ACADM", "fake_cell", "AAAAA");
	char [] bases = {'A', 'A'};
	byte [] quals = {27,55};
	byte [] bases2 = new byte [bases.length];
	StringUtil.charsToBytes(bases, 0, bases.length, bases2, 0);
	boolean passes=true;
	try {
		p.setBasesAndQualities(bases2, quals);
	} catch (IllegalArgumentException e) {
		passes=false;
	}
	Assert.assertTrue(passes);
}
 
Example 3
Source File: DigitalAlleleCountsTest.java    From Drop-seq with MIT License 5 votes vote down vote up
private SNPUMIBasePileup buildPileUp (final DigitalAlleleCounts dac, final String molecularBarcode, final char [] bases, final byte [] qualities) {
	SNPUMIBasePileup p = new SNPUMIBasePileup(dac.getSnpInterval(), dac.getGene(), dac.getCell(), molecularBarcode);
	byte [] bases2 = new byte [bases.length];
	StringUtil.charsToBytes(bases, 0, bases.length, bases2, 0);
	p.setBasesAndQualities(bases2, qualities);
	return (p);
}
 
Example 4
Source File: SummarizeUMIBaseQualitiesTest.java    From Drop-seq with MIT License 4 votes vote down vote up
private byte [] getBases (final char [] bases) {
	byte [] result = new byte [bases.length];
	StringUtil.charsToBytes(bases, 0, bases.length, result, 0);
	return (result);
}