Class ValidateSamFile
This tool reports on the validity of a SAM or BAM file relative to the SAM format specification. This is useful for troubleshooting errors encountered with other tools that may be caused by improper formatting, faulty alignments, incorrect flag values, etc.
By default, the tool runs in VERBOSE mode and will exit after finding 100 errors and output them to the console (stdout). Therefore, it is often more practical to run this tool initially using the MODE=SUMMARY option. This mode outputs a summary table listing the numbers of all 'errors' and 'warnings'.
When fixing errors in your file, it is often useful to prioritize the severe validation errors and ignore the errors/warnings of lesser concern. This can be done using the IGNORE and/or IGNORE_WARNINGS arguments. For helpful suggestions on error prioritization, please follow this link to obtain additional documentation on ValidateSamFile.
After identifying and fixing your 'warnings/errors', we recommend that you rerun this tool to validate your SAM/BAM file prior to proceeding with your downstream analysis. This will verify that all problems in your file have been addressed.
This tool is a wrapper forSamFileValidator
.
Usage example:
java -jar picard.jar ValidateSamFile \
I=input.bam \
MODE=SUMMARY
To obtain a complete list with descriptions of both 'ERROR' and 'WARNING' messages, please see our additional documentation for this tool.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionList<htsjdk.samtools.SAMValidationError.Type>
boolean
htsjdk.samtools.BamIndexValidator.IndexValidationStringency
boolean
int
boolean
boolean
Fields inherited from class picard.cmdline.CommandLineProgram
COMPRESSION_LEVEL, CREATE_INDEX, CREATE_MD5_FILE, MAX_ALLOWABLE_ONE_LINE_SUMMARY_LENGTH, MAX_RECORDS_IN_RAM, QUIET, REFERENCE_SEQUENCE, referenceSequence, specialArgumentsCollection, SYNTAX_TRANSITION_URL, TMP_DIR, USE_JDK_DEFLATER, USE_JDK_INFLATER, VALIDATION_STRINGENCY, VERBOSITY
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class picard.cmdline.CommandLineProgram
checkRInstallation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, setDefaultHeaders, useLegacyParser
-
Field Details
-
INPUT
-
OUTPUT
@Argument(shortName="O", doc="Output file or standard out if missing", optional=true) public File OUTPUT -
MODE
-
IGNORE
@Argument(doc="List of validation error types to ignore.", optional=true) public List<htsjdk.samtools.SAMValidationError.Type> IGNORE -
MAX_OUTPUT
@Argument(shortName="MO", doc="The maximum number of lines output in verbose mode") public Integer MAX_OUTPUT -
IGNORE_WARNINGS
@Argument(doc="If true, only report errors and ignore warnings.") public boolean IGNORE_WARNINGS -
VALIDATE_INDEX
@Argument(doc="DEPRECATED. Use INDEX_VALIDATION_STRINGENCY instead. If true and input is a BAM file with an index file, also validates the index. Until this parameter is retired VALIDATE INDEX and INDEX_VALIDATION_STRINGENCY must agree on whether to validate the index.") public boolean VALIDATE_INDEX -
INDEX_VALIDATION_STRINGENCY
@Argument(doc="If set to anything other than IndexValidationStringency.NONE and input is a BAM file with an index file, also validates the index at the specified stringency. Until VALIDATE_INDEX is retired, VALIDATE INDEX and INDEX_VALIDATION_STRINGENCY must agree on whether to validate the index.") public htsjdk.samtools.BamIndexValidator.IndexValidationStringency INDEX_VALIDATION_STRINGENCY -
IS_BISULFITE_SEQUENCED
@Argument(shortName="BISULFITE", doc="Whether the input file consists of bisulfite sequenced reads. If so, C->T is not counted as an error in computing the value of the NM tag.") public boolean IS_BISULFITE_SEQUENCED -
MAX_OPEN_TEMP_FILES
@Argument(doc="Relevant for a coordinate-sorted file containing read pairs only. Maximum number of file handles to keep open when spilling mate info to disk. Set this number a little lower than the per-process maximum number of file that may be open. This number can be found by executing the \'ulimit -n\' command on a Unix system.") public int MAX_OPEN_TEMP_FILES -
SKIP_MATE_VALIDATION
@Argument(shortName="SMV", doc="If true, this tool will not attempt to validate mate information. In general cases, this option should not be used. However, in cases where samples have very high duplication or chimerism rates (> 10%), the mate validation process often requires extremely large amounts of memory to run, so this flag allows you to forego that check.") public boolean SKIP_MATE_VALIDATION
-
-
Constructor Details
-
ValidateSamFile
public ValidateSamFile()
-
-
Method Details
-
doWork
protected int doWork()Do the work after command line has been parsed.- Specified by:
doWork
in classCommandLineProgram
- Returns:
- -1 - failed to complete execution, 0 - ran successfully without warnings or errors, 1 - warnings but no errors, 2 - errors and warnings, 3 - errors but no warnings
-
customCommandLineValidation
Description copied from class:CommandLineProgram
Put any custom command-line validation in an override of this method. clp is initialized at this point and can be used to print usage and access argv. Any options set by command-line parser can be validated.- Overrides:
customCommandLineValidation
in classCommandLineProgram
- Returns:
- null if command line is valid. If command line is invalid, returns an array of error message to be written to the appropriate place.
-