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

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

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

Histogram.size介绍

[英]Returns the size of this histogram.
[中]返回此直方图的大小。

代码示例

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

/**
 * Calculates the mean bin size
 */
public double getMeanBinSize() {
  return (getSumOfValues() / size());
}

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

/**
 * Calculates the mean bin size
 */
public double getMeanBinSize() {
  return (getSumOfValues() / size());
}

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

/**
 * Calculates the mean bin size
 */
public double getMeanBinSize() {
  return (getSumOfValues() / size());
}

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

public void calculateDerivedFields() {
  OBSERVED_UNIQUE_UMIS = observedUmis.size();
  INFERRED_UNIQUE_UMIS = inferredUmis.size();
  // Percent of UMIs that contain at least one N of total number of UMIs observed (observed UMIs is a count of UMIs without N)
  PCT_UMI_WITH_N = (double) observedUmiWithNs/ ((double) observedUmiWithNs + (double) totalObservedUmisWithoutNs);
  OBSERVED_UMI_ENTROPY = effectiveNumberOfBases(observedUmis);
  INFERRED_UMI_ENTROPY = effectiveNumberOfBases(inferredUmis);
  UMI_BASE_QUALITIES = QualityUtil.getPhredScoreFromErrorProbability((double) OBSERVED_BASE_ERRORS / (double) observedUmiBases);
}

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

public void calculateDerivedFields() {
  OBSERVED_UNIQUE_UMIS = observedUmis.size();
  INFERRED_UNIQUE_UMIS = inferredUmis.size();
  // Percent of UMIs that contain at least one N of total number of UMIs observed (observed UMIs is a count of UMIs without N)
  PCT_UMI_WITH_N = (double) observedUmiWithNs/ ((double) observedUmiWithNs + (double) totalObservedUmisWithoutNs);
  OBSERVED_UMI_ENTROPY = effectiveNumberOfBases(observedUmis);
  INFERRED_UMI_ENTROPY = effectiveNumberOfBases(inferredUmis);
  UMI_BASE_QUALITIES = QualityUtil.getPhredScoreFromErrorProbability((double) OBSERVED_BASE_ERRORS / (double) observedUmiBases);
}

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

/**
 * Calculates the median bin size
 */
public double getMedianBinSize() {
  if (size() == 0) {
    return 0;
  }
  final List<Double> binValues = new ArrayList<>();
  for (final Bin<K> bin : values()) {
    binValues.add(bin.getValue());
  }
  Collections.sort(binValues);
  final int midPoint = binValues.size() / 2;
  double median = binValues.get(midPoint);
  if (binValues.size() % 2 == 0) {
    median = (median + binValues.get(midPoint - 1)) / 2;
  }
  return median;
}

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

/**
 * Calculates the median bin size
 */
public double getMedianBinSize() {
  if (size() == 0) {
    return 0;
  }
  final List<Double> binValues = new ArrayList<Double>();
  for (final Bin bin : values()) {
    binValues.add(bin.getValue());
  }
  Collections.sort(binValues);
  final int midPoint = binValues.size() / 2;
  double median = binValues.get(midPoint);
  if (binValues.size() % 2 == 0) {
    median = (median + binValues.get(midPoint-1)) / 2;
  }
  return median;
}

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

/**
 * Calculates the median bin size
 */
public double getMedianBinSize() {
  if (size() == 0) {
    return 0;
  }
  final List<Double> binValues = new ArrayList<>();
  for (final Bin<K> bin : values()) {
    binValues.add(bin.getValue());
  }
  Collections.sort(binValues);
  final int midPoint = binValues.size() / 2;
  double median = binValues.get(midPoint);
  if (binValues.size() % 2 == 0) {
    median = (median + binValues.get(midPoint - 1)) / 2;
  }
  return median;
}

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

public static double[] normalizeHistogram(final Histogram<Integer> histogram) {
  if (histogram == null) throw new PicardException("Histogram is null and cannot be normalized");
  final double histogramSumOfValues = histogram.getSumOfValues();
  final double[] normalizedHistogram = new double[histogram.size()];
  for (int i = 0; i < histogram.size(); i++) {
    if (histogram.get(i) != null) {
      normalizedHistogram[i] = histogram.get(i).getValue() / histogramSumOfValues;
    }
  }
  return normalizedHistogram;
}

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

public static double[] normalizeHistogram(final Histogram<Integer> histogram) {
  if (histogram == null) throw new PicardException("Histogram is null and cannot be normalized");
  final double histogramSumOfValues = histogram.getSumOfValues();
  final double[] normalizedHistogram = new double[histogram.size()];
  for (int i = 0; i < histogram.size(); i++) {
    if (histogram.get(i) != null) {
      normalizedHistogram[i] = histogram.get(i).getValue() / histogramSumOfValues;
    }
  }
  return normalizedHistogram;
}

代码示例来源:origin: PapenfussLab/gridss

public static InsertSizeDistribution create(Histogram<Integer> insertSizeHistogram) {
  if (insertSizeHistogram == null) return null;
  int[] insertSize = new int[insertSizeHistogram.size()];
  double[] count = new double[insertSizeHistogram.size()];
  double total = insertSizeHistogram.getSumOfValues();
  int i = 0;
  Set<Integer> keys = insertSizeHistogram.keySet();
  for (Integer key : keys) {
    insertSize[i] = key;
    count[i] = insertSizeHistogram.get(key).getValue();
    i++;
  }
  return new InsertSizeDistribution(insertSize, count, (long)total);
}
public InsertSizeDistribution(int[] singletons, double[] readCounts) {

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

@Test
public void testSize() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo = new Histogram<>();
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(histo.size(), 2); //2 unique values
}

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

return histo.size() > 0 ? histo.getMode() : 0;

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

return histo.size() > 0 ? histo.getMode() : 0;

相关文章