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


Java QualityEncodingDetector类代码示例

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


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

示例1: determineQualityFormat

import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
/**
 * Looks at fastq input(s) and attempts to determine the proper quality format
 *
 * Closes the reader(s) by side effect
 *
 * @param reader1 The first fastq input
 * @param reader2 The second fastq input, if necessary. To not use this input, set it to null
 * @param expectedQuality If provided, will be used for sanity checking. If left null, autodetection will occur
 */
public static FastqQualityFormat determineQualityFormat(final FastqReader reader1, final FastqReader reader2, final FastqQualityFormat expectedQuality) {
    final QualityEncodingDetector detector = new QualityEncodingDetector();

    if (reader2 == null) {
        detector.add(QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, reader1);
    } else {
        detector.add(QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, reader1, reader2);
        reader2.close();
    }

    reader1.close();

    final FastqQualityFormat qualityFormat =  detector.generateBestGuess(QualityEncodingDetector.FileContext.FASTQ, expectedQuality);
    if (detector.isDeterminationAmbiguous()) {
        LOG.warn("Making ambiguous determination about fastq's quality encoding; more than one format possible based on observed qualities.");
    }
    LOG.info(String.format("Auto-detected quality format as: %s.", qualityFormat));

    return qualityFormat;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:30,代码来源:FastqToSam.java

示例2: createReadGroupFormatMap

import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
private Map<SAMReadGroupRecord, FastqQualityFormat> createReadGroupFormatMap(
        final SAMFileHeader inHeader,
        final File referenceSequence,
        final ValidationStringency validationStringency,
        final File input,
        final boolean restoreOriginalQualities) {

    final Map<SAMReadGroupRecord, FastqQualityFormat> readGroupToFormat = new HashMap<>();

    // Figure out the quality score encoding scheme for each read group.
    for (final SAMReadGroupRecord rg : inHeader.getReadGroups()) {
        final SamReader reader = SamReaderFactory.makeDefault().referenceSequence(referenceSequence).validationStringency(validationStringency).open(input);
        final SamRecordFilter filter = new SamRecordFilter() {
            public boolean filterOut(final SAMRecord rec) {
                return !rec.getReadGroup().getId().equals(rg.getId());
            }

            public boolean filterOut(final SAMRecord first, final SAMRecord second) {
                throw new UnsupportedOperationException();
            }
        };
        readGroupToFormat.put(rg, QualityEncodingDetector.detect(QualityEncodingDetector.DEFAULT_MAX_RECORDS_TO_ITERATE, new FilteringSamIterator(reader.iterator(), filter), restoreOriginalQualities));
        CloserUtil.close(reader);
    }
    for (final SAMReadGroupRecord r : readGroupToFormat.keySet()) {
        log.info("Detected quality format for " + r.getReadGroupId() + ": " + readGroupToFormat.get(r));
    }
    if (readGroupToFormat.values().contains(FastqQualityFormat.Solexa)) {
        throw new PicardException("No quality score encoding conversion implemented for " + FastqQualityFormat.Solexa);
    }

    return readGroupToFormat;
}
 
开发者ID:broadinstitute,项目名称:picard,代码行数:34,代码来源:RevertSam.java

示例3: guessFormat

import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
/**
 * Guesses the format of a FastqRecord
 *
 * @param record a FastqRecord of unknown format
 * @return the best guess;
 */
public FastqQualityFormat guessFormat(FastqRecord record)
{
    QualityEncodingDetector detector = new QualityEncodingDetector();
    detector.add(record);
    FastqQualityFormat qual = detector.generateBestGuess(QualityEncodingDetector.FileContext.FASTQ, FastqQualityFormat.Illumina);
    System.out.println("Qualaty encoding: " + qual.toString());
    return qual;
}
 
开发者ID:ethering,项目名称:GenomeHelper,代码行数:15,代码来源:FastqQC.java

示例4: getReaderQualityEncoding

import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
@Override
protected FastqQualityFormat getReaderQualityEncoding(final SamReader reader,
        final long maxNumberOfReads) {
    return QualityEncodingDetector.detect(maxNumberOfReads, reader);
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:6,代码来源:SamSourceHandler.java

示例5: getReaderQualityEncoding

import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
@Override
protected FastqQualityFormat getReaderQualityEncoding(final FastqReader reader,
        long maxNumberOfReads) {
    return QualityEncodingDetector.detect(maxNumberOfReads, reader);
}
 
开发者ID:magicDGS,项目名称:ReadTools,代码行数:6,代码来源:FastqSourceHandler.java


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