# Class CollectSamErrorMetrics

java.lang.Object
picard.cmdline.CommandLineProgram
picard.sam.SamErrorMetric.CollectSamErrorMetrics

@DocumentedFeature public class CollectSamErrorMetrics extends CommandLineProgram
Program to collect error metrics on bases stratified in various ways.

## Field Summary

Fields
Modifier and Type
Field
Description
`List<String>`
`ERROR_METRICS`
`picard.sam.SamErrorMetric.ErrorType`
`ERROR_VALUE`
`String`
`FILE_EXTENSION`
`String`
`INPUT`
`boolean`
`INTERVAL_ITERATOR`
`List<File>`
`INTERVALS`
`int`
`LOCATION_BIN_SIZE`
`int`
`LONG_HOMOPOLYMER`
`long`
`MAX_LOCI`
`int`
`MIN_BASE_Q`
`int`
`MIN_MAPPING_Q`
`File`
`OUTPUT`
`int`
`PRIOR_Q`
`double`
`PROBABILITY`
`int`
`PROGRESS_STEP_INTERVAL`
`picard.sam.SamErrorMetric.ReadBaseStratification.Stratifier`
`STRATIFIER_VALUE`
`String`
`VCF`

### Fields inherited from class 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
Constructor
Description
`CollectSamErrorMetrics()`

## Method Summary

Modifier and Type
Method
Description
`static int`
`CompareVariantContextToLocus(htsjdk.samtools.SAMSequenceDictionary dictionary, htsjdk.variant.variantcontext.VariantContext variantContext, htsjdk.samtools.util.Locus locus)`
Compares a VariantContext to a Locus providing information regarding possible overlap, or relative location
`protected String[]`
`customCommandLineValidation()`
Put any custom command-line validation in an override of this method.
`protected int`
`doWork()`
Do the work after command line has been parsed.
`protected static BaseErrorAggregation`
`parseDirective(String stratifierDirective)`
Parses a "Directive" of the form "ERROR,STRATIFIER,STRATIFIER...etc." into a `BaseErrorAggregation` consisting of the appropriate `BaseCalculator` and the `CollectionStratifier` constructed from the various individual stratifiers.
`protected boolean`
`processDeletionLocus(htsjdk.samtools.util.SamLocusIterator.RecordAndOffset deletionRao, htsjdk.samtools.util.SamLocusIterator.LocusInfo locusInfo)`
Checks if the same record has been seen at the previous locus already, thereby determining whether or not a deletion has already been processed.
`protected boolean`
`requiresReference()`

### Methods inherited from class CommandLineProgram

`checkRInstallation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, setDefaultHeaders, useLegacyParser`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### INPUT

@Argument(shortName="I", doc="Input SAM or BAM file.") public String INPUT

### OUTPUT

@Argument(shortName="O", doc="Base name for output files. Actual file names will be generated from the basename and suffixes from the ERROR and STRATIFIER by adding a '.' and then error_by_stratifier[_and_stratifier]* where 'error' is ERROR's extension, and 'stratifier' is STRATIFIER's suffix. For example, an ERROR_METRIC of ERROR:BASE_QUALITY:GC_CONTENT will produce an extension '.error_by_base_quality_and_gc'. The suffixes can be found in the documentation for ERROR_VALUE and SUFFIX_VALUE.") public File OUTPUT

### ERROR_METRICS

@Argument(doc="Errors to collect in the form of \"ERROR(:STRATIFIER)*\". To see the values available for ERROR and STRATIFIER look at the documentation for the arguments ERROR_VALUE and STRATIFIER_VALUE.") public List<String> ERROR_METRICS

### ERROR_VALUE

@Argument(doc="A fake argument used to show the options of ERROR (in ERROR_METRICS).", optional=true) public picard.sam.SamErrorMetric.ErrorType ERROR_VALUE

### STRATIFIER_VALUE

@Argument(doc="A fake argument used to show the options of STRATIFIER (in ERROR_METRICS).", optional=true) public picard.sam.SamErrorMetric.ReadBaseStratification.Stratifier STRATIFIER_VALUE

### VCF

@Argument(shortName="V", doc="VCF of known variation for sample. program will skip over polymorphic sites in this VCF and avoid collecting data on these loci.", optional=true) public String VCF

### INTERVALS

@Argument(shortName="L", doc="Region(s) to limit analysis to. Supported formats are VCF or interval_list. Will *intersect* inputs if multiple are given. When this argument is supplied, the VCF provided must be *indexed*.", optional=true) public List<File> INTERVALS

