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