Пример #1
0
  private void setNorm(
      double medDepth,
      List<String> bad,
      Map<String, Double> factor2,
      Map<String, Double> sampleMedian) {

    for (Map.Entry<String, Map<String, Sample>> entry : samples.entrySet()) {
      if (!bad.contains(entry.getKey())) {
        for (Map.Entry<String, Sample> entrySample : entry.getValue().entrySet()) {
          Sample sample = entrySample.getValue();
          double norm1 = sample.getNorm1();
          double fact2 = factor2.get(entry.getKey());
          double smplMed = sampleMedian.get(sample.getSample());
          sample.setNorm1b(Precision.round(norm1 * fact2 + 0.1, 2));
          sample.setNorm2(
              Precision.round(
                  medDepth != 0 ? log.value((norm1 * fact2 + 0.1) / medDepth) / log.value(2) : 0,
                  2));
          sample.setNorm3(
              Precision.round(
                  smplMed != 0 ? log.value((norm1 * fact2 + 0.1) / smplMed) / log.value(2) : 0, 2));
        }
      }
    }
  }
Пример #2
0
 private void setFactor2(double medDepth, List<String> bad, Map<String, Double> factor2) {
   for (Map.Entry<String, Map<String, Sample>> entry : samples.entrySet()) {
     if (!bad.contains(entry.getKey())) {
       List<Double> list = new LinkedList<>();
       for (Map.Entry<String, Sample> entrySample : entry.getValue().entrySet()) {
         Sample sample = entrySample.getValue();
         list.add(sample.getNorm1());
       }
       double median = new Median().evaluate(toDoubleArray(list));
       if (median != 0) {
         factor2.put(entry.getKey(), medDepth / median);
       } else {
         factor2.put(entry.getKey(), 0.0);
       }
     }
   }
 }