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


Java SequenceUtil.isNoCall方法代码示例

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


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

示例1: countMismatches

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Compare barcode sequence to bases from read
 *
 * @return how many bases did not match
 */
private static int countMismatches(final byte[][] barcodeBytes, final byte[][] readSubsequence, final byte[][] qualities, final int minimumBaseQuality) {
    int numMismatches = 0;

    for (int j = 0; j < barcodeBytes.length; j++) {
        for (int i = 0; (i < barcodeBytes[j].length && readSubsequence[j].length > i); ++i) {
            if (SequenceUtil.isNoCall(readSubsequence[j][i])) {
                continue;
            }
            if (!SequenceUtil.basesEqual(barcodeBytes[j][i], readSubsequence[j][i])) {
                ++numMismatches;
                continue;
            }
            if (qualities != null && qualities[j][i] < minimumBaseQuality) {
                ++numMismatches;
            }
        }
    }

    return numMismatches;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:26,代码来源:ExtractIlluminaBarcodes.java

示例2: acceptRead

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
@Override
protected void acceptRead(final SAMRecord rec, final ReferenceSequence ref) {
    // Skip unwanted records
    if (PF_READS_ONLY && rec.getReadFailsVendorQualityCheckFlag()) return;
    if (ALIGNED_READS_ONLY && rec.getReadUnmappedFlag()) return;
    if (rec.isSecondaryOrSupplementary()) return;

    final byte[] bases = rec.getReadBases();
    final byte[] quals = rec.getBaseQualities();
    final byte[] oq    = rec.getOriginalBaseQualities();

    final int length = quals.length;

    for (int i=0; i<length; ++i) {
        if (INCLUDE_NO_CALLS || !SequenceUtil.isNoCall(bases[i])) {
            qCounts[quals[i]]++;
            if (oq != null) oqCounts[oq[i]]++;
        }
    }
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:21,代码来源:QualityScoreDistribution.java

示例3: addRead

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Adds a read to this count object by increasing counts of the base qualities.
 */
Counts addRead(final GATKRead read) {
    final byte[] bases = read.getBases();
    final byte[] quals = read.getBaseQualities();
    final byte[] oq    = ReadUtils.getOriginalBaseQualities(read);

    final int length = quals.length;

    for (int i=0; i<length; ++i) {
        if (includeNoCalls || !SequenceUtil.isNoCall(bases[i])) {
            qCounts[quals[i]]++;
            if (oq != null) {
                oqCounts[oq[i]]++;
            }
        }
    }
    return this;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:21,代码来源:QualityScoreDistributionSpark.java

示例4: passesQualityCheck

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Checks that the average quality over the entire read is >= min, and that the first N bases do
 * not contain any no-calls.
 */
boolean passesQualityCheck(final byte[] bases, final byte[] quals, final int seedLength, final int minQuality) {
    if (bases.length < seedLength) return false;

    for (int i = 0; i < seedLength; ++i) {
        if (SequenceUtil.isNoCall(bases[i])) return false;
    }

    final int maxReadLength = (MAX_READ_LENGTH <= 0) ? Integer.MAX_VALUE : MAX_READ_LENGTH;
    final int readLength = Math.min(bases.length, maxReadLength);
    int total = 0;
    for (int i = 0; i < readLength; i++) total += quals[i];
    return total / readLength >= minQuality;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:18,代码来源:EstimateLibraryComplexity.java

示例5: processRecord

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
private void processRecord(int position, ReferenceSequence ref, EdgingRecordAndOffset record, Set<EdgingRecordAndOffset> recordsAndOffsetsForName) {
    long processedLoci = counter;
    readsNames.put(record.getReadName(), recordsAndOffsetsForName);
    final byte[] qualities = record.getBaseQualities();
    final byte[] bases = record.getRecord().getReadBases();
    for (int i = 0; i < record.getLength(); i++) {
        final int index = i + position;
        if (isReferenceBaseN(index, ref)) {
            continue;
        }
        final byte quality = qualities[i + record.getOffset()];
        if (quality <= 2) {
            basesExcludedByBaseq++;
        } else {
            if (unfilteredDepthSize.get(index) < coverageCap) {
                unfilteredBaseQHistogramArray[quality]++;
                unfilteredDepthSize.increment(index);
            }
            if (quality < collectWgsMetrics.MINIMUM_BASE_QUALITY || SequenceUtil.isNoCall(bases[i + record.getOffset()])){
                basesExcludedByBaseq++;
            } else {
                final int bsq = excludeByQuality(recordsAndOffsetsForName, index);
                if (recordsAndOffsetsForName.size() - bsq > 0) {
                    basesExcludedByOverlap++;
                } else {
                    pileupSize.increment(index);
                }
            }
        }
        if (isTimeToStop(++processedLoci)) {
            break;
        }
    }
    recordsAndOffsetsForName.add(record);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:36,代码来源:FastWgsMetricsCollector.java

示例6: substringAndRemoveTrailingNs

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Truncate to the given length, and in addition truncate any trailing Ns.
 */
private String substringAndRemoveTrailingNs(final String s, int length) {
    length = Math.min(length, s.length());
    final byte[] bytes = StringUtil.stringToBytes(s);
    while (length > 0 && SequenceUtil.isNoCall(bytes[length - 1])) {
        length--;
    }
    return s.substring(0, length);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:12,代码来源:AdapterMarker.java

示例7: apply

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的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

示例8: passesQualityCheck

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Checks that the average quality over the entire read is >= min, and that the first N bases do
 * not contain any no-calls.
 */
boolean passesQualityCheck(final byte[] bases, final byte[] quals, final int seedLength, final int minQuality) {
    if (bases.length < seedLength) return false;

    for (int i = 0; i < seedLength; ++i) {
        if (SequenceUtil.isNoCall(bases[i])) return false;
    }

    int total = 0;
    for (final byte b : quals) total += b;
    return total / quals.length >= minQuality;
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:16,代码来源:EstimateLibraryComplexityGATK.java

示例9: isReferenceBaseN

import htsjdk.samtools.util.SequenceUtil; //导入方法依赖的package包/类
/**
 * Checks if reference base at given position is unknown.
 *
 * @param position to check the base
 * @param ref      reference sequence
 * @return true if reference base at position represents a no call, otherwise false
 */
boolean isReferenceBaseN(final int position, final ReferenceSequence ref) {
    final byte base = ref.getBases()[position - 1];
    return SequenceUtil.isNoCall(base);
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:12,代码来源:AbstractWgsMetricsCollector.java


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