本文整理汇总了C++中BamReader::Jump方法的典型用法代码示例。如果您正苦于以下问题:C++ BamReader::Jump方法的具体用法?C++ BamReader::Jump怎么用?C++ BamReader::Jump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BamReader
的用法示例。
在下文中一共展示了BamReader::Jump方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exit
// old mate-finding code, for position-sorted BAM files, didn't work well
BamAlignment
lookForMate(BamReader& rdr, BamAlignment& al, RefVector& refs)
{
if (! rdr.Jump(al.MateRefID, al.MatePosition)) {
cout << "*** Could not jump to " << al.MateRefID << ":" << al.MatePosition << endl;
exit(1);
}
BamAlignment al_jump;
while (rdr.GetNextAlignment(al_jump)) {
if (al_jump.Name == al.Name
&& al_jump.RefID == al.MateRefID
&& al_jump.Position == al.MatePosition) {
cout << "MATE FOUND" << endl;
printAlignmentInfo(al_jump, refs);
break;
} else if (al_jump.Position > al.MatePosition) {
cout << "NO MATE FOUND, beyond MatePosition" << endl;
break;
}
}
if (! rdr.Jump(al.RefID, al.Position)) {
cout << "*** Could not return to " << al.RefID << ":" << al.Position << endl;
exit(1);
}
// need to return to the read we were on after the jump, but how?
rdr.GetNextAlignment(al);
return(al_jump);
}
示例2: Jump
// jumps to specified region(refID, leftBound) in BAM files, returns success/fail
bool BamMultiReader::Jump(int refID, int position) {
//if ( References.at(refID).RefHasAlignments && (position <= References.at(refID).RefLength) ) {
CurrentRefID = refID;
CurrentLeft = position;
bool result = true;
for (vector<pair<BamReader*, BamAlignment*> >::iterator it = readers.begin(); it != readers.end(); ++it) {
BamReader* reader = it->first;
result &= reader->Jump(refID, position);
if (!result) {
cerr << "ERROR: could not jump " << reader->GetFilename() << " to " << refID << ":" << position << endl;
exit(1);
}
}
if (result) UpdateAlignments();
return result;
}
示例3: Jump
// performs random-access jump using (refID, position) as a left-bound
bool BamMultiReaderPrivate::Jump(int refID, int position) {
// NB: While it may make sense to track readers in which we can
// successfully Jump, in practice a failure of Jump means "no
// alignments here." It makes sense to simply accept the failure,
// UpdateAlignments(), and continue.
// iterate over readers
vector<MergeItem>::iterator readerIter = m_readers.begin();
vector<MergeItem>::iterator readerEnd = m_readers.end();
for ( ; readerIter != readerEnd; ++readerIter ) {
MergeItem& item = (*readerIter);
BamReader* reader = item.Reader;
if ( reader == 0 ) continue;
// jump in each BamReader to position of interest
reader->Jump(refID, position);
}
// returns status of cache update
return UpdateAlignmentCache();
}