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


C++ DNASequence::MakeRC方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
    ofstream summaryTable(summaryTableFileName.c_str());
    ofstream outputFile(outputFileName.c_str());

    queryReader.Initialize(queryFileName);

    while (queryReader.GetNext(querySequence)) {
        int i;
        cerr << "searching " << querySequence.title << endl;
        if (querySequence.length < maxLength) {
            continue;
        }

        int nMatches = 0;
        querySequence.ToUpper();
        int localMax;
        for (i = 0; i < querySequence.length - maxLength + 1; i++) {
            if ((i + 1) % 100000 == 0) {
                cerr << "processed: " << i + 1 << endl;
            }

            int lcpLength;
            vector<SAIndex> lcpLeftBounds, lcpRightBounds;
            vector<SAIndex> rclcpLeftBounds, rclcpRightBounds;
            localMax = maxN;
            if (i < prefix) {
                localMax = prefixN;
            }
            if (i >= querySequence.length - suffix) {
                localMax = suffixN;
            }
            if (querySequence.length - i <= maxLength) {
                continue;
            }
            if (querySequence.seq[i] == 'N') {
                continue;
            }
            lcpLength = sarray.StoreLCPBounds(genome.seq, genome.length, // The string which the suffix array is built on.
                                                                                &querySequence.seq[i], querySequence.length-i,
                                                                                true,
                                                                                maxLength,
                                                                                lcpLeftBounds, lcpRightBounds,
                                                                                false);
            if (lcpLength < minLength) {
                continue;
            }
            if (lcpLength < maxLength or 
                    lcpRightBounds.size() == 0 or 
                    (lcpRightBounds.size() > 0 and 
                     lcpLeftBounds.size() > 0 and  
                     lcpRightBounds[lcpRightBounds.size() - 1] - lcpLeftBounds[lcpLeftBounds.size()-1] <= localMax)) {

                FASTASequence rc;
                DNASequence subseq;
                subseq.ReferenceSubstring(querySequence, i, maxLength);
                subseq.MakeRC(rc);
                int rclcpLength;
                int numForwardMatches;
                if (lcpLength == 0) {
                    numForwardMatches = 0;
                }
                else {
                    numForwardMatches = lcpRightBounds[lcpRightBounds.size() - 1] - lcpLeftBounds[lcpLeftBounds.size()-1];
                }
                rclcpLength = sarray.StoreLCPBounds(genome.seq, genome.length, // The string which the suffix array is built on.
                                                                                        rc.seq, maxLength,
                                                                                        true,
                                                                                        rclcpLength,
                                                                                        rclcpLeftBounds, rclcpRightBounds,
                                                                                        false);

                string rcstr((const char*)rc.seq, rc.length);

                if (rclcpLength < maxLength or 
                        rclcpRightBounds.size() == 0 or
                        (numForwardMatches + 
                         rclcpRightBounds[rclcpRightBounds.size() - 1] -
                         rclcpLeftBounds[rclcpLeftBounds.size()-1] <= localMax)) 
                    {
                        char* substr = new char[maxLength+1];
                        substr[maxLength] = '\0';
                        memcpy(substr, &querySequence.seq[i], maxLength);

                        //						string substr = string((const char*) querySequence.seq, i, maxLength);
                        
                        outputFile << querySequence.title << "\t" << substr << "\t" << i << endl;

                        ++nMatches;
                        delete[] substr;
                        //					}
                    }
                rc.Free();
            }

        }
        summaryTable << querySequence.title << "\t" << nMatches << endl;
        querySequence.Free();
    }
    outputFile.close();
    genome.Free();
}
开发者ID:JinfengChen,项目名称:chm1_scripts,代码行数:101,代码来源:FindUnique.cpp


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