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:
  • Field Details

    • MAX_QUALITY_NOT_STORED_ERRORS

      public static final int MAX_QUALITY_NOT_STORED_ERRORS
      See Also:
  • Constructor Details

    • SamFileValidator

      public SamFileValidator(PrintWriter out, int maxTempFiles)
  • Method Details

    • 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 validate
      reference - 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 validate
      reference - 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)
    • validateBamFileTermination

      public void validateBamFileTermination(Path 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)
    • setIndexValidationStringency

      public SamFileValidator setIndexValidationStringency(BamIndexValidator.IndexValidationStringency stringency)