本文整理汇总了Java中htsjdk.samtools.fastq.FastqRecord.getBaseQualityHeader方法的典型用法代码示例。如果您正苦于以下问题:Java FastqRecord.getBaseQualityHeader方法的具体用法?Java FastqRecord.getBaseQualityHeader怎么用?Java FastqRecord.getBaseQualityHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.fastq.FastqRecord
的用法示例。
在下文中一共展示了FastqRecord.getBaseQualityHeader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: FastqGATKRead
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
/**
* Creates a GATKRead from a FastqRecord and a header.
*
* @param header the header for the record.
* @param record the record to use as GATKRead.
*/
public FastqGATKRead(final SAMFileHeader header, final FastqRecord record) {
super(new SAMRecord(header));
Utils.nonNull(record, "null record");
// update the record with the read name information
FastqReadNameEncoding.updateReadFromReadName(this, record.getReadName());
// set the bases and the qualities
this.setBases(record.getReadBases());
this.setBaseQualities(record.getBaseQualities());
// add the comments in the quality header to the comment if present
final String baseQualHeader = record.getBaseQualityHeader();
if (baseQualHeader != null) {
// the default tag in the specs is CO
this.setAttribute(SAMTag.CO.toString(), baseQualHeader);
}
this.setIsUnmapped();
if (this.isPaired()) {
this.setMateIsUnmapped();
}
}
示例2: createNewFastqRecordWithAdditionalAnnotation
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
private static FastqRecord createNewFastqRecordWithAdditionalAnnotation(FastqRecord record, String additionalAnnotation, String sequence, String quality) {
String seqHeaderPrefix = record.getReadHeader();
String seqLine = record.getReadString();
if (sequence != null) {
seqLine = sequence;
}
String qualHeaderPrefix = record.getBaseQualityHeader();
if (qualHeaderPrefix != null) {
qualHeaderPrefix += additionalAnnotation;
} else {
qualHeaderPrefix = additionalAnnotation;
}
String qualLine = record.getBaseQualityString();
if (quality != null) {
qualLine = quality;
}
FastqRecord newRecord = new FastqRecord(seqHeaderPrefix, seqLine, qualHeaderPrefix, qualLine);
return newRecord;
}
示例3: reverseCompliment
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
public static void reverseCompliment(File inputFastqFile, File outputFastqFile) {
try (FastqWriter writer = new FastqWriter(outputFastqFile)) {
try (FastqReader reader = new FastqReader(inputFastqFile)) {
while (reader.hasNext()) {
FastqRecord record = reader.next();
ISequence sequence = new NucleotideCodeSequence(record.getReadString());
ISequence newSequence = sequence.getCompliment();
String qualityString = record.getBaseQualityString();
String newQualityString = qualityString;// StringUtil.reverse(qualityString);
FastqRecord newRecord = new FastqRecord(record.getReadHeader(), newSequence.toString(), record.getBaseQualityHeader(), newQualityString);
writer.write(newRecord);
}
}
}
}
示例4: write
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
public void write(FastqRecord record) {
try {
String recordAsString = FastqConstants.SEQUENCE_HEADER + record.getReadHeader() + StringUtil.NEWLINE + record.getReadString() + StringUtil.NEWLINE + FastqConstants.QUALITY_HEADER
+ (record.getBaseQualityHeader() == null ? "" : record.getBaseQualityHeader()) + StringUtil.NEWLINE + record.getBaseQualityString() + StringUtil.NEWLINE;
writer.write(recordAsString.getBytes());
} catch (IOException e) {
throw new IllegalStateException(e.getMessage(), e);
}
}
示例5: trim
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
static FastqRecord trim(FastqRecord record, int firstBaseToKeep, int lastBaseToKeep, boolean performThreePrimeTrimming, int recordIndex) {
String readName = record.getReadHeader();
String readString = record.getReadString();
String readQuality = record.getBaseQualityString();
TrimmedRead trimmedRead = trim(readString, readQuality, firstBaseToKeep, lastBaseToKeep, performThreePrimeTrimming);
FastqRecord newRecord = new FastqRecord(readName, trimmedRead.getTrimmedReadString(), record.getBaseQualityHeader(), trimmedRead.getTrimmedReadQuality());
return newRecord;
}
示例6: Record
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
Record(final FastqRecord rec)
{
name=rec.getReadName();
sequence=rec.getReadString();
name2=rec.getBaseQualityHeader();
qualities=rec.getBaseQualityString();
}
示例7: run
import htsjdk.samtools.fastq.FastqRecord; //导入方法依赖的package包/类
private void run(FastqReader r,PrintStream out)
{
String s;
long nRec=0L;
r.setValidationStringency(ValidationStringency.LENIENT);
while(r.hasNext())
{
if(++nRec%1E6==0)
{
LOG.info("N-Reads:"+nRec);
}
FastqRecord fastq=r.next();
out.print(FastqConstants.SEQUENCE_HEADER);
out.println(fastq.getReadName());
s=fastq.getReadString();
if((this.only_R2 && nRec%2==1) || (this.only_R1 && nRec%2==0) ) //interleaced
{
out.print(s);
}
else
{
for(int i=s.length()-1;i>=0;i--)
{
out.print(AcidNucleics.complement(s.charAt(i)));
}
}
out.println();
out.print(FastqConstants.QUALITY_HEADER);
s=fastq.getBaseQualityHeader();
if(s!=null) out.print(s);
out.println();
s=fastq.getBaseQualityString();
if((this.only_R2 && nRec%2==1) || (this.only_R1 && nRec%2==0) ) //interleaced
{
out.print(s);
}
else
{
for(int i=s.length()-1;i>=0;i--)
{
out.print(s.charAt(i));
}
}
out.println();
if(out.checkError()) break;
}
out.flush();
LOG.info("Done. N-Reads:"+nRec);
}