Class 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()
    • 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

      • 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)
      • 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)