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

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

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

Histogram.<init>介绍

[英]Constructs a new Histogram with default bin and value labels.
[中]

代码示例

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

public IlluminaMetricCounts(final String barcode, final String barcodeName, final Integer laneNumber) {
  this.tileToClusterHistogram = new Histogram<>();
  this.tileToPfClusterHistogram = new Histogram<>();
  this.metrics = new IlluminaBasecallingMetrics();
  this.metrics.MOLECULAR_BARCODE_SEQUENCE_1 = barcode;
  this.metrics.MOLECULAR_BARCODE_NAME = barcodeName;
  this.metrics.LANE = Integer.toString(laneNumber);
}

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

private Histogram<Integer> getDepthHistogramNonZero() {
  final Histogram<Integer> depthHistogram = new Histogram<>("coverage", "count_NON_ZERO_REGIONS");
  // do not include the zero-coverage bin
  for (int i = 1; i < highQualityDepthHistogramArray.length; ++i) {
    depthHistogram.increment(i, highQualityDepthHistogramArray[i]);
  }
  return depthHistogram;
}

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

protected Histogram<Integer> getHistogram(final long[] array, final String binLabel, final String valueLabel) {
  final Histogram<Integer> histogram = new Histogram<>(binLabel, valueLabel);
  for (int i = 0; i < array.length; ++i) {
    histogram.increment(i, array[i]);
  }
  return histogram;
}

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

private Histogram<Integer> getDepthHistogramNonZero() {
  final Histogram<Integer> depthHistogram = new Histogram<>("coverage", "count_NON_ZERO_REGIONS");
  // do not include the zero-coverage bin
  for (int i = 1; i < highQualityDepthHistogramArray.length; ++i) {
    depthHistogram.increment(i, highQualityDepthHistogramArray[i]);
  }
  return depthHistogram;
}

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

@Test
public void testCopyCtor() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo1 = new Histogram<>();
  for (final int i : is) histo1.increment(i);
  final Histogram<Integer> histo2 = new Histogram<>(histo1);
  Assert.assertEquals(histo1, histo2);
  Assert.assertEquals(histo2, histo1);
}

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

private Histogram<Integer> singleDepthHistogram(final int depth, final int count) {
  final Histogram<Integer> histogram = new Histogram<>();
  histogram.increment(depth, count);
  return histogram;
}
private Histogram<Integer> twoSiteDepthHistogram(final int depth1, final int count1, final int depth2, final int count2) {

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

@Test
public void testGeometricMean() {
  final int[] is = {4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8};
  final Histogram<Integer> histo = new Histogram<>();
  for (final int i : is) histo.increment(i);
  Assert.assertTrue(abs(histo.getGeometricMean() - 6.216797) < 0.00001);
}

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

@Test
public void testGetSum() {
  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.getSum(), (double)(2*4+3*5), 0.000001);
}

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

@Test(dataProvider = "histogramData") //this data provider has several extra variables that we don't make use of here
public void testSerializeHistogram(final int[] values, final double mean, final double stdev, final Integer trimByWidth) throws IOException, ClassNotFoundException {
  final Histogram<Integer> histo = new Histogram<>();
  for (int value : values) {
    histo.increment(value);
  }
  Histogram<Integer> deserializedHistogram = TestUtil.serializeAndDeserialize(histo);
  Assert.assertEquals(deserializedHistogram, histo);
}

代码示例来源: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();
}

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

@Test(expectedExceptions = UnsupportedOperationException.class)
public void testGetSumBlowup() {
  final String[] is = {"foo", "foo", "bar"};
  final Histogram<String> histo = new Histogram<>();
  for (final String i : is) histo.increment(i);
  histo.getSum();//blow up
}

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

@Test(expectedExceptions = UnsupportedOperationException.class)
public void testGetMaxBlowup() {
  final String[] is = {"foo", "bar", "bar"};
  final Histogram<String> histo = new Histogram<>();
  for (final String i : is) histo.increment(i);
  histo.getMax();//blow up
}

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

@Test
public void testGetMedianBinSize() {
  final int[] is = {4,4,5,5,5,6,6,6,6};
  final Histogram<Integer> histo = new Histogram<>();
  Assert.assertEquals(histo.getMedianBinSize(), 0, 0.000001); //empty
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(histo.getMedianBinSize(), 3, 0.000001); //three fives
}

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

@Test
public void testGetMedianBinSize_Even() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo = new Histogram<>();
  Assert.assertEquals(histo.getMedianBinSize(), 0, 0.000001); //empty
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(histo.getMedianBinSize(), (2+3)/2.0, 0.000001); //even split
}

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

@Test
public void testLabels() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo = new Histogram<>("FOO", "BAR");
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(histo.getBinLabel(),"FOO");
  Assert.assertEquals(histo.getValueLabel(),"BAR");
}

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

@Test
public void testGetMinMax() {
  final int[] is = {4,4,5,5,5,6,6,6,6};
  final Histogram<Integer> histo = new Histogram<>();
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(histo.getMin(), 4.0);
  Assert.assertEquals(histo.getMax(), 6.0);
}

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

@Test
public void testMad() {
  final int[] is = {4,4,4,4,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8};
  final Histogram<Integer> histo = new Histogram<>();
  for (final int i : is) histo.increment(i);
  Assert.assertEquals(7d, histo.getMedian());
  Assert.assertEquals(1d, histo.getMedianAbsoluteDeviation());
  Assert.assertTrue(abs(histo.estimateSdViaMad() - 1.4826) < 0.0001);
}

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

private Histogram<Integer> twoSiteDepthHistogram(final int depth1, final int count1, final int depth2, final int count2) {
  final Histogram<Integer> histogram = new Histogram<>();
  if (0 < depth1) histogram.increment(depth1, count1);
  if (0 < depth2) histogram.increment(depth2, count2);
  return histogram;
}

相关文章