当前位置: 首页>>代码示例>>C++>>正文


C++ Kmer::createMask方法代码示例

本文整理汇总了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);
        }
    }
}
开发者ID:jjcook,项目名称:velour,代码行数:60,代码来源:utility.cpp

示例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);
            }
        }
    }
}
开发者ID:jjcook,项目名称:velour,代码行数:57,代码来源:utility.cpp


注:本文中的Kmer::createMask方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。