MCPcopy Create free account
hub / github.com/RealTimeGenomics/rtg-tools / stringDNAtoByte

Method stringDNAtoByte

src/main/java/com/rtg/mode/DNA.java:261–267  ·  view source on GitHub ↗

Convert a string containing valid nucleotide characters into a byte array with values (0=N, ... 4=T). @param dna the string to be converted. @return the byte array.

(final String dna)

Source from the content-addressed store, hash-verified

259 * @return the byte array.
260 */
261 public static byte[] stringDNAtoByte(final String dna) {
262 final byte[] dnaBytes = new byte[dna.length()];
263 for (int i = 0; i < dna.length(); ++i) {
264 dnaBytes[i] = (byte) getDNA(dna.charAt(i));
265 }
266 return dnaBytes;
267 }
268
269 /**
270 * Convert a byte array containing valid nucleotide characters into a byte array

Callers 2

testComplementInPlaceMethod · 0.95
testStringDNAtoBytesMethod · 0.95

Calls 2

getDNAMethod · 0.95
lengthMethod · 0.65

Tested by 2

testComplementInPlaceMethod · 0.76
testStringDNAtoBytesMethod · 0.76