/** * Get the DNA sequence. * * @return read sequence as ASCII bytes ACGTN=; {@link SAMRecord#NULL_SEQUENCE} if no bases are present. */ public byte[] getReadBases() { return (readString == null) ? SAMRecord.NULL_SEQUENCE : StringUtil.stringToBytes(readString); }
/** * Get the DNA sequence. * * @return read sequence as ASCII bytes ACGTN=; {@link SAMRecord#NULL_SEQUENCE} if no bases are present. */ public byte[] getReadBases() { return (readString == null) ? SAMRecord.NULL_SEQUENCE : StringUtil.stringToBytes(readString); }
CustomAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }
private IlluminaAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }
public BarcodeMetric(final String barcodeName, final String libraryName, final String barcodeDisplay, final String[] barcodeSeqs) { this.BARCODE = barcodeDisplay; this.BARCODE_WITHOUT_DELIMITER = barcodeDisplay.replaceAll(IlluminaUtil.BARCODE_DELIMITER, ""); this.BARCODE_NAME = barcodeName; this.LIBRARY_NAME = libraryName; this.barcodeBytes = new byte[barcodeSeqs.length][]; for (int i = 0; i < barcodeSeqs.length; i++) { barcodeBytes[i] = htsjdk.samtools.util.StringUtil.stringToBytes(barcodeSeqs[i]); } }
private TruncatedAdapterPair(final String name, final String threePrimeReadOrder, final String fivePrimeReadOrder) { this.name = name; this.threePrime = threePrimeReadOrder; this.threePrimeBytes = StringUtil.stringToBytes(threePrimeReadOrder); this.fivePrimeReadOrder = fivePrimeReadOrder; this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); this.fivePrime = SequenceUtil.reverseComplement(fivePrimeReadOrder); this.fivePrimeBytes = StringUtil.stringToBytes(this.fivePrime); }
CustomAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }
private TruncatedAdapterPair(final String name, final String threePrimeReadOrder, final String fivePrimeReadOrder) { this.name = name; this.threePrime = threePrimeReadOrder; this.threePrimeBytes = StringUtil.stringToBytes(threePrimeReadOrder); this.fivePrimeReadOrder = fivePrimeReadOrder; this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); this.fivePrime = SequenceUtil.reverseComplement(fivePrimeReadOrder); this.fivePrimeBytes = StringUtil.stringToBytes(this.fivePrime); }
private IlluminaAdapterPair(final String fivePrime, final String threePrime) { this.threePrime = threePrime; this.threePrimeBytes = StringUtil.stringToBytes(threePrime); this.fivePrime = fivePrime; this.fivePrimeReadOrder = SequenceUtil.reverseComplement(fivePrime); this.fivePrimeBytes = StringUtil.stringToBytes(fivePrime); this.fivePrimeReadOrderBytes = StringUtil.stringToBytes(fivePrimeReadOrder); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
/** * Truncate to the given length, and in addition truncate any trailing Ns. */ private String substringAndRemoveTrailingNs(final String s, int length) { length = Math.min(length, s.length()); final byte[] bytes = StringUtil.stringToBytes(s); while (length > 0 && SequenceUtil.isNoCall(bytes[length - 1])) { length--; } return s.substring(0, length); }
/** * Write a string to the buffer as ASCII bytes * * @param value string to write */ private void writeString(final String value) { writeBytes(StringUtil.stringToBytes(value)); }
public void setReadString(final String value) { if (NULL_SEQUENCE_STRING.equals(value)) { mReadBases = NULL_SEQUENCE; } else { final byte[] bases = StringUtil.stringToBytes(value); if (bases != null) { SAMUtils.normalizeBases(bases); } setReadBases(bases); } }
/** * Calculate the reverse complement of the specified sequence * (Stolen from Reseq) * * @param sequenceData * @return reverse complement */ public static String reverseComplement(final String sequenceData) { final byte[] bases = htsjdk.samtools.util.StringUtil.stringToBytes(sequenceData); reverseComplement(bases); return htsjdk.samtools.util.StringUtil.bytesToString(bases); }
public static String complement(String string) { final byte[] bases = htsjdk.samtools.util.StringUtil.stringToBytes(string); complement(bases); return htsjdk.samtools.util.StringUtil.bytesToString(bases); }
@Test(dataProvider="clipTestData") public void testBasicClip(final String testName, final String read, final String clip, final int minMatch, final double errRate, final int expected) { final byte[] r = (read == null) ? null : StringUtil.stringToBytes(read); final byte[] c = (clip == null) ? null : StringUtil.stringToBytes(clip); final int result = ClippingUtility.findIndexOfClipSequence(r, c, minMatch, errRate); Assert.assertEquals(result, expected, testName); }
@Test public void testUpperCase() { Assert.assertEquals(SequenceUtil.upperCase(StringUtil.stringToBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ")), StringUtil.stringToBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); Assert.assertEquals(SequenceUtil.upperCase(StringUtil.stringToBytes("abcdefghijklmnopqrstuvwxyz")), StringUtil.stringToBytes("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); Assert.assertEquals(SequenceUtil.upperCase(StringUtil.stringToBytes("1234567890!@#$%^&*()")), StringUtil.stringToBytes("1234567890!@#$%^&*()")); }
@Test(expectedExceptions = SAMFormatException.class) public void testConflictingTags() throws Exception { final String header = "@HD VN:1.0 SO:queryname SO:coordinate"; final InputStream strm = new ByteArrayInputStream(StringUtil.stringToBytes(header)); final SamReader reader = SamReaderFactory.makeDefault().open(SamInputResource.of(strm)); Assert.fail("Exception should have been thrown."); }
@Test public void testRedundantTags() throws Exception { final String header = "@HD VN:1.0 SO:coordinate SO:coordinate"; final InputStream strm = new ByteArrayInputStream(StringUtil.stringToBytes(header)); final SamReader samReader = SamReaderFactory.makeDefault().open(SamInputResource.of(strm)); Assert.assertEquals(SAMFileHeader.SortOrder.coordinate, samReader.getFileHeader().getSortOrder()); CloserUtil.close(samReader); }