當前位置: 首頁>>代碼示例>>Java>>正文


Java ReadClipper.addOp方法代碼示例

本文整理匯總了Java中org.broadinstitute.hellbender.utils.clipping.ReadClipper.addOp方法的典型用法代碼示例。如果您正苦於以下問題:Java ReadClipper.addOp方法的具體用法?Java ReadClipper.addOp怎麽用?Java ReadClipper.addOp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.broadinstitute.hellbender.utils.clipping.ReadClipper的用法示例。


在下文中一共展示了ReadClipper.addOp方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleTrimmed

import org.broadinstitute.hellbender.utils.clipping.ReadClipper; //導入方法依賴的package包/類
private static GATKRead handleTrimmed(final GATKRead read) {
    // store the start and the end, and remove the tags
    // the tags should be removed here because the completely trimmed flag is set
    // before removing and thus if the read was trimmed the length is not longer the same
    final int start = RTReadUtils.getTrimmingStartPoint(read);
    final int end = RTReadUtils.getTrimmingEndPoint(read);
    RTReadUtils.clearTrimmingPointTags(read);

    if (read.isUnmapped()) {
        final byte[] newBases = Arrays.copyOfRange(read.getBases(), start, end);
        final byte[] newQuals = Arrays.copyOfRange(read.getBaseQualities(), start, end);
        read.setBases(newBases);
        read.setBaseQualities(newQuals);
    } else {
        final int readLength = read.getLength();
        final ReadClipper clipper = new ReadClipper(read);
        // we have to clip the end first, because the read clipper works in a step-wise way
        if (end != readLength) {
            clipper.addOp(new ClippingOp(end, readLength));
        }
        if (start != 0) {
            // we should remove 1 for correctly clipping
            clipper.addOp(new ClippingOp(0, start - 1));
        }
        // this should modify in place here
        modifyWithClipped(read, clipper.clipRead(ClippingRepresentation.HARDCLIP_BASES));
        // return the same read
    }

    // it is modified in place
    return read;
}
 
開發者ID:magicDGS,項目名稱:ReadTools,代碼行數:33,代碼來源:ApplyTrimResultReadTransfomer.java

示例2: clipReadRightEnd

import org.broadinstitute.hellbender.utils.clipping.ReadClipper; //導入方法依賴的package包/類
private GATKRead clipReadRightEnd(GATKRead read) {
    final byte[] quals = read.getBaseQualities();
    final int clipPoint = getRightClipPoint(quals);
    if (clipPoint != -1) {
        final ReadClipper readClipper = new ReadClipper(read);
        readClipper.addOp(new ClippingOp(clipPoint, read.getLength()));
        return readClipper.clipRead(ClippingRepresentation.HARDCLIP_BASES);
    } else {
        return read;
    }
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:12,代碼來源:BaseQualityClipReadTransformer.java

示例3: clipReadLeftEnd

import org.broadinstitute.hellbender.utils.clipping.ReadClipper; //導入方法依賴的package包/類
private GATKRead clipReadLeftEnd(GATKRead read) {
    final byte[] quals = read.getBaseQualities();
    final int clipPoint = getLeftClipPoint(quals);
    if (clipPoint != -1) {
        final ReadClipper readClipper = new ReadClipper(read);
        readClipper.addOp(new ClippingOp(0, clipPoint));
        return readClipper.clipRead(ClippingRepresentation.HARDCLIP_BASES);
    } else {
        return read;
    }
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:12,代碼來源:BaseQualityClipReadTransformer.java

示例4: apply

import org.broadinstitute.hellbender.utils.clipping.ReadClipper; //導入方法依賴的package包/類
@Override
public GATKRead apply(final GATKRead read) {
    if (read.getLength() < minClipLength) return read;
    final byte[] bases = read.getBases();

    //Be sure to find the best match in case one adapter ends with another adapter's sequence (within maxMismatches difference)
    int bestNumMismatches = maxMismatches;
    int bestAlignmentStart = bases.length;
    boolean foundAdapter = false;

    //Adapter list loop
    for (final String adapterSequence : adapterSequences) {
        //Start at the end of the read and walk backwards
        int alignmentLength = minClipLength;
        for (int alignmentStart = bases.length - minClipLength; alignmentStart >= 0; alignmentStart--) {
            int numMismatches = 0;
            //Check each base for mismatches
            for (int j = 0; j < alignmentLength; j++) {
                if (!SequenceUtil.isNoCall((byte) adapterSequence.charAt(j)) && bases[alignmentStart + j] != adapterSequence.charAt(j)) {
                    if (++numMismatches > maxMismatches) break;
                }
            }
            if (numMismatches < bestNumMismatches || (numMismatches == bestNumMismatches && alignmentStart < bestAlignmentStart)) {
                //We have a (better/earlier) match
                bestNumMismatches = numMismatches;
                bestAlignmentStart = alignmentStart;
                foundAdapter = true;
            }
            alignmentLength = alignmentLength < adapterSequence.length() ? alignmentLength + 1 : alignmentLength;
        }
    }
    if (foundAdapter) {
        //Hard clip from the beginning of the adapter to the end of the read
        final ReadClipper readClipper = new ReadClipper(read);
        readClipper.addOp(new ClippingOp(bestAlignmentStart, read.getLength()));
        return readClipper.clipRead(ClippingRepresentation.HARDCLIP_BASES);
    }
    return read;
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:40,代碼來源:AdapterTrimTransformer.java

示例5: maskRead

import org.broadinstitute.hellbender.utils.clipping.ReadClipper; //導入方法依賴的package包/類
private GATKRead maskRead(final GATKRead read, final int maskStart, final int maskEnd) {
    final ReadClipper readClipper = new ReadClipper(read);
    readClipper.addOp(new ClippingOp(maskStart, maskEnd - 1));
    return readClipper.clipRead(ClippingRepresentation.WRITE_NS_Q0S);
}
 
開發者ID:broadinstitute,項目名稱:gatk,代碼行數:6,代碼來源:SimpleRepeatMaskTransformer.java


注:本文中的org.broadinstitute.hellbender.utils.clipping.ReadClipper.addOp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。