# Class CompareMetrics

java.lang.Object
picard.cmdline.CommandLineProgram
picard.analysis.CompareMetrics

@DocumentedFeature public class CompareMetrics extends CommandLineProgram
Compare two metrics files.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`CompareMetrics.MetricComparisonDifferences`

## Field Summary

Fields
Modifier and Type
Field
Description
`boolean`
`IGNORE_HISTOGRAM_DIFFERENCES`
`List<File>`
`INPUT`
`List<String>`
`KEY`
`List<String>`
`METRIC_ALLOWABLE_RELATIVE_CHANGE`
`List<String>`
`METRICS_NOT_REQUIRED`
`List<String>`
`METRICS_TO_IGNORE`
`protected final Map<String,Double>`
`MetricToAllowableRelativeChange`
`File`
`OUTPUT`
`File`
`OUTPUT_TABLE`

### 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
`CompareMetrics()`

## Method Summary

Modifier and Type
Method
Description
`protected Map<List<Object>, htsjdk.samtools.metrics.MetricBase>`
`buildMetricsMap(List<? extends htsjdk.samtools.metrics.MetricBase> metrics)`
`protected int`
`compareMetricsForEntry(htsjdk.samtools.metrics.MetricBase metric1, htsjdk.samtools.metrics.MetricBase metric2, Field[] fields, Set<String> metricsToIgnore, String key)`
`protected picard.analysis.CompareMetrics.SimpleResult`
`compareMetricValues(Object value1, Object value2, String metricName)`
`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.

### Methods inherited from class CommandLineProgram

`checkRInstallation, getCommandLine, getCommandLineParser, getCommandLineParserForArgs, getDefaultHeaders, getFaqLink, getMetricsFile, getPGRecord, getStandardUsagePreamble, getStandardUsagePreamble, getVersion, hasWebDocumentation, instanceMain, instanceMainWithExit, makeReferenceArgumentCollection, parseArgs, requiresReference, 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="Metric files to compare.", minElements=2, maxElements=2) public List<File> INPUT

### OUTPUT

@Argument(shortName="O", doc="Output file to write comparison results to.", optional=true) public File OUTPUT

### OUTPUT_TABLE

@Argument(doc="Output file to write table of differences to.", optional=true) public File OUTPUT_TABLE

### METRICS_TO_IGNORE

@Argument(shortName="MI", doc="Metrics to ignore. Any metrics specified here will be excluded from comparison by the tool. Note that while the values of these metrics are not compared, if they are missing from either file that will be considered a difference. Use METRICS_NOT_REQUIRED to specify metrics which can be missing from either file without being considered a difference.", optional=true) public List<String> METRICS_TO_IGNORE

### METRICS_NOT_REQUIRED

@Argument(shortName="MNR", doc="Metrics which are not required. Any metrics specified here may be missing from either of the files in the comparison, and this will not affect the result of the comparison. If metrics specified here are included in both files, their results will not be compared (they will be treated as METRICS_TO_IGNORE.", optional=true) public List<String> METRICS_NOT_REQUIRED

### METRIC_ALLOWABLE_RELATIVE_CHANGE

@Argument(shortName="MARC", doc="Metric Allowable Relative Change. A colon separate pair of metric name and an absolute relative change. For any metric specified here, when the values are compared between the two files, the program will allow that much relative change between the two values.", optional=true) public List<String> METRIC_ALLOWABLE_RELATIVE_CHANGE

### IGNORE_HISTOGRAM_DIFFERENCES

@Argument(shortName="IHD", doc="Ignore any differences between the two metric file's histograms (useful if using the 'METRIC_ALLOWABLE_RELATIVE_CHANGE')", optional=true) public boolean IGNORE_HISTOGRAM_DIFFERENCES

### KEY

@Argument(doc="Columns to use as keys for matching metrics rows that should agree. If not specified, it is assumed that rows should be in the same order.", optional=true) public List<String> KEY

### MetricToAllowableRelativeChange

protected final Map<String,Double> MetricToAllowableRelativeChange

## Constructor Details

### CompareMetrics

public CompareMetrics()

## Method Details

### 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.

### 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.

### buildMetricsMap

protected Map<List<Object>, htsjdk.samtools.metrics.MetricBase> buildMetricsMap(List<? extends htsjdk.samtools.metrics.MetricBase> metrics) throws NoSuchFieldException, IllegalAccessException

Throws:
  `NoSuchFieldException`
  `IllegalAccessException`

### compareMetricsForEntry

protected int compareMetricsForEntry(htsjdk.samtools.metrics.MetricBase metric1, htsjdk.samtools.metrics.MetricBase metric2, Field[] fields, Set<String> metricsToIgnore, String key) throws IllegalAccessException

Throws:
  `IllegalAccessException`

### compareMetricValues

protected picard.analysis.CompareMetrics.SimpleResult compareMetricValues(Object value1, Object value2, String metricName)