本文整理汇总了C++中EList::sortPortion方法的典型用法代码示例。如果您正苦于以下问题:C++ EList::sortPortion方法的具体用法?C++ EList::sortPortion怎么用?C++ EList::sortPortion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EList
的用法示例。
在下文中一共展示了EList::sortPortion方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: invertPoss
/**
* Flip all the edits.pos fields so that they're with respect to
* the other end of the read (of length 'sz').
*/
void Edit::invertPoss(
EList<Edit>& edits,
size_t sz,
size_t ei,
size_t en,
bool sort)
{
// Invert elements
size_t ii = 0;
for(size_t i = ei; i < ei + en/2; i++) {
Edit tmp = edits[i];
edits[i] = edits[ei + en - ii - 1];
edits[ei + en - ii - 1] = tmp;
ii++;
}
for(size_t i = ei; i < ei + en; i++) {
assert(edits[i].pos < sz ||
(edits[i].isReadGap() && edits[i].pos == sz));
// Adjust pos
if(edits[i].isReadGap() || edits[i].isSpliced()) {
edits[i].pos = (uint32_t)(sz - edits[i].pos);
} else {
edits[i].pos = (uint32_t)(sz - edits[i].pos - 1);
}
// Adjust pos2
if(edits[i].isReadGap()) {
int64_t pos2diff = (int64_t)(uint64_t)edits[i].pos2 - (int64_t)((uint64_t)std::numeric_limits<uint32_t>::max() >> 1);
int64_t pos2new = (int64_t)(uint64_t)edits[i].pos2 - 2*pos2diff;
assert(pos2diff == 0 || (uint32_t)pos2new != (std::numeric_limits<uint32_t>::max() >> 1));
edits[i].pos2 = (uint32_t)pos2new;
}
}
if(sort) {
// Edits might not necessarily be in same order after inversion
edits.sortPortion(ei, en);
#ifndef NDEBUG
for(size_t i = ei + 1; i < ei + en; i++) {
assert_geq(edits[i].pos, edits[i-1].pos);
}
#endif
}
}