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


Java SAMRecord.setAttribute方法代码示例

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


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

示例1: parseTag

import htsjdk.samtools.SAMRecord; //导入方法依赖的package包/类
private void parseTag(final SAMRecord samRecord, final String tag) {
    Map.Entry<String, Object> entry = null;
    try {
        entry = tagCodec.decode(tag);
    } catch (SAMFormatException e) {
        e.printStackTrace();
    }
    if (entry != null) {
        if (entry.getValue() instanceof TagValueAndUnsignedArrayFlag) {
            final TagValueAndUnsignedArrayFlag valueAndFlag =
                    (TagValueAndUnsignedArrayFlag) entry.getValue();
            if (valueAndFlag.isUnsignedArray) {
                samRecord.setUnsignedArrayAttribute(entry.getKey(),
                        valueAndFlag.value);
            } else {
                samRecord.setAttribute(entry.getKey(), valueAndFlag.value);
            }
        } else {
            samRecord.setAttribute(entry.getKey(), entry.getValue());
        }
    }
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:23,代码来源:Basic2SAMRecordTransfer.java

示例2: baqRead

import htsjdk.samtools.SAMRecord; //导入方法依赖的package包/类
/**
 * Modifies read in place so that the base quality scores are capped by the BAQ calculation.  Uses the BAQ
 * tag if present already and alwaysRecalculate is false, otherwise fires up the HMM and does the BAQ on the fly
 * using the refReader to obtain the reference bases as needed.
 *
 * @param read
 * @param refContentProvider
 * @param calculationType
 * @return BQ qualities for use, in case qmode is DONT_MODIFY
 */
public byte[] baqRead(SAMRecord read, RefContentProvider refContentProvider, CalculationMode calculationType, QualityMode qmode ) {
    if ( DEBUG ) System.out.printf("BAQ %s read %s%n", calculationType, read.getReadName());

    byte[] BAQQuals = read.getBaseQualities();      // in general we are overwriting quals, so just get a pointer to them
    if ( calculationType == CalculationMode.OFF) { // we don't want to do anything
        ; // just fall though
    } else if ( excludeReadFromBAQ(read) ) {
        ; // just fall through
    } else {
        final boolean readHasBAQTag = hasBAQTag(read);

        if ( calculationType == CalculationMode.RECALCULATE || ! readHasBAQTag ) {
            if ( DEBUG ) System.out.printf("  Calculating BAQ on the fly%n");
            BAQCalculationResult hmmResult = calcBAQFromHMM(read, refContentProvider);
            if ( hmmResult != null ) {
                switch ( qmode ) {
                    case ADD_TAG:         addBAQTag(read, hmmResult.bq); break;
                    case OVERWRITE_QUALS: System.arraycopy(hmmResult.bq, 0, read.getBaseQualities(), 0, hmmResult.bq.length); break;
                    case DONT_MODIFY:     BAQQuals = hmmResult.bq; break;
                    default:              throw new ReviewedGATKException("BUG: unexpected qmode " + qmode);
                }
            } else if ( readHasBAQTag ) {
                // remove the BAQ tag if it's there because we cannot trust it
                read.setAttribute(BAQ_TAG, null);
            }
        } else if ( qmode == QualityMode.OVERWRITE_QUALS ) { // only makes sense if we are overwriting quals
            if ( DEBUG ) System.out.printf("  Taking BAQ from tag%n");
            // this overwrites the original qualities
            calcBAQFromTag(read, true, false);
        }
    }

    return BAQQuals;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:45,代码来源:BAQ.java

示例3: addBAQTag

import htsjdk.samtools.SAMRecord; //导入方法依赖的package包/类
public static void addBAQTag(SAMRecord read, byte[] baq) {
    read.setAttribute(BAQ_TAG, encodeBQTag(read, baq));
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:4,代码来源:BAQ.java


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