本文整理汇总了C++中Alignment::score方法的典型用法代码示例。如果您正苦于以下问题:C++ Alignment::score方法的具体用法?C++ Alignment::score怎么用?C++ Alignment::score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Alignment
的用法示例。
在下文中一共展示了Alignment::score方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strip_from_start
Alignment strip_from_start(const Alignment& aln, size_t drop) {
if (!drop) return aln;
Alignment res;
res.set_name(aln.name());
res.set_score(aln.score());
//cerr << "drop " << drop << " from start" << endl;
res.set_sequence(aln.sequence().substr(drop));
if (!aln.has_path()) return res;
*res.mutable_path() = cut_path(aln.path(), drop).second;
assert(res.has_path());
if (alignment_to_length(res) != res.sequence().size()) {
cerr << "failed!!! drop from start 轰" << endl;
cerr << pb2json(res) << endl << endl;
assert(false);
}
return res;
}
示例2: strip_from_end
Alignment strip_from_end(const Alignment& aln, size_t drop) {
if (!drop) return aln;
Alignment res;
res.set_name(aln.name());
res.set_score(aln.score());
//cerr << "drop " << drop << " from end" << endl;
size_t cut_at = aln.sequence().size()-drop;
//cerr << "Cut at " << cut_at << endl;
res.set_sequence(aln.sequence().substr(0, cut_at));
if (!aln.has_path()) return res;
*res.mutable_path() = cut_path(aln.path(), cut_at).first;
assert(res.has_path());
if (alignment_to_length(res) != res.sequence().size()) {
cerr << "failed!!! drop from end 轰" << endl;
cerr << pb2json(res) << endl << endl;
assert(false);
}
return res;
}
示例3: sam_flag
int32_t sam_flag(const Alignment& alignment) {
int16_t flag = 0;
if (alignment.score() == 0) {
// unmapped
flag |= BAM_FUNMAP;
} else {
// correctly aligned
flag |= BAM_FPROPER_PAIR;
}
// HACKZ -- you can't determine orientation from a single part of the mapping
// unless the graph is a DAG
if (alignment.has_path()
&& alignment.path().mapping(0).position().is_reverse()) {
flag |= BAM_FREVERSE;
}
if (alignment.is_secondary()) {
flag |= BAM_FSECONDARY;
}
return flag;
}