当前位置: 首页>>代码示例>>Java>>正文


Java StringUtil.bytesToString方法代码示例

本文整理汇总了Java中htsjdk.samtools.util.StringUtil.bytesToString方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtil.bytesToString方法的具体用法?Java StringUtil.bytesToString怎么用?Java StringUtil.bytesToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在htsjdk.samtools.util.StringUtil的用法示例。


在下文中一共展示了StringUtil.bytesToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ClusterIntensityFileHeader

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public ClusterIntensityFileHeader(final byte[] headerBytes, final File file) {
    if(headerBytes.length < HEADER_SIZE) {
        throw new PicardException("Bytes past to header constructor are too short excpected(" + HEADER_SIZE + ") received (" + headerBytes.length);
    }

    ByteBuffer buf = ByteBuffer.allocate(headerBytes.length); //for doing some byte conversions
    buf.order(ByteOrder.LITTLE_ENDIAN);
    buf.put(headerBytes);
    buf.position(0);

    final byte[] identifierBuf = new byte[IDENTIFIER.length];
    buf.get(identifierBuf);
    if (!Arrays.equals(identifierBuf, IDENTIFIER)) {
        throw new PicardException("Cluster intensity file " + file + " contains unexpected header: " +
                StringUtil.bytesToString(identifierBuf));
    }
    final byte fileVersion = buf.get();
    if (fileVersion != FILE_VERSION) {
        throw new PicardException("Cluster intensity file " + file + " contains unexpected version: " + fileVersion);
    }
    elementSize = buf.get();
    if (elementSize < 1 || elementSize > 2) {
        throw new PicardException("Cluster intensity file " + file + " contains unexpected element size: " + elementSize);
    }
    // convert these to unsigned
    firstCycle = UnsignedTypeUtil.uShortToInt(buf.getShort());
    numCycles = UnsignedTypeUtil.uShortToInt(buf.getShort());
    if (numCycles == 0) {
        throw new PicardException("Cluster intensity file " + file + " has zero cycles.");
    }
    numClusters = buf.getInt();
    if (numClusters < 0) {
        // It is possible for there to be no clusters in a tile.
        throw new PicardException("Cluster intensity file " + file + " has negative number of clusters: " +numClusters);
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:37,代码来源:ClusterIntensityFileReader.java

示例2: toString

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
@Override
public String toString() {
    return "Bait{" +
            "name=" + getName() +
            ", bases=" + StringUtil.bytesToString(bases) +
            '}';
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:8,代码来源:BaitDesigner.java

示例3: getBaitSequence

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/** Gets the bait sequence, with primers, as a String, RC'd as appropriate. */
private String getBaitSequence(final Bait bait, final boolean rc) {
    String sequence = (LEFT_PRIMER == null ? "" : LEFT_PRIMER) +
            StringUtil.bytesToString(bait.getBases()) +
            (RIGHT_PRIMER == null ? "" : RIGHT_PRIMER);

    if (rc) sequence = SequenceUtil.reverseComplement(sequence);
    return sequence;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:10,代码来源:BaitDesigner.java

示例4: byteArrayToString

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
 * Concatenates all the barcode sequences with BARCODE_DELIMITER
 * @param barcodes
 * @return A single string representation of all the barcodes
 */
public static String byteArrayToString(final byte[][] barcodes, String delim) {
    final String[] bcs = new String[barcodes.length];
    for (int i = 0; i < barcodes.length; i++) {
        bcs[i] = StringUtil.bytesToString(barcodes[i]);
    }
    return stringSeqsToString(bcs, delim);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:13,代码来源:IlluminaUtil.java

示例5: getAlleleString

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
public String getAlleleString() {
    return StringUtil.bytesToString(new byte[] {allele1, StringUtil.toLowerCase(allele2)});
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:4,代码来源:Snp.java

示例6: referenceAlleleMatchesReferenceForIndel

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
 * Checks whether the reference allele in the provided variant context actually matches the reference sequence
 *
 * @param alleles list of alleles from which to find the reference allele
 * @param referenceSequence the ref sequence
 * @param start the start position of the actual indel
 * @param end   the end position of the actual indel
 * @return true if they match, false otherwise
 */
protected static boolean referenceAlleleMatchesReferenceForIndel(final List<Allele> alleles,
                                                                 final ReferenceSequence referenceSequence,
                                                                 final int start,
                                                                 final int end) {
    final String refString = StringUtil.bytesToString(referenceSequence.getBases(), start - 1, end - start + 1);
    final Allele refAllele = alleles.stream().filter(Allele::isReference).findAny().orElseThrow(() -> new IllegalStateException("Error: no reference allele was present"));
    return (refString.equalsIgnoreCase(refAllele.getBaseString()));
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:18,代码来源:LiftoverUtils.java

示例7: getBasesString

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
 * Returns pile of observed bases over the genomic location.
 *
 * Note: this call costs O(n) and allocates fresh array each time
 */
public String getBasesString() {
    return StringUtil.bytesToString(getBases());
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:9,代码来源:SAMPileupFeature.java

示例8: getBasesString

import htsjdk.samtools.util.StringUtil; //导入方法依赖的package包/类
/**
 * @return All bases in the read as a single String, or {@link ReadConstants#NULL_SEQUENCE_STRING}
 *         if the read is empty.
 */
default String getBasesString() {
    return isEmpty() ? ReadConstants.NULL_SEQUENCE_STRING : StringUtil.bytesToString(getBases());
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:8,代码来源:GATKRead.java


注:本文中的htsjdk.samtools.util.StringUtil.bytesToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。