本文整理汇总了C++中bamtools::BamAlignment::IsSecondMate方法的典型用法代码示例。如果您正苦于以下问题:C++ BamAlignment::IsSecondMate方法的具体用法?C++ BamAlignment::IsSecondMate怎么用?C++ BamAlignment::IsSecondMate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bamtools::BamAlignment
的用法示例。
在下文中一共展示了BamAlignment::IsSecondMate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseRead
bool ReadContainer::ParseRead(const BamTools::BamAlignment& aln,
AlignedRead* aligned_read,
map<pair<string,int>, string>& ref_ext_nucleotides) {
// get read ID
aligned_read->ID = aln.Name;
// get nucleotides
aligned_read->nucleotides = aln.QueryBases;
// get qualities
aligned_read->qualities = aln.Qualities;
// get strand
aligned_read->strand = aln.IsReverseStrand();
// get chrom
aligned_read->chrom = references.at(aln.RefID).RefName;
// get read start
aligned_read->read_start = aln.Position;
// get cigar
aligned_read->cigar_ops = aln.CigarData;
// get if mate pair
if (aln.IsSecondMate()) {
aligned_read->mate = 1;
} else {
aligned_read->mate = 0;
}
// Only process if it is the primary alignment
if (aligned_read->mate) {
return false;
}
// Get all the tag data
// don't process if partially spanning (from old lobSTR)
int partial = 0;
if (GetIntBamTag(aln, "XP", &partial)) {
if (partial == 1) return false;
}
// get read group
if (!GetStringBamTag(aln, "RG", &aligned_read->read_group)) {
stringstream msg;
msg << aln.Name << " Could not get read group.";
PrintMessageDieOnError(msg.str(), ERROR);
}
// get msStart
if (!GetIntBamTag(aln, "XS", &aligned_read->msStart)) {
stringstream msg;
msg << aln.Name << " from group " << aligned_read->read_group << " Could not get STR start coordinate. Did this bam file come from lobSTR?";
PrintMessageDieOnError(msg.str(), ERROR);
}
// get msEnd
if (!GetIntBamTag(aln, "XE", &aligned_read->msEnd)) {
stringstream msg;
msg << aln.Name << " from group " << aligned_read->read_group << " Could not get STR end coordinate. Did this bam file come from lobSTR?";
PrintMessageDieOnError(msg.str(), ERROR);
}
// get mapq. Try unsigned/signed
if (!GetIntBamTag(aln, "XQ", &aligned_read->mapq)) {
stringstream msg;
aligned_read->mapq = 0;
}
// get diff
if (!GetIntBamTag(aln, "XD", &aligned_read->diffFromRef)) {
return false;
}
// get mate dist
if (!GetIntBamTag(aln, "XM", &aligned_read->matedist)) {
aligned_read->matedist = 0;
}
// get STR seq
if (!GetStringBamTag(aln, "XR", &aligned_read->repseq)) {
stringstream msg;
msg << aln.Name << " from group " << aligned_read->read_group << " Could not get repseq.";
PrintMessageDieOnError(msg.str(), ERROR);
}
// get if stitched
if (!GetIntBamTag(aln, "XX", &aligned_read->stitched)) {
aligned_read->stitched = 0;
}
// get ref copy num
if (!GetFloatBamTag(aln, "XC", &aligned_read->refCopyNum)) {
stringstream msg;
msg << aln.Name << " from group " << aligned_read->read_group << " Could not get reference copy number.";
PrintMessageDieOnError(msg.str(), ERROR);
}
// get period
aligned_read->period = aligned_read->repseq.length();
if (include_flank) { // diff is just sum of differences in cigar
CIGAR_LIST cigar_list;
for (vector<BamTools::CigarOp>::const_iterator
it = aligned_read->cigar_ops.begin();
it != aligned_read->cigar_ops.end(); it++) {
CIGAR cig;
cig.num = (*it).Length;
cig.cigar_type = (*it).Type;
cigar_list.cigars.push_back(cig);
}
bool added_s;
bool cigar_had_s;
cigar_list.ResetString();
GenerateCorrectCigar(&cigar_list, aln.QueryBases,
&added_s, &cigar_had_s);
aligned_read->diffFromRef = GetSTRAllele(cigar_list);
}
// apply filters
//.........这里部分代码省略.........