Пример #1
0
			static void fillFrag(
				::libmaus::bambam::BamAlignment const & p, 
				::libmaus::bambam::BamHeader const & header,
				::libmaus::bambam::ReadEnds & RE
			)
			{
				RE.libraryId = p.getLibraryId(header);
				RE.read1Sequence = p.getRefIDChecked() + 1;
				RE.read1Coordinate = p.getCoordinate() + 1;
				RE.orientation = p.isReverse() ? ::libmaus::bambam::ReadEnds::R : ::libmaus::bambam::ReadEnds::F;
				RE.read1IndexInFile = p.getRank();
				RE.score = p.getScore();
				
				if ( p.isPaired() && (!p.isMateUnmap()) )
					RE.read2Sequence = p.getNextRefIDChecked() + 1;
					
				char const * readname = p.getName();
				char const * readnamee = readname + (p.getLReadName()-1);

				int cnt[2] = { 0,0 };
				for ( char const * c = readname; c != readnamee; ++c )
					cnt [ (static_cast<int>(*c) - ':') == 0 ] ++;
				bool const rnparseok = (cnt[1] == 4);
				
				// parse tile, x, y
				if ( rnparseok )
				{
					uint8_t const * sem[4];
					uint8_t const ** psem = &sem[0];
					for ( uint8_t const * c = reinterpret_cast<uint8_t const *>(readname); c != reinterpret_cast<uint8_t const *>(readnamee); ++c )
						if ( *c == ':' )
							*(psem++) = c+1;
					
					uint8_t const * t = sem[1];
					while ( D[*t] )
					{
						RE.tile *= 10;
						RE.tile += *(t++)-'0';
					}
					RE.tile += 1;

					t = sem[2];
					while ( D[*t] )
					{
						RE.x *= 10;
						RE.x += *(t++)-'0';
					}

					t = sem[3];
					while ( D[*t] )
					{
						RE.y *= 10;
						RE.y += *(t++)-'0';
					}
				}
				
				int64_t const rg = p.getReadGroupId(header);
				RE.readGroup = rg + 1;
			}