本文整理汇总了C++中Kmer::createMask方法的典型用法代码示例。如果您正苦于以下问题:C++ Kmer::createMask方法的具体用法?C++ Kmer::createMask怎么用?C++ Kmer::createMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kmer
的用法示例。
在下文中一共展示了Kmer::createMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
verify_node_orig(kg_node_t * node, unsigned kmer_length) {
assert( false && "TODO FIX! REVERSED KMER ENDIANNESS" );
int double_kmer_length = kmer_length << 1;
#ifdef LARGE_KMERS
Kmer mask;
mask.createMask(double_kmer_length);
#else
Kmer mask = (Kmer(1) << double_kmer_length) - 1;
#endif
Kmer kmer = node->kmer;
Kmer rc_kmer = reverseComplement(kmer, kmer_length);
char leftmost_base = (kmer >> (double_kmer_length - 2)) & 0x3;
char rightmost_base = kmer & 0x3;
for (int i = 0 ; i < 4 ; ++ i) {
// check on the left side
kg_node_t * node2 = node->left[i];
int count = node->left_count[i];
if (node2) {
assert (count != 0);
if (count > 0) {
Kmer kmer2 = KMER_PREPEND(kmer, i, double_kmer_length, mask);
assert(kmer2 == node2->kmer);
assert(node2->right[(int)rightmost_base] == node);
assert(node2->right_count[(int)rightmost_base] == count);
} else {
Kmer kmer2 = KMER_APPEND(rc_kmer, i ^ 0x3, double_kmer_length, mask);
assert(kmer2 == node2->kmer);
assert(node2->left[rightmost_base ^ 0x3] == node);
assert(node2->left_count[rightmost_base ^ 0x3] == count);
}
} else {
assert (count == 0);
}
// check on the right side
node2 = node->right[i];
count = node->right_count[i];
if (node2) {
assert (count != 0);
if (count > 0) {
Kmer kmer2 = KMER_APPEND(kmer, i, double_kmer_length, mask);
assert(kmer2 == node2->kmer);
assert(node2->left[(int)leftmost_base] == node);
assert(node2->left_count[(int)leftmost_base] == count);
} else {
Kmer kmer2 = KMER_PREPEND(rc_kmer, i ^ 0x3, double_kmer_length, mask);
assert(kmer2 == node2->kmer);
assert(node2->right[leftmost_base ^ 0x3] == node);
assert(node2->right_count[leftmost_base ^ 0x3] == count);
}
} else {
assert (count == 0);
}
}
}
示例2: verify_node
void verify_node(KmerNode * node, KmerGraph *hashtable, unsigned kmer_length)
{
int double_kmer_length = kmer_length << 1;
#ifdef LARGE_KMERS
Kmer mask;
mask.createMask(double_kmer_length);
#else
Kmer mask = (Kmer(1) << double_kmer_length) - 1;
#endif
Kmer kmer = node->kmer;
Kmer rc_kmer = reverseComplement(kmer, kmer_length);
char rightmost_base = KMER_GET_TAIL_BASE(kmer, kmer_length);
char leftmost_base = KMER_GET_HEAD_BASE(kmer, kmer_length);
KmerNode *node2;
for (int i = 0 ; i < 4 ; ++ i) {
// check on the left side
int count = node->left_count[i];
int color = node->left_color[i];
assert( color == 0 || count != 0 ); // count must be non-zero if color is non-zero
if (color == 0) {
if (count > 0) {
Kmer kmer2 = KMER_PREPEND(kmer, i, double_kmer_length, mask);
node2 = hashtable->findNode(canonicalKmer(kmer2, kmer_length));
assert( node2 != NULL );
assert(cnorm(node2->right_count[static_cast<int>(rightmost_base)]) == cnorm(count));
assert(node2->right_color[static_cast<int>(rightmost_base)] == 0);
} else if (count < 0) {
Kmer kmer2 = KMER_APPEND(rc_kmer, i ^ 0x3, double_kmer_length);
node2 = hashtable->findNode(canonicalKmer(kmer2, kmer_length));
assert( node2 != NULL );
assert(cnorm(node2->left_count[static_cast<int>( COMPLEMENT(rightmost_base) )]) == cnorm(count));
assert(node2->left_color[static_cast<int>( COMPLEMENT(rightmost_base) )] == 0);
}
}
// check on the right side
count = node->right_count[i];
color = node->right_color[i];
assert( color == 0 || count != 0 ); // count must be non-zero if color is non-zero
if (color == 0) {
if (count > 0) {
Kmer kmer2 = KMER_APPEND(kmer, i, double_kmer_length);
node2 = hashtable->findNode(canonicalKmer(kmer2, kmer_length));
assert( node2 != NULL );
assert(cnorm(node2->left_count[static_cast<int>(leftmost_base)]) == cnorm(count));
assert(node2->left_color[static_cast<int>(leftmost_base)] == 0);
} else if (count < 0) {
Kmer kmer2 = KMER_PREPEND(rc_kmer, i ^ 0x3, double_kmer_length, mask);
node2 = hashtable->findNode(canonicalKmer(kmer2, kmer_length));
assert( node2 != NULL );
assert(cnorm(node2->right_count[static_cast<int>( COMPLEMENT(leftmost_base) )]) == cnorm(count));
assert(node2->right_color[static_cast<int>( COMPLEMENT(leftmost_base) )] == 0);
}
}
}
}