private static void findIndividualPerSequenceCoverage(
     Calibrator calibrator,
     Map<String, Integer> sequenceLengths,
     Map<String, String> readGroupToSampleId,
     final Map<String, HashMap<String, CalibrationStats>> local,
     RegionRestriction restriction) {
   final Covariate rgCovariate =
       calibrator.getCovariate(calibrator.getCovariateIndex(CovariateEnum.READGROUP));
   final Covariate seqCovariate =
       calibrator.getCovariate(calibrator.getCovariateIndex(CovariateEnum.SEQUENCE));
   for (final Map.Entry<String, Integer> entry : sequenceLengths.entrySet()) {
     final String sequenceName = entry.getKey();
     if (restriction != null && !sequenceName.equals(restriction.getSequenceName())) {
       continue;
     }
     for (final Map.Entry<String, String> e2 : readGroupToSampleId.entrySet()) {
       final String readGroup = e2.getKey();
       final String sampleName = e2.getValue();
       final int rgValue = rgCovariate.valueOf(readGroup);
       final int seqValue = seqCovariate.valueOf(sequenceName);
       if (rgValue == -1 || seqValue == -1) {
         add(local, sampleName, sequenceName, new CalibrationStats(null));
       } else {
         final Calibrator.QuerySpec spec = calibrator.initQuery();
         spec.setValue(CovariateEnum.READGROUP, rgValue);
         spec.setValue(CovariateEnum.SEQUENCE, seqValue);
         calibrator.processStats(new LocalStatsProcessor(local, sampleName, sequenceName), spec);
       }
     }
   }
 }
 public static Covariate[] makeInitializedStandardCovariates() {
   final RecalibrationArgumentCollection RAC = new RecalibrationArgumentCollection();
   final Covariate[] covariates = new Covariate[4];
   covariates[0] = new ReadGroupCovariate();
   covariates[1] = new QualityScoreCovariate();
   covariates[2] = new ContextCovariate();
   covariates[3] = new CycleCovariate();
   for (Covariate cov : covariates) cov.initialize(RAC);
   return covariates;
 }
 private static void findIndividualGlobalCoverage(
     Calibrator calibrator,
     Map<String, String> readGroupToSampleId,
     final Map<String, HashMap<String, CalibrationStats>> local) {
   final Covariate rgCovariate =
       calibrator.getCovariate(calibrator.getCovariateIndex(CovariateEnum.READGROUP));
   for (final Map.Entry<String, String> e2 : readGroupToSampleId.entrySet()) {
     final String readGroup = e2.getKey();
     final String sampleName = e2.getValue();
     final int rgValue = rgCovariate.valueOf(readGroup);
     if (rgValue == -1) {
       add(local, sampleName, DUMMY_SEQ, new CalibrationStats(null));
     } else {
       final Calibrator.QuerySpec spec = calibrator.initQuery();
       spec.setValue(CovariateEnum.READGROUP, rgValue);
       calibrator.processStats(new LocalStatsProcessor(local, sampleName, DUMMY_SEQ), spec);
     }
   }
 }