void put(libmaus::fastx::FastQReader::pattern_type const & pattern) { uint64_t const patlen = getFastQLength(pattern); while ( (C.end() - pc) < static_cast<ptrdiff_t>(patlen) ) { uint64_t const off = pc-C.begin(); uint64_t const newclen = std::max(2*C.size(),static_cast<uint64_t>(1ull)); C.resize(newclen); pc = C.begin()+off; } *(pc)++ = '@'; std::copy(pattern.sid.begin(),pattern.sid.end(),pc); pc += pattern.sid.size(); *(pc++) = '\n'; std::copy(pattern.spattern.begin(), pattern.spattern.end(),pc); pc += pattern.spattern.size(); *(pc++) = '\n'; *(pc)++ = '+'; std::copy(pattern.plus.begin(), pattern.plus.end(),pc); pc += pattern.plus.size(); *(pc++) = '\n'; std::copy(pattern.quality.begin(), pattern.quality.end(),pc); pc += pattern.quality.size(); *(pc++) = '\n'; assert ( pc <= C.end() ); lnumsyms += pattern.spattern.size(); minlen = std::min(minlen,static_cast<uint64_t>(pattern.spattern.size())); maxlen = std::max(maxlen,static_cast<uint64_t>(pattern.spattern.size())); pathigh++; if ( pathigh - patlow == patperblock ) internalFlush(); }
/* decode next block */ bool decodeBlock() { /* open new file if necessary */ bool changedfile = false; while ( fileptr < idda.data.size() && blockptr == idda.data[fileptr].numentries ) { fileptr++; blockptr = 0; changedfile = true; } if ( fileptr == idda.data.size() ) return false; if ( changedfile ) openNewFile(); /* align to word boundary */ GD->flush(); /* read block size */ uint64_t const blocksize = GD->decodeWord(32); /* increase size of memory buffer if necessary */ if ( blocksize > decodebuf.size() ) decodebuf.resize(blocksize); /* set buffer pointers */ pa = decodebuf.begin(); pc = pa; pe = pa + blocksize; /* decode block */ for ( uint64_t i = 0; i < blocksize; ++i ) decodebuf[i] = GD->decode(); /* increment block pointer */ blockptr++; return true; }