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


C++ Sequence::get_alpha_name方法代码示例

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


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

示例1: write_partition_information

void SequenceConcatenater::write_partition_information (vector <string> const& inputFiles,
    string & partfile) {
    ofstream outfile(partfile.c_str());
    int charIndex = 1;
    int stopIndex = 1;
    
    // need to check seq type when writing this
    // use infer_alpha / get_alpha_name
    // but: are mixed seq types allowed? prolly...
    //     - so: need to check each one
    
    for (unsigned int i = 0; i < partition_sizes_.size(); i++) {
        stopIndex = charIndex + partition_sizes_[i] - 1;
        bool going = true;
        string alpha = "";
        int j = 0;
        while (going) {
            Sequence terp = seqs_[j];
            string subseq = terp.get_sequence().substr((charIndex - 1), partition_sizes_[i]);
            // check if all are the same character (presumably all N, but useful either way)
            if (subseq.find_first_not_of(subseq.front()) != std::string::npos) {
                terp.set_sequence(subseq);
                alpha = terp.get_alpha_name();
                going = false;
            }
            j++;
        }
        outfile << alpha << ", " << inputFiles[i] << " = " << charIndex << "-" << stopIndex << endl;
        charIndex = stopIndex + 1;
    }
    outfile.close();
}
开发者ID:FePhyFoFum,项目名称:phyx,代码行数:32,代码来源:concat.cpp

示例2: read_sequences

void SequenceCleaner::read_sequences (istream* pios) {
    Sequence seq;
    string retstring;
    int ft = test_seq_filetype_stream(*pios, retstring);
    int num_current_char = 0;
    bool first = true;
    
    while (read_next_seq_from_stream(*pios, ft, retstring, seq)) {
        sequences_[seq.get_id()] = seq.get_sequence();
        num_current_char = seq.get_sequence().size();
        if (first) {
            num_char_ = num_current_char; // just getting this from an arbitrary (first) sequence for now
            if (is_dna_) {
                string alpha_name = seq.get_alpha_name();
                if (alpha_name == "AA") {
                    is_dna_ = false;
                    //cout << "I believe this is a protein!" << endl;
                }
            }
            first = false;
            continue;
        } else {
            if (num_current_char != num_char_) {
                cout << "Error: sequences are not all of the same length. Exiting."
                    << endl;
                exit(0);
            }
        }
    }
    if (ft == 2) {
        sequences_[seq.get_id()] = seq.get_sequence();
        num_current_char = seq.get_sequence().size();
        if (num_current_char != num_char_) {
            cout << "Error: sequences are not all of the same length. Exiting."
                << endl;
            exit(0);
        }
    }
    num_taxa_ = sequences_.size();
}
开发者ID:FePhyFoFum,项目名称:phyx,代码行数:40,代码来源:clsq.cpp


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