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


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

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


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

示例1: main

int main(void) {
    // Test the fastareader
    string filename = "/home/laozzzzz/barcode_project/reads/e_coli_10000snp.fa";
    bool done = false;
    bool success = false;
    Sequence read;
    std::unique_ptr<SequenceReader> reader(FastaReader::CreateSequenceReader(filename));
    while(!success) {
        reader->NextRead(read, success, done);
        cout<< read.fowardSeq() <<endl;
    }
    read.clear();
    filename = "/home/laozzzzz/barcode_project/reads/1000.fq";
    done = false;
    success = false;
    reader.reset(FastqReader::CreateSequenceReader(filename));
    while(!success) {
	reader->NextRead(read, success, done);
        cout<< read.fowardSeq() <<endl;
    }
    return 0;
}
开发者ID:LaoZZZZZ,项目名称:bartender-1.1,代码行数:22,代码来源:sequencereader_test.cpp

示例2: NextRead

void FastaReader::NextRead(Sequence &r, bool &success, bool &done) {

    if (!r.empty())
        r.clear();
    int c;

    success = false;
    done = false;
    // Pick off the first at
    if(this->first_) {
        c = fHandler_->get();
        if(c != '>') {
            c = fHandler_->getPastNewline();
            if(c < 0) {
               r.clear();success = false; done = true;
            }
        }
        if(c != '>') {
            std::cerr << "Error: reads file does not look like a FASTA file" << std::endl;
            throw 1;
        }
        assert_eq('>', c);
        first_ = false;
    }
    // Read to the end of the id line, sticking everything after the '>'
    // into *name
    string& id = r.id();
    while(true) {
        c = fHandler_->get();
        if(c < 0) {
            r.clear(); success = false; done = true;
            std::cerr << "Error: reads file does not look like a FASTA file" << std::endl;
            throw 1;
        }
        if(c == '\n' || c == '\r') {
            // Break at end of line, after consuming all \r's, \n's
            while(c == '\n' || c == '\r') {
                c = fHandler_->get();
                if(c < 0) {
                    r.clear(); success = false; done = true;
                    std::cerr << "Error: reads file does not look like a FASTA file" << std::endl;
                    throw 1;
                }
            }
            break;
        }
        if(c == '>')
            continue;
        id += c;
        //name.append(c);
    }
    // fb_ now points just past the first character of a
    // sequence line, and c holds the first character
    BTDnaString& sbuf = r.fowardSeq();
    while(true){
        c = toupper(c);
        if(c < 0){
            r.clear(); success = false; done = true;
            std::cerr << "Error: reads file does not look like a FASTA file" << std::endl;
            throw 1;
        }
        else{
            if(c == '\n' || c == '\r') {
                break;
            }
            sbuf.append(asc2dna[c]);
            c = fHandler_->get();
        }
    }
    success = true;
    done = fHandler_->eof();
    is_done_ = done;
}
开发者ID:LaoZZZZZ,项目名称:bartender-1.1,代码行数:73,代码来源:fastareader.cpp

示例3: parseImp

void fastqPattern::parseImp(Sequence& read,
                            bool& success,
                            bool& done){

    char c;

    success = false;
    done = false;
    // Pick off the first at
    if(this->first_) {
        c = this->fb_->get();
        if(c != '@') {
            c = this->fb_->getPastNewline();
            if(c < 0) {
                success = false; done = true;
            }
            line_num_ += 1;
        }
        if(c != '@') {
            std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
            throw 1;
        }
        assert_eq('@', c);
        first_ = false;
    }
    // Read to the end of the id line, sticking everything after the '@'
    // into id

    std::string& id = read.id();

    while(true) {

        c = this->fb_->get();
        if(c == '@')
            continue;
        if(c < 0) {
            read.clear(); success = false; done = true;
            std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
            throw 1;
        }
        if(c == '\n' || c == '\r') {
            // Break at end of line, after consuming all \r's, \n's
            while(c == '\n' || c == '\r') {
                c = this->fb_->get();
                if(c < 0) {
                    read.clear(); success = false; done = true;
                    std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
                    throw 1;
                }
            }
            line_num_ += 1;
            break;
        }
        id += c;
    }
    // fb_ now points just past the first character of a
    // sequence line, and c holds the first character
    //BTDnaString& sbuf = r->fowardSeq();
    std::string& sequence = read.fowardSeq();
    while(true){
        c = toupper(c);
        if(c < 0){
            read.clear(); success = false; done = true;
            std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
            throw 1;
        }
        else{
            if(c == '\n' || c == '\r') {
                // Break at end of line, after consuming all \r's, \n's
                while(c == '\n' || c == '\r') {
                    c = this->fb_->get();
                    if(c < 0) {
                        read.clear(); success = false; done = true;
                        std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
                        throw 1;
                    }
                }
                line_num_ += 1;
                break;
            }
            // convert N to A
            if(toupper(c) == 'N')
                c = 'A';
            sequence += c;
            c = this->fb_->get();
        }
    }
    assert_eq('+', c);
    // skip the option sequence at '+' line
    c = this->fb_->getPastNewline();
    line_num_ += 1;
    if(c <0){
        read.clear(); success = false; done = true;
        std::cerr << "Error: reads file does not look like a FASTQ file" << std::endl;
        throw 1;
    }
    string& qual = read.quality();
    while(true){
        qual += c;
        c = this->fb_->get();
//.........这里部分代码省略.........
开发者ID:LaoZZZZZ,项目名称:bartender-1.1,代码行数:101,代码来源:fastqpattern.cpp


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