* Main method for the program. Checks that all input files are present and
* readable and that the output file can be written to. Then iterates through
* all the records accumulating metrics. Finally writes metrics file
*/
protected int doWork() {
final Log log = Log.getInstance(getClass());
final ProgressLogger progress = new ProgressLogger(log);
// Some quick parameter checking
IOUtil.assertFileIsReadable(INPUT);
IOUtil.assertFileIsWritable(OUTPUT);
log.info("Reading input file and calculating metrics.");
final SAMFileReader sam = new SAMFileReader(IOUtil.openFileForReading(INPUT));
final MetricsFile<QualityYieldMetrics,Integer> metricsFile = getMetricsFile();
final QualityYieldMetrics metrics = new QualityYieldMetrics();