19 #include "BaseUtilities.h" 21 const char* SamTags::BQ_TAG =
"BQ";
22 const char SamTags::BQ_TAG_TYPE =
'Z';
23 const char* SamTags::MD_TAG =
"MD";
24 const char SamTags::MD_TAG_TYPE =
'Z';
25 const char* SamTags::ORIG_POS_TAG =
"OP";
26 const char SamTags::ORIG_POS_TAG_TYPE =
'i';
27 const char* SamTags::ORIG_CIGAR_TAG =
"OC";
28 const char SamTags::ORIG_CIGAR_TAG_TYPE =
'Z';
29 const char* SamTags::ORIG_QUAL_TAG =
"OQ";
30 const char SamTags::ORIG_QUAL_TAG_TYPE =
'Z';
42 throw(std::runtime_error(
"Cannot createMDTag - failed to get the cigar"));
48 uint32_t startOfReadOnRefIndex =
50 if(startOfReadOnRefIndex == (uint32_t)INVALID_CHROMOSOME_INDEX)
58 int32_t matchCount = 0;
61 bool currentDeletion =
false;
64 for(
int refOffset = 0;
71 char refBase = genome[startOfReadOnRefIndex + refOffset];
77 currentDeletion =
false;
93 outputMDtag += matchCount;
96 outputMDtag += refBase;
105 outputMDtag += matchCount;
115 outputMDtag += refBase;
116 currentDeletion =
true;
121 outputMDtag += matchCount;
137 if(origMDtag == NULL)
144 return(calcMDtag.IsEmpty());
149 return(calcMDtag == *origMDtag);
164 return(inputRec.
addTag(MD_TAG, MD_TAG_TYPE, calcMDtag.c_str()));
const String * getStringTag(const char *tag)
Get the string value for the specified tag.
Cigar * getCigarInfo()
Returns a pointer to the Cigar object associated with this record.
static bool areEqual(char base1, char base2)
Returns whether or not two bases are equal (case insensitive), if one of the bases is '='...
static const int32_t INDEX_NA
Value associated with an index that is not applicable/does not exist, used for converting between que...
const char * getSequence()
Returns the SAM formatted sequence string (SEQ), translating the base as specified by setSequenceTran...
This class represents the CIGAR without any methods to set the cigar (see CigarRoller for that)...
int getExpectedReferenceBaseCount() const
Return the number of bases in the reference that this CIGAR "spans".
int32_t getQueryIndex(int32_t refOffset)
Return the query index associated with the specified reference offset or INDEX_NA based on this cigar...
static bool isAmbiguous(char base)
Returns whether or not the specified bases is an indicator for ambiguity.
Create/Access/Modify/Load Genome Sequences stored as binary mapped files.
bool addTag(const char *tag, char vtype, const char *value)
Add the specified tag,vtype,value to the record.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record...
int32_t get0BasedPosition()
Get the 0-based(BAM) leftmost position of the record.
genomeIndex_t getGenomePosition(const char *chromosomeName, unsigned int chromosomeIndex) const
given a chromosome name and position, return the genome position
const char * getReferenceName()
Get the reference sequence name (RNAME) of the record.