集册 Java实例教程 将一个字节数组(其中每个字节都是二进制质量分数)转换为质量分数的可打印ASCII表示形式。

将一个字节数组(其中每个字节都是二进制质量分数)转换为质量分数的可打印ASCII表示形式。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

506
将一个字节数组(其中每个字节都是二进制质量分数)转换为质量分数的可打印ASCII表示形式。

/*

 * 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.nowjava;


public class Main {/*nowjava - 时代Java*/

    /**

     * Convert an array of bytes, in which each byte is a binary phred quality

     * score, to printable ASCII representation of the quality scores.

     * @param buffer Array of bytes in which each byte is a binary phred score.

     * @param offset Where in buffer to start conversion.

     * @param length How many bytes of buffer to convert.

     * @param reverse if the binary phred score is to be reversed

     * @return String with ASCII representation of those quality scores.

     */

    public static String phredToFastq(final byte[] buffer,

            final int offset, final int length, final boolean reverse) {

        final char[] chars = new char[length];

        for (
展开阅读全文