libStatGen Software
1
|
The SamValidator class contains static methods for validating the SAM/BAM Record and each of its fields. More...
#include <SamValidation.h>
Static Public Member Functions | |
static bool | isValid (SamFileHeader &samHeader, SamRecord &samRecord, SamValidationErrors &validationErrors) |
Validates whether or not the specified SamRecord is valid, calling all of the other validations. More... | |
static bool | isValidQname (const char *qname, uint8_t qnameLen, SamValidationErrors &validationErrors) |
Determines whether or not the specified qname is valid. More... | |
static bool | isValidFlag (uint16_t flag, SamValidationErrors &validationErrors) |
Determines whether or not the flag is valid. More... | |
static bool | isValidRname (SamFileHeader &samHeader, const char *rname, SamValidationErrors &validationErrors) |
Validate the reference name including validating against the header. More... | |
static bool | isValidRname (const char *rname, SamValidationErrors &validationErrors) |
Validate the rname without validating against the header. More... | |
static bool | isValidRefID (int32_t refID, const SamReferenceInfo &refInfo, SamValidationErrors &validationErrors) |
Validate whether or not the specified reference id is valid. More... | |
static bool | isValid1BasedPos (int32_t pos, SamValidationErrors &validationErrors) |
Validate the refeference position. More... | |
static bool | isValidMapQuality (uint8_t mapQuality, SamValidationErrors &validationErrors) |
Validate the mapping quality. More... | |
static bool | isValidSequence (SamRecord &samRecord, SamValidationErrors &validationErrors) |
Validate the sequence, but not against the cigar or quality string. More... | |
static bool | isValidCigar (SamRecord &samRecord, SamValidationErrors &validationErrors) |
Validate the cigar. More... | |
static bool | isValidCigar (const char *cigar, const char *sequence, SamValidationErrors &validationErrors) |
Validate the cigar. More... | |
static bool | isValidCigar (const char *cigar, int seqLen, SamValidationErrors &validationErrors) |
Validate the cigar. More... | |
static bool | isValidMrnm () |
TODO: validate the mate/next fragment's reference name. More... | |
static bool | isValidMpos () |
TODO: validate the mate/next fragment's position. More... | |
static bool | isValidIsize () |
TODO: validate the insertion size/observed template length. More... | |
static bool | isValidSeq () |
TODO, validate the sequence. More... | |
static bool | isValidQuality (SamRecord &samRecord, SamValidationErrors &validationErrors) |
Validate the base quality. More... | |
static bool | isValidQuality (const char *quality, const char *sequence, SamValidationErrors &validationErrors) |
Validate the base quality. More... | |
static bool | isValidQuality (const char *quality, int seqLength, SamValidationErrors &validationErrors) |
Validate the base quality. More... | |
static bool | isValidTags (SamRecord &samRecord, SamValidationErrors &validationErrors) |
Validate the tags. More... | |
static bool | isValidVtype () |
TODO validate the tag vtype. More... | |
static bool | isValidValue () |
TODO validate the tag vtype. More... | |
The SamValidator class contains static methods for validating the SAM/BAM Record and each of its fields.
The generic isValid method performs all of the other validations. The SamValidator methods return whether or not what is being validated is valid. True means it is valid, false means it is not. The specifics of the invalid value(s) are contained in the SamValidationErrors object that is passed in (by reference) to the method. The specific errors can be pulled out of that object. TODO: VALIDATION METHODS STILL NEED TO BE ADDED, and isValid does not yet validate all fields!!!
Definition at line 173 of file SamValidation.h.
|
static |
Validates whether or not the specified SamRecord is valid, calling all of the other validations.
TODO: more validation needs to be added.
samHeader | header associated with the record to be validated. |
samRecord | record to be validated. |
validationErrors | status to append any errors too. |
Definition at line 195 of file SamValidation.cpp.
References SamRecord::get1BasedPosition(), SamRecord::getFlag(), SamRecord::getMapQuality(), SamRecord::getReadName(), SamRecord::getReadNameLength(), SamRecord::getReferenceID(), SamFileHeader::getReferenceInfo(), and SamRecord::getReferenceName().
Referenced by SamRecord::isValid().
|
static |
Validate the refeference position.
Validation for pos is: a) must be between 0 and (2^29)-1.
pos | position to be validated. |
validationErrors | status to append any errors too. |
Definition at line 504 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamValidationError::INVALID_POS, and SamValidationError::WARNING.
|
static |
Validate the cigar.
Cigar validation depends on sequence. Validation for CIGAR is: a) cannot be 0 length. if not "*", validate the following: b) must have an integer length for each operator (if not "*"). TODO c) all operators must be valid (if not "*"). TODO d) evaluates to the same read length as the sequence string.
samRecord | record whose cigar should be validated. |
validationErrors | status to append any errors too. |
Definition at line 543 of file SamValidation.cpp.
References SamRecord::getCigar(), and SamRecord::getReadLength().
|
static |
Validate the cigar.
Cigar validation depends on sequence. Validation for CIGAR is: a) cannot be 0 length. if not "*", validate the following: b) must have an integer length for each operator (if not "*"). TODO c) all operators must be valid (if not "*"). TODO d) evaluates to the same read length as the sequence string.
cigar | cigar string to be validated. |
sequence | sequence to check the cigar against. |
validationErrors | status to append any errors too. |
Definition at line 551 of file SamValidation.cpp.
|
static |
Validate the cigar.
Cigar validation depends on sequence. Validation for CIGAR is: a) cannot be 0 length. if not "*", validate the following: b) TODO: must have an integer length for each operator (if not "*"). c) TODO: all operators must be valid (if not "*"). d) evaluates to the same read length as the sequence string.
cigar | cigar string to be validated. |
seqLen | sequence length to check the cigar against. |
validationErrors | status to append any errors too. |
Definition at line 558 of file SamValidation.cpp.
References SamValidationErrors::addError(), Cigar::getExpectedQueryBaseCount(), SamValidationError::INVALID_CIGAR, and SamValidationError::WARNING.
|
static |
Determines whether or not the flag is valid.
TODO: currently no validation is done on the flag.
flag | flag to be validated. |
validationErrors | status to append any errors too. |
Definition at line 340 of file SamValidation.cpp.
|
static |
TODO: validate the insertion size/observed template length.
|
static |
Validate the mapping quality.
TODO: currently no validation is done on the mapping quality.
mapQuality | mapping quality to be validated. |
validationErrors | status to append any errors too. |
Definition at line 528 of file SamValidation.cpp.
|
static |
TODO: validate the mate/next fragment's position.
|
static |
TODO: validate the mate/next fragment's reference name.
|
static |
Determines whether or not the specified qname is valid.
Validation for QNAME is: a) length of the qname string is the same as the read name length b) length is between 1 and 254. c) [
] are not allowed in the name.
qname | the read/query name. |
qnameLen | length of the read including the null (result of SamRecord::getReadNameLength(). |
validationErrors | status to append any errors too. |
Definition at line 238 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamValidationError::ERROR, SamValidationError::INVALID_QNAME, and SamValidationError::WARNING.
|
static |
Validate the base quality.
Quality validation depends on sequence. Validation for quality is: a) quality & sequence are the same length if both are specified. TODO: more validation.
samRecord | record whose quality should be validated. |
validationErrors | status to append any errors too. |
Definition at line 611 of file SamValidation.cpp.
References SamRecord::getQuality(), and SamRecord::getReadLength().
|
static |
Validate the base quality.
Quality validation depends on sequence. Validation for quality is: a) quality & sequence are the same length if both are specified. TODO: more validation.
quality | quality string to be validated. |
seqLen | sequence length to check the quality against. |
validationErrors | status to append any errors too. |
Definition at line 620 of file SamValidation.cpp.
|
static |
Validate the base quality.
Quality validation depends on sequence. Validation for quality is: a) quality & sequence are the same length if both are specified. TODO: more validation.
quality | quality string to be validated. |
seqLen | sequence length to check the quality against. |
validationErrors | status to append any errors too. |
Definition at line 636 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamValidationError::INVALID_QUAL, and SamValidationError::WARNING.
|
static |
Validate whether or not the specified reference id is valid.
Validation for rID is: a) must be between -1 and the number of refInfo. -1 is allowed, and otherwise it must properly index into the array.
refID | reference id to be validated. |
refInfo | sam reference information containing the mapping from reference id to reference name for this refID. |
validationErrors | status to append any errors too. |
Definition at line 476 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamReferenceInfo::getNumEntries(), SamValidationError::INVALID_REF_ID, and SamValidationError::WARNING.
|
static |
Validate the reference name including validating against the header.
1) Cross validate the rname and the header. 2) perform the validation in the method that doesn't take the header.
samHeader | header associated with the rname to be validated. |
rname | reference name to be validated. |
validationErrors | status to append any errors too. |
Definition at line 348 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamFileHeader::getNumSQs(), SamFileHeader::getSQ(), SamValidationError::INVALID_RNAME, and SamValidationError::WARNING.
|
static |
Validate the rname without validating against the header.
Validation for RNAME is: a) cannot be 0 length. b) [
@=] are not allowed in the name.
rname | reference name to be validated. |
validationErrors | status to append any errors too. |
Definition at line 376 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamValidationError::INVALID_RNAME, and SamValidationError::WARNING.
|
static |
TODO, validate the sequence.
|
static |
Validate the sequence, but not against the cigar or quality string.
Validation against cigar is done in isValidCigar. Validation against the quality string is done in isValidQuality. TODO: currently no validation is done in this method.
samRecord | record whose sequence should be validated. |
validationErrors | status to append any errors too. |
Definition at line 536 of file SamValidation.cpp.
|
static |
Validate the tags.
Validation for tags is: a) check that the "MD" tag is correct if it is present. TODO: more validation.
samRecord | record whose tags should be validated. |
validationErrors | status to append any errors too. |
Definition at line 669 of file SamValidation.cpp.
References SamValidationErrors::addError(), SamTags::createMDTag(), SamRecord::getReference(), SamRecord::getStringTag(), SamValidationError::INVALID_TAG, SamTags::isMDTagCorrect(), and SamValidationError::WARNING.
|
static |
TODO validate the tag vtype.
|
static |
TODO validate the tag vtype.