Exemplo n.º 1
0
  public Map<String, Double> methLevels(IupacPatterns patterns) {
    Map<String, Double> out = new HashMap<String, Double>();
    Map<String, FractionNonidentical> orig = this.methLevelsFractions(patterns);

    for (String key : orig.keySet()) {
      FractionNonidentical frac = orig.get(key);
      out.put(key, frac.doubleValue());
    }

    return out;
  }
Exemplo n.º 2
0
  public Map<String, FractionNonidentical> methLevelsFractions(IupacPatterns patterns) {
    Map<String, FractionNonidentical> out = new HashMap<String, FractionNonidentical>();

    Iterator<Cpg> it = this.iterator();
    while (it.hasNext()) {
      Cpg cpg = it.next();
      String contextOrig = cpg.getPrevBasesRef() + "C" + cpg.getNextBasesRef();
      String context = patterns.firstMatch(contextOrig);
      //			System.err.printf("Read at pos %d, cpg at pos %d: contextOrig=%s, context=%s\n",
      // this.midpointChromPos(), cpg.chromPos, contextOrig, context);
      if (context != null) {
        FractionNonidentical frac = out.get(context);
        if (frac == null) {
          frac = new FractionNonidentical();
        }
        frac.incDenominator();
        if (cpg.cReads > 0) frac.incNumerator();
        out.put(context, frac);
      }
    }

    return out;
  }