htsjdk.samtools.util.Histogram.values()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中htsjdk.samtools.util.Histogram.values()方法的一些代码示例,展示了Histogram.values()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.values()方法的具体详情如下:
包路径:htsjdk.samtools.util.Histogram
类名称:Histogram
方法名:values

Histogram.values介绍

[英]Returns a Collection view of the values contained in this histogram. The collection's iterator returns the values in ascending order of the corresponding keys.
[中]返回此直方图中包含的值的集合视图。集合的迭代器按相应键的升序返回值。

代码示例

代码示例来源:origin: com.github.samtools/htsjdk

/** Returns the Bin that's the mode of the distribution (i.e. the largest bin). */
private Bin<K> getModeBin() {
  Bin<K> modeBin = null;
  for (final Bin<K> bin : values()) {
    if (modeBin == null || modeBin.value < bin.value) {
      modeBin = bin;
    }
  }
  return modeBin;
}

代码示例来源:origin: com.github.samtools/htsjdk

public double getCount() {
  double count = 0;
  for (final Bin<K> bin : values()) {
    count += bin.value;
  }
  return count;
}

代码示例来源:origin: org.seqdoop/htsjdk

/** Returns the Bin that's the mode of the distribution (i.e. the largest bin). */
private Bin getModeBin() {
  Bin modeBin = null;
  for (final Bin bin : values()) {
    if (modeBin == null || modeBin.value < bin.value) {
      modeBin = bin;
    }
  }
  return modeBin;
}

代码示例来源:origin: org.seqdoop/htsjdk

public double getCount() {
  double count = 0;
  for (final Bin bin : values()) {
    count += bin.value;
  }
  return count;
}

代码示例来源:origin: samtools/htsjdk

/** Returns the Bin that's the mode of the distribution (i.e. the largest bin). */
private Bin<K> getModeBin() {
  Bin<K> modeBin = null;
  for (final Bin<K> bin : values()) {
    if (modeBin == null || modeBin.value < bin.value) {
      modeBin = bin;
    }
  }
  return modeBin;
}

代码示例来源:origin: samtools/htsjdk

public double getCount() {
  double count = 0;
  for (final Bin<K> bin : values()) {
    count += bin.value;
  }
  return count;
}

代码示例来源:origin: com.github.samtools/htsjdk

/**
 * Calculates the standard deviation of the bin size
 */
public double getStandardDeviationBinSize(final double mean) {
  double total = 0;
  for(final Bin<K> bin : values()) {
    total += Math.pow(bin.getValue() - mean, 2);
  }
  return Math.sqrt(total / (Math.max(1,values().size()-1)));
}

代码示例来源:origin: org.seqdoop/htsjdk

/**
 * Calculates the standard deviation of the bin size
 */
public double getStandardDeviationBinSize(final double mean) {
  double total = 0;
  for(final Bin bin : values()) {
    total += Math.pow(bin.getValue() - mean, 2);
  }
  return Math.sqrt(total / (Math.max(1,values().size()-1)));
}

代码示例来源:origin: samtools/htsjdk

/**
 * Calculates the standard deviation of the bin size
 */
public double getStandardDeviationBinSize(final double mean) {
  double total = 0;
  for(final Bin<K> bin : values()) {
    total += Math.pow(bin.getValue() - mean, 2);
  }
  return Math.sqrt(total / (Math.max(1,values().size()-1)));
}

代码示例来源:origin: com.github.samtools/htsjdk

/** Gets the geometric mean of the distribution. */
public double getGeometricMean() {
  double total = 0;
  double count = 0;
  for (final Bin<K> bin : values()) {
    total += bin.value * log(bin.getIdValue());
    count += bin.value;
  }
  return exp(total / count);
}

代码示例来源:origin: org.seqdoop/htsjdk

/**
 * Returns the sum of the number of entries in each bin.
 */
public double getSumOfValues() {
  double total = 0;
  for (final Bin bin : values()) {
    total += bin.getValue();
  }
  return total;
}

