Package htsjdk.samtools.metrics
Class MetricsFile<BEAN extends MetricBase,HKEY extends Comparable>
java.lang.Object
htsjdk.samtools.metrics.MetricsFile<BEAN,HKEY>
- All Implemented Interfaces:
Serializable
public class MetricsFile<BEAN extends MetricBase,HKEY extends Comparable>
extends Object
implements Serializable
Contains a set of metrics that can be written to a file and parsed back
again. The set of metrics is composed of zero or more instances of a class,
BEAN, that extends
MetricBase
(all instances must be of the same type)
and may optionally include one or more histograms that share the same key set.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllMetrics
(Iterable<BEAN> beanz) Add multiple metric beans at once.void
Adds a header to the collection of metrics.void
addHistogram
(Histogram<HKEY> histogram) Adds a histogram to the list of histograms in the metrics file.void
Adds a bean to the collection of metrics.boolean
areHeadersEqual
(MetricsFile that) boolean
static boolean
areMetricsAndHistogramsEqual
(File file1, File file2) Compare the metrics and histograms in two files, ignoring headers.boolean
areMetricsEqual
(MetricsFile that) static boolean
areMetricsEqual
(File file1, File file2) Compare the metrics in two files, ignoring headers and histograms.boolean
Checks that the headers, metrics and histogram are all equal.Returns the list of headers.getHeaders
(Class<? extends Header> type) Returns the list of headers with the specified type.Returns the histogram contained in the metrics file if any.Returns the list of headers.int
Returns the number of histograms added to the metrics file.int
hashCode()
void
Reads the Metrics in from the given reader.static <T extends MetricBase>
List<T>Convenience method to read all the Metric beans from a metrics file.readHeaders
(File file) Method to read the header from a metrics file.void
setHistogram
(Histogram<HKEY> histogram) Sets the histogram contained in the metrics file.void
Writes out the metrics file to the supplied file.void
Writes out the metrics file to the supplied writer.
-
Field Details
-
MAJOR_HEADER_PREFIX
- See Also:
-
MINOR_HEADER_PREFIX
- See Also:
-
SEPARATOR
- See Also:
-
HISTO_HEADER
- See Also:
-
METRIC_HEADER
- See Also:
-
-
Constructor Details
-
MetricsFile
public MetricsFile()
-
-
Method Details
-
addHeader
Adds a header to the collection of metrics. -
getHeaders
Returns the list of headers. -
addMetric
Adds a bean to the collection of metrics. -
addAllMetrics
Add multiple metric beans at once. -
getMetrics
Returns the list of headers. -
getMetricsColumnLabels
-
getHistogram
Returns the histogram contained in the metrics file if any. -
setHistogram
Sets the histogram contained in the metrics file. -
addHistogram
Adds a histogram to the list of histograms in the metrics file. -
getAllHistograms
-
getNumHistograms
public int getNumHistograms()Returns the number of histograms added to the metrics file. -
getHeaders
Returns the list of headers with the specified type. -
write
Writes out the metrics file to the supplied file. The file is written out headers first, metrics second and histogram third.- Parameters:
f
- a File into which to write the metrics
-
write
Writes out the metrics file to the supplied writer. The file is written out headers first, metrics second and histogram third.- Parameters:
w
- a Writer into which to write the metrics
-
read
Reads the Metrics in from the given reader. -
equals
Checks that the headers, metrics and histogram are all equal. -
areHeadersEqual
-
areMetricsEqual
-
areHistogramsEqual
-
hashCode
public int hashCode() -
readBeans
Convenience method to read all the Metric beans from a metrics file.- Parameters:
file
- to be read.- Returns:
- list of beans from the file.
-
readHeaders
Method to read the header from a metrics file. -
areMetricsEqual
Compare the metrics in two files, ignoring headers and histograms. -
areMetricsAndHistogramsEqual
Compare the metrics and histograms in two files, ignoring headers.
-