Java examples for Data Structure:DNA
Convert a FASTQ string to a byte array of phred scores.
/*// w ww . j a va 2 s. co m * Copyright (c) 2014. Real Time Genomics Limited. * * Use of this source code is bound by the Real Time Genomics Limited Software Licence Agreement * for Academic Non-commercial Research Purposes only. * * If you did not receive a license accompanying this file, a copy must first be obtained by email * from support@realtimegenomics.com. On downloading, using and/or continuing to use this source * code you accept the terms of that license agreement and any amendments to those terms that may * be made from time to time by Real Time Genomics Limited. */ //package com.java2s; public class Main { /** * Convert a FASTQ string to a byte array of phred scores. * @param string the quality string to convert * @return byte array of phred scores */ public static byte[] fastqToPhred(final String string) { final byte[] bytes = new byte[string.length()]; for (int i = 0; i < string.length(); i++) { bytes[i] = (byte) (string.charAt(i) - 33); } return bytes; } }