/** * interval alignment input method * * @param delayPutRank if true, then rank aux tag will not be inserted by this call * @return true iff next alignment could be successfully read, false if no more alignment were available **/ bool readAlignmentInternal(bool const delayPutRank = false) { bool const ok = readAlignmentInRange(); if ( ! ok ) return false; if ( ! delayPutRank ) putRank(); return true; }
/** * interval alignment input method * * @param delayPutRank if true, then rank aux tag will not be inserted by this call * @return true iff next alignment could be successfully read, false if no more alignment were available **/ bool readAlignmentInternal(bool const delayPutRank = false) { char const * pa = 0; char const * pe = 0; bool const ok = lb.getline(&pa,&pe); if ( ! ok ) return false; samline.parseSamLine(pa,pe); if ( ! delayPutRank ) putRank(); return true; }
/** * input method * * @return bool if alignment input was successfull and a new alignment was stored **/ virtual bool readAlignmentInternal(bool const delayPutRank = false) { while ( true ) { if ( expect_false(! decoder) ) { if ( static_cast<uint64_t>(++fileid) == infos.size() ) { return false; } else { if ( Pwrappers.get() ) { decoder = &((*Pwrappers)[fileid]->getDecoder()); } else { libmaus::bambam::BamAlignmentDecoderWrapper::unique_ptr_type tptr ( libmaus::bambam::BamAlignmentDecoderFactory::construct(infos[fileid]) ); wrapper = UNIQUE_PTR_MOVE(tptr); decoder = &(wrapper->getDecoder()); } algnptr = &(decoder->getAlignment()); } } bool const ok = decoder->readAlignment(); if ( expect_true(ok) ) { alignment.swap(*algnptr); if ( ! delayPutRank ) putRank(); header.updateAlignment(fileid,alignment); return true; } else { wrapper.reset(); decoder = 0; algnptr = 0; } } }
bool readAlignmentInternal(bool const delayPutRank = false) { int const r = d_decode.func(dec); // std::cerr << "got code " << r << std::endl; if ( r == -2 ) { ::libmaus::exception::LibMausException se; se.getStream() << "ScramDecoder::readAlignment(): failed to read alignment without reaching EOF" << std::endl; se.finish(); throw se; } else if ( r == -1 ) { return false; } if ( dec->blocksize > alignment.D.size() ) alignment.D = ::libmaus::bambam::BamAlignment::D_array_type(dec->blocksize,false); memcpy(alignment.D.begin(),dec->buffer,dec->blocksize); alignment.blocksize = dec->blocksize; if ( validate ) { libmaus_bambam_alignment_validity const validity = alignment.valid(bamheader); if ( validity != ::libmaus::bambam::libmaus_bambam_alignment_validity_ok ) { ::libmaus::exception::LibMausException se; se.getStream() << "Invalid alignment: " << validity << std::endl; se.finish(); throw se; } } if ( ! delayPutRank ) putRank(); return true; }