src/fasta.cpp
//this is a fasta file function adopted from the minimap2 source code
this is a fasta file function adopted from the minimap2 source code
this is a fasta file function adopted from the minimap2 source code
void charByCharRead(std::istream& stream, std::map<std::string, std::string> & seqs ) {  
    char c=' ';
    while (c!='>') {
        c= stream.get();
        if (stream.eof()) {
            return;
        }
    }
    while (stream.good()) {
        std::string name;
        std::string sequence;
        c= stream.get();
        while (c!='\n') {
            if (c!='\r') name.push_back(c);
            c= stream.get();
        }
        name.push_back('\0');
        c = stream.get();
        while (c!='>' && !stream.eof()) {
            char d = (c!='\n' && c!='\r' && c!='\r')?c:'\0';
            if (d) sequence.push_back(d);
            c= stream.get();
        }
        sequence.push_back('\0');
        seqs[name]=sequence;
    }
}
void charByCharRead ( std :: istream & stream , std :: map < std :: string , std :: string > & seqs ) { char c = ' ' ; while ( c != ' ' ) { c = stream . get ( ) ; if ( stream . eof ( ) ) { return ; } } while ( stream . good ( ) ) { std :: string name ; std :: string sequence ; c = stream . get ( ) ; while ( c != ' \n ' ) { if ( c != ' \r ' ) name . push_back ( c ) ; c = stream . get ( ) ; } name . push_back ( ' \0 ' ) ; c = stream . get ( ) ; while ( c != ' ' && ! stream . eof ( ) ) { char d = ( c != ' \n ' && c != ' \r ' && c != ' \r ' ) ? c : ' \0 ' ; if ( d ) sequence . push_back ( d ) ; c = stream . get ( ) ; } sequence . push_back ( ' \0 ' ) ; seqs [ name ] = sequence ; } }
this is a fasta file function adopted from the minimap2 source code
this is a fasta file function adopted from the minimap2 source code
// not using, could be deleted //    if (!stream.good()) throw EggRuntimeError("cannot import fasta data: invalid stream"); // ignores everything until the first > // accepting empty files // main loop over sequences (each starts after having read a >) // gets the name // gets the sequence