本文整理汇总了Java中htsjdk.samtools.SAMRecord.getFlags方法的典型用法代码示例。如果您正苦于以下问题:Java SAMRecord.getFlags方法的具体用法?Java SAMRecord.getFlags怎么用?Java SAMRecord.getFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsjdk.samtools.SAMRecord
的用法示例。
在下文中一共展示了SAMRecord.getFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transfer
import htsjdk.samtools.SAMRecord; //导入方法依赖的package包/类
/**
* Write the record.
*
* @param alignment SAMRecord.
*/
public BasicSamRecord transfer(final SAMRecord alignment) {
String readName = alignment.getReadName();
int flags = alignment.getFlags();
int contigId = alignment.getReferenceIndex();
if (contigId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) {
contigId = FAKE_CONTIG_ID;
}
String contigName = alignment.getReferenceName();
int position = alignment.getAlignmentStart();
int mapQ = alignment.getMappingQuality();
String cigar = alignment.getCigarString();
int mateContigId = alignment.getMateReferenceIndex();
if (mateContigId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) {
mateContigId = FAKE_CONTIG_ID;
}
String mateContigName = alignment.getMateReferenceName();
int matePosition = alignment.getMateAlignmentStart();
int inferredSize = alignment.getInferredInsertSize();
byte[] sequence = alignment.getReadString().getBytes();
byte[] quality = alignment.getBaseQualityString().getBytes();
List<SAMRecord.SAMTagAndValue> attributes = alignment.getAttributes();
List<String> encodedTags = new ArrayList<>(attributes.size());
for (SAMRecord.SAMTagAndValue attribute : attributes) {
encodedTags.add(tagCodec.encode(attribute.tag, attribute.value));
}
// 在这里统一不压缩,压缩操作是由scala代码中的执行引擎统一调配的。
return BasicSamRecord.apply(false, readName, flags, contigId, contigName, position, mapQ,
cigar, mateContigId, mateContigName, matePosition, inferredSize,
sequence, quality, encodedTags);
}
示例2: add
import htsjdk.samtools.SAMRecord; //导入方法依赖的package包/类
/**
* @param record for processing
* @throws IOException
*/
@Override
public void add(final SAMRecord record) throws IOException {
int start = record.getStart();
int end = record.getEnd();
final List<CigarElement> cigarList = record.getCigar().getCigarElements();
final int flags = record.getFlags();
String head = null;
String tail = null;
if (BamUtil.validateReadParams(flags, cigarList, end, start)) {
coverageAdd(start, end, coverageArray, true);
final String readString = record.getReadString();
if (showClipping) {
final CigarElement first = cigarList.get(0);
final CigarElement last = cigarList.get(cigarList.size() - 1);
if (first.getOperator().equals(CigarOperator.S)) {
start -= first.getLength();
head = readString.substring(0, first.getLength());
}
if (last.getOperator().equals(CigarOperator.S)) {
end += last.getLength();
tail = readString.substring(readString.length() - last.getLength(), readString.length());
}
}
if (start < min) {
refreshHeadReferenceBuffer(start);
}
if (end > max) {
refreshTailReferenceBuffer(end);
}
List<BasePosition> differentBase = computeDifferentBase(readString,
referenceBuffer != null ? referenceBuffer.getBuffer() : null, start, min, cigarList, showClipping,
record);
filter.add(record, start, end, mode == BamTrackMode.FULL ? differentBase : null, head, tail);
}
}