代码示例来源:origin: org.seqdoop/htsjdk

/** Gets the geometric mean of the distribution. */
public double getGeometricMean() {
  double total = 0;
  double count = 0;
  for (final Bin bin : values()) {
    total += bin.value * log(bin.getIdValue());
    count += bin.value;
  }
  return exp(total / count);
}

代码示例来源:origin: samtools/htsjdk

/** Gets the geometric mean of the distribution. */
public double getGeometricMean() {
  double total = 0;
  double count = 0;
  for (final Bin<K> bin : values()) {
    total += bin.value * log(bin.getIdValue());
    count += bin.value;
  }
  return exp(total / count);
}

代码示例来源:origin: broadinstitute/picard

private double effectiveNumberOfBases(Histogram<?> observations) {
    double totalObservations = observations.getSumOfValues();

    // Convert to log base 4 so that the entropy is now a measure
    // of the effective number of DNA bases.  If we used log(2.0)
    // our result would be in bits.
    double entropyBaseE = observations.values().stream().collect(Collectors.summingDouble(
        v -> {double p = v.getValue() / totalObservations;
            return -p * Math.log(p);}));

    return entropyBaseE / MathUtil.LOG_4_BASE_E;
  }
}

代码示例来源:origin: com.github.broadinstitute/picard

private double effectiveNumberOfBases(Histogram<?> observations) {
    double totalObservations = observations.getSumOfValues();

    // Convert to log base 4 so that the entropy is now a measure
    // of the effective number of DNA bases.  If we used log(2.0)
    // our result would be in bits.
    double entropyBaseE = observations.values().stream().collect(Collectors.summingDouble(
        v -> {double p = v.getValue() / totalObservations;
            return -p * Math.log(p);}));

    return entropyBaseE / MathUtil.LOG_4_BASE_E;
  }
}

代码示例来源:origin: org.seqdoop/htsjdk

public double getStandardDeviation() {
  final double mean = getMean();
  double count = 0;
  double total = 0;
  for (final Bin bin : values()) {
    final double localCount = bin.getValue();
    final double value = bin.getIdValue();
    count += localCount;
    total += localCount * pow(value - mean, 2);
  }
  return Math.sqrt(total / (count-1));
}

代码示例来源:origin: org.seqdoop/htsjdk

/**
 * Returns the sum of the products of the histgram bin ids and the number of entries in each bin.
 */
public double getSum() {
  double total = 0;
  for (final Bin bin : values()) {
    total += bin.getValue() * bin.getIdValue();
  }
  return total;
}

代码示例来源:origin: samtools/htsjdk

/** Gets the median absolute deviation of the distribution. */
public double getMedianAbsoluteDeviation() {
  final double median = getMedian();
  final Histogram<Double> deviations = new Histogram<>();
  for (final Bin<K> bin : values()) {
    final double dev = abs(bin.getIdValue() - median);
    deviations.increment(dev, bin.getValue());
  }
  return deviations.getMedian();
}

代码示例来源:origin: com.github.samtools/htsjdk

/** Gets the median absolute deviation of the distribution. */
public double getMedianAbsoluteDeviation() {
  final double median = getMedian();
  final Histogram<Double> deviations = new Histogram<>();
  for (final Bin<K> bin : values()) {
    final double dev = abs(bin.getIdValue() - median);
    deviations.increment(dev, bin.getValue());
  }
  return deviations.getMedian();
}

代码示例来源:origin: org.seqdoop/htsjdk

/** Gets the median absolute deviation of the distribution. */
public double getMedianAbsoluteDeviation() {
  final double median = getMedian();
  final Histogram<Double> deviations = new Histogram<Double>();
  for (final Bin bin : values()) {
    final double dev = abs(bin.getIdValue() - median);
    deviations.increment(dev, bin.getValue());
  }
  return deviations.getMedian();
}

相关文章