MCPcopy Create free account
hub / github.com/ablab/spades / FindTag

Method FindTag

ext/src/bamtools/api/BamAlignment.cpp:370–395  ·  view source on GitHub ↗

! \fn bool BamAlignment::FindTag(const std::string& tag, char*& pTagData, const unsigned int& tagDataLength, unsigned int& numBytesParsed) const \internal Searches for requested tag in BAM tag data. \param[in] tag requested 2-character tag name \param[in,out] pTagData pointer to current position in BamAlignment::TagData \param[in] tagDataLength lengt

Source from the content-addressed store, hash-verified

368
369*/
370bool BamAlignment::FindTag(const std::string& tag,
371 char*& pTagData,
372 const unsigned int& tagDataLength,
373 unsigned int& numBytesParsed) const
374{
375
376 while ( numBytesParsed < tagDataLength ) {
377
378 const char* pTagType = pTagData;
379 const char* pTagStorageType = pTagData + 2;
380 pTagData += 3;
381 numBytesParsed += 3;
382
383 // check the current tag, return true on match
384 if ( strncmp(pTagType, tag.c_str(), 2) == 0 )
385 return true;
386
387 // get the storage class and find the next tag
388 if ( *pTagStorageType == '\0' ) return false;
389 if ( !SkipToNextTag(*pTagStorageType, pTagData, numBytesParsed) ) return false;
390 if ( *pTagData == '\0' ) return false;
391 }
392
393 // checked all tags, none match
394 return false;
395}
396
397/*! \fn bool BamAlignment::GetArrayTagType(const std::string& tag, char& type) const
398 \brief Retrieves the BAM tag type-code for the array elements associated with requested tag name.

Callers

nothing calls this directly

Calls 1

c_strMethod · 0.45

Tested by

no test coverage detected