### MIN_MAPPING_Q

@Argument(shortName="MQ", doc="Minimum mapping quality to include read.") public int MIN_MAPPING_Q

### MIN_BASE_Q

@Argument(shortName="BQ", doc="Minimum base quality to include base.") public int MIN_BASE_Q

### PRIOR_Q

@Argument(shortName="PE", doc="The prior error, in phred-scale (used for calculating empirical error rates).", optional=true) public int PRIOR_Q

### MAX_LOCI

@Argument(shortName="MAX", doc="Maximum number of loci to process (or unlimited if 0).", optional=true) public long MAX_LOCI

### LONG_HOMOPOLYMER

@Argument(shortName="LH", doc="Shortest homopolymer which is considered long. Used by the BINNED_HOMOPOLYMER stratifier.", optional=true) public int LONG_HOMOPOLYMER

### LOCATION_BIN_SIZE

@Argument(shortName="LBS", doc="Size of location bins. Used by the FLOWCELL_X and FLOWCELL_Y stratifiers", optional=true) public int LOCATION_BIN_SIZE

### PROBABILITY

@Argument(shortName="P", doc="The probability of selecting a locus for analysis (for downsampling).", optional=true) public double PROBABILITY

### PROGRESS_STEP_INTERVAL

@Argument(fullName="PROGRESS_STEP_INTERVAL", doc="The interval between which progress will be displayed.", optional=true) public int PROGRESS_STEP_INTERVAL

### INTERVAL_ITERATOR

@Argument(fullName="INTERVAL_ITERATOR", doc="Iterate through the file assuming it consists of a pre-created subset interval of the full genome. This enables fast processing of files with reads at disparate parts of the genome. Requires that the provided VCF file is indexed. ", optional=true) public boolean INTERVAL_ITERATOR

### FILE_EXTENSION

@Argument(shortName="EXT", doc="Append the given file extension to all metric file names (ex. OUTPUT.insert_size_metrics.EXT). No extension by default.", optional=true) public String FILE_EXTENSION

## Constructor Details

### CollectSamErrorMetrics

public CollectSamErrorMetrics()

## Method Details

### requiresReference

protected boolean requiresReference()

Overrides:
  `requiresReference` in class `CommandLineProgram`

### customCommandLineValidation

protected String[] 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 class `CommandLineProgram`
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.

### doWork

protected int doWork()
Description copied from class: `CommandLineProgram`
Do the work after command line has been parsed. RuntimeException may be thrown by this method, and are reported appropriately.

Specified by:
  `doWork` in class `CommandLineProgram`
Returns:
  program exit status.

### processDeletionLocus

protected boolean processDeletionLocus(htsjdk.samtools.util.SamLocusIterator.RecordAndOffset deletionRao, htsjdk.samtools.util.SamLocusIterator.LocusInfo locusInfo)
Checks if the same record has been seen at the previous locus already, thereby determining whether or not a deletion has already been processed. Note that calling this method will have the side effect of signaling that the record is processed at this location.

Parameters:
  `deletionRao` - The RecordAndOffset to be checked
  `locusInfo` - The LocusInfo to determine the current locus
Returns:
  True, if the record has been seen at the previous locus. False, if it has not yet been seen.

### CompareVariantContextToLocus

public static int CompareVariantContextToLocus(htsjdk.samtools.SAMSequenceDictionary dictionary, htsjdk.variant.variantcontext.VariantContext variantContext, htsjdk.samtools.util.Locus locus)
Compares a VariantContext to a Locus providing information regarding possible overlap, or relative location

Parameters:
  `dictionary` - The `SAMSequenceDictionary` to use for ordering the sequences
  `variantContext` - the `VariantContext` to compare
  `locus` - the `Locus` to compare
Returns:
  negative if variantContext comes before locus (with no overlap) zero if variantContext and locus overlap positive if variantContext comes after locus (with no overlap)

  if variantContext and locus are in the same contig the return value will be the number of bases apart they are, otherwise it will be MIN_INT/MAX_INT

### parseDirective

protected static BaseErrorAggregation parseDirective(String stratifierDirective)
Parses a "Directive" of the form "ERROR,STRATIFIER,STRATIFIER...etc." into a `BaseErrorAggregation` consisting of the appropriate `BaseCalculator` and the `CollectionStratifier` constructed from the various individual stratifiers. The conversion from string to object is performed by the enums `Errors` and `Stratifier`.

Parameters:
  `stratifierDirective` - The string directive describing the error type and collection of stratifiers to use
Returns:
  The appropriate `BaseErrorAggregation`.