18 #ifndef __SAM_VALIDATION_H__
19 #define __SAM_VALIDATION_H__
92 static const char* enumTypeString[];
93 static const char* enumSeverityString[];
97 std::string myMessage;
103 inline std::ostream &
operator << (std::ostream &stream,
106 std::string errorMessage;
107 error.getErrorString(errorMessage);
108 stream << errorMessage;
130 const char* newMessage);
148 std::list<const SamValidationError*> myValidationErrors;
149 std::list<const SamValidationError*>::const_iterator myErrorIter;
154 inline std::ostream&
operator << (std::ostream& stream,
157 std::string errorString =
"";
159 stream << errorString;
199 static bool isValidQname(
const char* qname, uint8_t qnameLen,
302 static bool isValidCigar(
const char* cigar,
const char* sequence,
363 static bool isValidQuality(
const char* quality,
const char* sequence,
Type getType() const
Return the type enum of this validation error object.
static bool isValidValue()
TODO validate the tag vtype.
@ WARNING
Warning is used if it is just an invalid value.
@ INVALID_CIGAR
Invalid CIGAR.
@ INVALID_QNAME
Invalid read/query name.
@ INVALID_QUAL
Invalid base quality.
Severity
Severity of the error.
static bool isValidCigar(SamRecord &samRecord, SamValidationErrors &validationErrors)
Validate the cigar.
@ INVALID_POS
Invalid position.
void getErrorString(std::string &errorString) const
Get the error string representing this object's error.
static bool isValidVtype()
TODO validate the tag vtype.
Class for tracking the reference information mapping between the reference ids and the reference name...
static bool isValidSeq()
TODO, validate the sequence.
static bool isValidMrnm()
TODO: validate the mate/next fragment's reference name.
The SamValidationErrors class is a container class that holds SamValidationError Objects,...
void resetErrorIter()
Reset the iterator to the begining of the errors.
~SamValidationErrors()
Destructor.
void printError() const
Print a formatted output of the error to cerr.
static bool isValidFlag(uint16_t flag, SamValidationErrors &validationErrors)
Determines whether or not the flag is valid.
SamValidationErrors()
Constructor.
const char * getMessage() const
Return the error message of this validation error object.
const SamValidationError * getNextError()
Return a pointer to the next error without removing it from the container, and returning null once al...
const char * getSeverityString() const
Return the string representing this object's severity of validation error.
void addError(SamValidationError::Type newType, SamValidationError::Severity newSeverity, const char *newMessage)
Add the specified error to this container.
@ ERROR
Error is used if parsing could not succeed.
static bool isValidRefID(int32_t refID, const SamReferenceInfo &refInfo, SamValidationErrors &validationErrors)
Validate whether or not the specified reference id is valid.
static bool isValidRname(SamFileHeader &samHeader, const char *rname, SamValidationErrors &validationErrors)
Validate the reference name including validating against the header.
@ INVALID_RNAME
Invalid reference name.
@ INVALID_MAPQ
Invalid mapping quality.
static bool isValid(SamFileHeader &samHeader, SamRecord &samRecord, SamValidationErrors &validationErrors)
Validates whether or not the specified SamRecord is valid, calling all of the other validations.
The SamValidator class contains static methods for validating the SAM/BAM Record and each of its fiel...
Severity getSeverity() const
Return the severity enum of this validation error object.
@ INVALID_MRNM
Invalid mate/next fragment reference name.
The SamValidationError class describes a validation error that occured, containing the error type,...
static bool isValidMapQuality(uint8_t mapQuality, SamValidationErrors &validationErrors)
Validate the mapping quality.
static bool isValidIsize()
TODO: validate the insertion size/observed template length.
Class providing an easy to use interface to get/set/operate on the fields in a SAM/BAM record.
const char * getTypeString() const
Return the string representing this object's type of validation error.
static bool isValidQuality(SamRecord &samRecord, SamValidationErrors &validationErrors)
Validate the base quality.
static bool isValidQname(const char *qname, uint8_t qnameLen, SamValidationErrors &validationErrors)
Determines whether or not the specified qname is valid.
void clear()
Remove all the errors from the container.
@ INVALID_REF_ID
Invalid reference id.
static bool isValidMpos()
TODO: validate the mate/next fragment's position.
static bool isValidSequence(SamRecord &samRecord, SamValidationErrors &validationErrors)
Validate the sequence, but not against the cigar or quality string.
void getErrorString(std::string &errorString) const
Append the error messages contained in this container to the passed in string.
@ INVALID_TAG
Invalid tag.
static bool isValidTags(SamRecord &samRecord, SamValidationErrors &validationErrors)
Validate the tags.
static bool isValid1BasedPos(int32_t pos, SamValidationErrors &validationErrors)
Validate the refeference position.
unsigned int numErrors()
Return the number of validation errors contained in this object.