Package htsjdk.samtools
Class SamFileValidator
- java.lang.Object
-
- htsjdk.samtools.SamFileValidator
-
public class SamFileValidator extends Object
Validates SAM files as follows:- checks sam file header for sequence dictionary
- checks sam file header for read groups
- for each sam record
- reports error detected by SAMRecord.isValid()
- validates NM (nucleotide differences) exists and matches reality
- validates mate fields agree with data in the mate record
- See Also:
SAMRecord.isValid()
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SamFileValidator.ValidationMetrics
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_QUALITY_NOT_STORED_ERRORS
-
Constructor Summary
Constructors Constructor Description SamFileValidator(PrintWriter out, int maxTempFiles)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getNumErrors()
Number of errors during SAM file validationint
getNumWarnings()
Number of warnings during SAM file validationboolean
getSkipMateValidation()
boolean
isBisulfiteSequenced()
void
setBisulfiteSequenced(boolean bisulfiteSequenced)
void
setErrorsToIgnore(Collection<SAMValidationError.Type> types)
Sets one or more error types that should not be reported on.void
setIgnoreWarnings(boolean ignoreWarnings)
SamFileValidator
setIndexValidationStringency(BamIndexValidator.IndexValidationStringency stringency)
void
setSkipMateValidation(boolean skipMateValidation)
Sets whether or not we should run mate validation beyond the mate cigar check, which is useful in extreme edge cases that would require a lot of memory to do the validation.SamFileValidator
setValidateIndex(boolean validateIndex)
Deprecated.void
setVerbose(boolean verbose, int maxVerboseOutput)
Control verbosityvoid
validateBamFileTermination(File inputFile)
boolean
validateSamFileSummary(SamReader samReader, ReferenceSequenceFile reference)
Outputs validation summary report to out.boolean
validateSamFileVerbose(SamReader samReader, ReferenceSequenceFile reference)
Outputs validation error details to out.
-
-
-
Field Detail
-
MAX_QUALITY_NOT_STORED_ERRORS
public static final int MAX_QUALITY_NOT_STORED_ERRORS
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SamFileValidator
public SamFileValidator(PrintWriter out, int maxTempFiles)
-
-
Method Detail
-
setErrorsToIgnore
public void setErrorsToIgnore(Collection<SAMValidationError.Type> types)
Sets one or more error types that should not be reported on.
-
setIgnoreWarnings
public void setIgnoreWarnings(boolean ignoreWarnings)
-
setSkipMateValidation
public void setSkipMateValidation(boolean skipMateValidation)
Sets whether or not we should run mate validation beyond the mate cigar check, which is useful in extreme edge cases that would require a lot of memory to do the validation.- Parameters:
skipMateValidation
- should this tool skip mate validation
-
getSkipMateValidation
public boolean getSkipMateValidation()
- Returns:
- true if the validator will skip mate validation, otherwise false
-
validateSamFileSummary
public boolean validateSamFileSummary(SamReader samReader, ReferenceSequenceFile reference)
Outputs validation summary report to out.- Parameters:
samReader
- records to validatereference
- if null, NM tag validation is skipped- Returns:
- boolean true if there are no validation errors, otherwise false
-
validateSamFileVerbose
public boolean validateSamFileVerbose(SamReader samReader, ReferenceSequenceFile reference)
Outputs validation error details to out.- Parameters:
samReader
- records to validatereference
- if null, NM tag validation is skipped processing will stop after this threshold has been reached- Returns:
- boolean true if there are no validation errors, otherwise false
-
validateBamFileTermination
public void validateBamFileTermination(File inputFile)
-
getNumWarnings
public int getNumWarnings()
Number of warnings during SAM file validation- Returns:
- number of warnings
-
getNumErrors
public int getNumErrors()
Number of errors during SAM file validation- Returns:
- number of errors
-
setVerbose
public void setVerbose(boolean verbose, int maxVerboseOutput)
Control verbosity- Parameters:
verbose
- True in order to emit a message per error or warning.maxVerboseOutput
- If verbose, emit no more than this many messages. Ignored if !verbose.
-
isBisulfiteSequenced
public boolean isBisulfiteSequenced()
-
setBisulfiteSequenced
public void setBisulfiteSequenced(boolean bisulfiteSequenced)
-
setValidateIndex
@Deprecated public SamFileValidator setValidateIndex(boolean validateIndex)
Deprecated.
-
setIndexValidationStringency
public SamFileValidator setIndexValidationStringency(BamIndexValidator.IndexValidationStringency stringency)
-
-