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


C++ HashNode::Count方法代码示例

本文整理汇总了C++中HashNode::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ HashNode::Count方法的具体用法?C++ HashNode::Count怎么用?C++ HashNode::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HashNode的用法示例。


在下文中一共展示了HashNode::Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: RefreshVertices

void HashGraph::RefreshVertices(unsigned minCount)
{
#pragma omp parallel for
    for (int64 i = 0; i < (int64)table_size; ++i)
    {
        HashNode *node = table[i];
        HashNode *prev = NULL;
        while (node != NULL)
        {
            if (node->IsDead() || node->Count() < minCount)
            {
#pragma omp atomic
                --num_nodes;
                if (prev == NULL)
                {
                    table[i] = node->next;
                    FreeNode(node, omp_get_thread_num());
                    node = table[i];
                }
                else
                {
                    prev->next = node->next;
                    FreeNode(node, omp_get_thread_num());
                    node = prev->next;
                }
            }
            else
            {
                node->ClearStatus();
                prev = node;
                node = prev->next;
            }
        }
    }
}
开发者ID:brettin,项目名称:hku-idba,代码行数:35,代码来源:HashGraph.cpp

示例2: AverageCoverage

double HashGraph::AverageCoverage()
{
    long long sum = 0;
    uint64 valid = 0;
    for (int64 i = 0; i < table_size; ++i)
    {
        for (HashNode *node = table[i]; node; node = node->next)
        {
            sum += node->Count();
            ++valid;
        }
    }

    return 1.0 * sum / valid;
}
开发者ID:brettin,项目名称:hku-idba,代码行数:15,代码来源:HashGraph.cpp

示例3: MedianCoverage

double HashGraph::MedianCoverage()
{
    vector<int> v;
    v.reserve(num_nodes);
    for (int64 i = 0; i < table_size; ++i)
    {
        for (HashNode *node = table[i]; node; node = node->next)
        {
            v.push_back(node->Count());
        }
    }

    nth_element(v.begin(), v.begin() + v.size()/2, v.end());

    return *(v.begin() + v.size()/2);
}
开发者ID:brettin,项目名称:hku-idba,代码行数:16,代码来源:HashGraph.cpp

示例4: Assemble

int64 HashGraph::Assemble(vector<Contig> &contigs)
{
    contigs.resize(0);
    int tangle = 0;

    omp_lock_t lockContigs;
    omp_init_lock(&lockContigs);

#pragma omp parallel for
    for (int64 i = 0; i < (int64)table_size; ++i)
    {
        for (HashNode *node = table[i]; node != NULL; node = node->next)
        {
            if (!node->Lock(omp_get_thread_num()))
                continue;

            Contig contig;
            contig.SetContent(node->kmer, kmerLength);
            contig.sum_coverage = node->Count();
            contig.is_tangle = false;

            if (!node->kmer.IsPalindrome())
            {
                for (int strand = 0; strand < 2; ++strand)
                {
                    KmerNodeAdapter adp = GetNodeAdapter(contig.GetEndKmer());
                    KmerNodeAdapter next(NULL);

                    while (true)
                    {
                        if (!GetNextNodeAdapter(adp, next))
                            break;

                        if (next.GetLockID() == omp_get_thread_num() && IsLoop(contig, next))
                            break;

                        if (!next.LockPreempt(omp_get_thread_num()))
                            goto FAIL;

                        contig.AddNucleotide(BitOperation::bitToIndex[adp.OutEdges()]);
                        adp = next;
                        contig.sum_coverage += next.Count();
                    }

                    if (adp.OutDegree() == 0)
                        contig.is_tangle = true;
                    contig.ReverseComplement();
                }
            }

            if (contig.is_tangle)
            {
#pragma omp atomic
                ++tangle;
            }

            omp_set_lock(&lockContigs);
            contigs.push_back(contig);
            omp_unset_lock(&lockContigs);
FAIL:
            ;
        }
    }

    omp_destroy_lock(&lockContigs);

    ClearStatus();
    LogMessage("tangle %d total %d\n", tangle, contigs.size());

    return contigs.size();

}
开发者ID:brettin,项目名称:hku-idba,代码行数:72,代码来源:HashGraph.cpp


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