protected MnaseOutput countMnaseReads(
      String chr,
      int pos,
      ChromScoresFast fwCounts,
      ChromScoresFast revCounts,
      boolean chipSeqMetric)
      throws Exception {
    double PSEUDOCOUNT = 0.005; // per bp
    int FRAGLENHIGH = 600;

    int center = pos;
    int quarterNuc = (int) ((double) this.footprintSize / 4.0);
    int halfNuc = (int) ((double) this.footprintSize / 2.0);
    int assocHalf = (int) ((double) this.assocSize / 2.0);
    int fraghalf = (int) ((double) FRAGLENHIGH / 2.0);

    int cycle = halfNuc;

    int s, e;

    MnaseOutput out = new MnaseOutput();

    //		int windHalf = (int)((double)this.normalizationWindow/2.0);
    //		s = center - windHalf;
    //		e = center + windHalf;
    //		out.normWindCount = (double)this.countUnstrandedReads(fwCounts, revCounts,chr, s, e);
    //		//			System.err.printf("NormWind Cpg %d\t Getting (all) reads %s at %d-%d\t%d\n", center,
    // mnasePrefix, s, e,(int)normWindCount);

    if (chipSeqMetric) {
      // CHIP-SEQ .  THIS SHOULD TAKE  A FRAGMENT LEN, BUT 600 is based on K4 IMR90 offsets.
      System.err.println("Why are we using ChIP-seq metric??");
      System.exit(1);

      // First fw
      s = center - fraghalf;
      e = center;
      int preCountPos = countReads(fwCounts, chr, s, e);
      // if (preCountPos>0) System.err.printf("Cpg %d\t Getting (+) reads at %d-%d\t%d\n", center,
      // s, e,preCountPos);

      // Then rev
      s = center;
      e = center + fraghalf;
      int postCountNeg = countReads(revCounts, chr, s, e);
      // if (postCountNeg>0) System.err.printf("Cpg %d\t Getting (-) reads at %d-%d\t%d\n", center,
      // s, e,postCountNeg);

      out.val = (double) (preCountPos + postCountNeg) / (double) fraghalf;
      out.rawCounts = preCountPos + postCountNeg;

      //			if (this.normalizationWindow>0.0)
      //			{
      //				out = ((double)(preCountPos+postCountNeg)+(PSEUDOCOUNT*(double)fraghalf)) *
      //					(1.0/((double)normWindCount+(PSEUDOCOUNT*(double)this.normalizationWindow))) *
      //							(((double)this.normalizationWindow)/((double)fraghalf));
      //				out = Math.log(out)/LOG_OF_TWO;
      //			}
    } else {
      // MNASE METRIC

      // First fw
      s = center - cycle - assocHalf;
      e = center - cycle + assocHalf;
      int preCountPos = countReads(fwCounts, chr, s, e);
      // System.err.printf("Cpg %d\t Getting (+) reads at %d-%d\t%d\n", center, s, e,preCountPos);

      // Then rev
      s = center + cycle - assocHalf;
      e = center + cycle + assocHalf;
      int postCountNeg = countReads(revCounts, chr, s, e);
      // System.err.printf("Cpg %d\t Getting (-) reads at %d-%d\t%d\n", center, s, e,postCountNeg);

      int phasedCount = preCountPos + postCountNeg;
      int phasedLen = 2 * assocHalf;

      out.rawCounts = phasedCount;
      out.val = phasedCount;

      // Then unphased
      int unphasedCount = 0;
      s = center - assocHalf;
      e = center + assocHalf;
      unphasedCount += countUnstrandedReads(fwCounts, revCounts, chr, s, e);
      int unphasedLen = 2 * assocHalf;
      //			s = center - this.PERIODICITY - assocHalf;
      //			e = center - this.PERIODICITY + assocHalf;
      //			unphasedCount += countUnstrandedReads(fwCounts, revCounts, chr, s, e);
      //			s = center + this.PERIODICITY - assocHalf;
      //			e = center + this.PERIODICITY + assocHalf;
      //			unphasedCount += countUnstrandedReads(fwCounts, revCounts,  chr, s, e);
      //			int unphasedLen = 6 * assocHalf;
      //			//			System.err.printf("Cpg %d\t Getting unphased reads at %d-%d\t%d\n", center, center -
      // this.PERIODICITY - assocHalf,
      //			//					center + this.PERIODICITY + assocHalf,unphasedCount);
      //
      //
      //

      out.val =
          ((double) (phasedCount) + (PSEUDOCOUNT * (double) phasedLen))
              * (1.0 / ((double) unphasedCount + (PSEUDOCOUNT * (double) unphasedLen)))
              * (((double) unphasedLen) / ((double) phasedLen));
      out.val = Math.log(out.val) / LOG_OF_TWO;

      out.val = phasedCount - unphasedCount;
      out.val = Math.min(preCountPos, postCountNeg) - unphasedCount;
    }

    return out;
  }