本文整理汇总了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;
}
示例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;
}
示例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;
}
示例4: getReaderQualityEncoding
import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
@Override
protected FastqQualityFormat getReaderQualityEncoding(final SamReader reader,
final long maxNumberOfReads) {
return QualityEncodingDetector.detect(maxNumberOfReads, reader);
}
示例5: getReaderQualityEncoding
import htsjdk.samtools.util.QualityEncodingDetector; //导入依赖的package包/类
@Override
protected FastqQualityFormat getReaderQualityEncoding(final FastqReader reader,
long maxNumberOfReads) {
return QualityEncodingDetector.detect(maxNumberOfReads, reader);
}