本文整理了Java中htsjdk.samtools.util.Histogram.getSum()
方法的一些代码示例,展示了Histogram.getSum()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.getSum()
方法的具体详情如下:
包路径:htsjdk.samtools.util.Histogram
类名称:Histogram
方法名:getSum
[英]Returns the sum of the products of the histgram bin ids and the number of entries in each bin. Note: This is only supported if this histogram stores instances of Number.
[中]返回组织结构图bin ID的乘积和每个bin中的条目数之和。注意:仅当此直方图存储数字的实例时,才支持此操作。
代码示例来源:origin: org.seqdoop/htsjdk
public double getMean() {
if (mean == null) {
mean = getSum() / getCount();
}
return mean;
}
代码示例来源:origin: broadinstitute/picard
public void onComplete() {
//summarize read data
if (metrics.TOTAL_READS > 0)
{
metrics.PCT_PF_READS = (double) metrics.PF_READS / (double) metrics.TOTAL_READS;
metrics.PCT_ADAPTER = this.adapterReads / (double) metrics.PF_READS;
metrics.MEAN_READ_LENGTH = readLengthHistogram.getMean();
//Calculate BAD_CYCLES
metrics.BAD_CYCLES = 0;
for (final Histogram.Bin<Integer> cycleBin : badCycleHistogram.values()) {
final double badCyclePercentage = cycleBin.getValue() / metrics.TOTAL_READS;
if (badCyclePercentage >= 0.8) {
metrics.BAD_CYCLES++;
}
}
if(doRefMetrics) {
if (metrics.PF_READS > 0) metrics.PCT_PF_READS_ALIGNED = (double) metrics.PF_READS_ALIGNED / (double) metrics.PF_READS;
if (metrics.PF_READS_ALIGNED > 0) metrics.PCT_READS_ALIGNED_IN_PAIRS = (double) metrics.READS_ALIGNED_IN_PAIRS / (double) metrics.PF_READS_ALIGNED;
if (metrics.PF_READS_ALIGNED > 0) metrics.PCT_PF_READS_IMPROPER_PAIRS = (double) metrics.PF_READS_IMPROPER_PAIRS / (double) metrics.PF_READS_ALIGNED;
if (metrics.PF_READS_ALIGNED > 0) metrics.STRAND_BALANCE = numPositiveStrand / (double) metrics.PF_READS_ALIGNED;
if (this.chimerasDenominator > 0) metrics.PCT_CHIMERAS = this.chimeras / (double) this.chimerasDenominator;
if (nonBisulfiteAlignedBases > 0) metrics.PF_MISMATCH_RATE = mismatchHistogram.getSum() / (double) nonBisulfiteAlignedBases;
metrics.PF_HQ_MEDIAN_MISMATCHES = hqMismatchHistogram.getMedian();
if (hqNonBisulfiteAlignedBases > 0) metrics.PF_HQ_ERROR_RATE = hqMismatchHistogram.getSum() / (double) hqNonBisulfiteAlignedBases;
if (metrics.PF_ALIGNED_BASES > 0) metrics.PF_INDEL_RATE = this.indels / (double) metrics.PF_ALIGNED_BASES;
}
}
}
代码示例来源:origin: com.github.broadinstitute/picard
public void onComplete() {
//summarize read data
if (metrics.TOTAL_READS > 0)
{
metrics.PCT_PF_READS = (double) metrics.PF_READS / (double) metrics.TOTAL_READS;
metrics.PCT_ADAPTER = this.adapterReads / (double) metrics.PF_READS;
metrics.MEAN_READ_LENGTH = readLengthHistogram.getMean();
//Calculate BAD_CYCLES
metrics.BAD_CYCLES = 0;
for (final Histogram.Bin<Integer> cycleBin : badCycleHistogram.values()) {
final double badCyclePercentage = cycleBin.getValue() / metrics.TOTAL_READS;
if (badCyclePercentage >= 0.8) {
metrics.BAD_CYCLES++;
}
}
if(doRefMetrics) {
if (metrics.PF_READS > 0) metrics.PCT_PF_READS_ALIGNED = (double) metrics.PF_READS_ALIGNED / (double) metrics.PF_READS;
if (metrics.PF_READS_ALIGNED > 0) metrics.PCT_READS_ALIGNED_IN_PAIRS = (double) metrics.READS_ALIGNED_IN_PAIRS / (double) metrics.PF_READS_ALIGNED;
if (metrics.PF_READS_ALIGNED > 0) metrics.PCT_PF_READS_IMPROPER_PAIRS = (double) metrics.PF_READS_IMPROPER_PAIRS / (double) metrics.PF_READS_ALIGNED;
if (metrics.PF_READS_ALIGNED > 0) metrics.STRAND_BALANCE = numPositiveStrand / (double) metrics.PF_READS_ALIGNED;
if (this.chimerasDenominator > 0) metrics.PCT_CHIMERAS = this.chimeras / (double) this.chimerasDenominator;
if (nonBisulfiteAlignedBases > 0) metrics.PF_MISMATCH_RATE = mismatchHistogram.getSum() / (double) nonBisulfiteAlignedBases;
metrics.PF_HQ_MEDIAN_MISMATCHES = hqMismatchHistogram.getMedian();
if (hqNonBisulfiteAlignedBases > 0) metrics.PF_HQ_ERROR_RATE = hqMismatchHistogram.getSum() / (double) hqNonBisulfiteAlignedBases;
if (metrics.PF_ALIGNED_BASES > 0) metrics.PF_INDEL_RATE = this.indels / (double) metrics.PF_ALIGNED_BASES;
}
}
}
代码示例来源: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(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: broadinstitute/picard
final long thisMetricTotal = (long) highQualityDepthHistogram.getSum();
final long otherMetricTotal = (long) otherMetric.highQualityDepthHistogram.getSum();
final long total = thisMetricTotal + otherMetricTotal;
final long thisTotalWithExcludes = (long) (thisMetricTotal / (1.0 - PCT_EXC_TOTAL));
代码示例来源:origin: com.github.broadinstitute/picard
final long thisMetricTotal = (long) highQualityDepthHistogram.getSum();
final long otherMetricTotal = (long) otherMetric.highQualityDepthHistogram.getSum();
final long total = thisMetricTotal + otherMetricTotal;
final long thisTotalWithExcludes = (long) (thisMetricTotal / (1.0 - PCT_EXC_TOTAL));
代码示例来源:origin: broadinstitute/picard
/** Metrics for evaluating the performance of whole genome sequencing experiments. */
public static class WgsMetrics extends MergeableMetricBase {
/** The intervals over which this metric was computed. */
@MergingIsManual
protected IntervalList intervals;
/** Count of sites with a given depth of coverage. Excludes bases with quality below MINIMUM_BASE_QUALITY (default 20) */
@MergingIsManual
protected final Histogram<Integer> highQualityDepthHistogram;
/** Count of sites with a given depth of coverage. Includes all but quality 2 bases */
@MergingIsManual
protected final Histogram<Integer> unfilteredDepthHistogram;
/** The count of bases observed with a given base quality. */
@MergingIsManual
protected final Histogram<Integer> unfilteredBaseQHistogram;
/** The maximum depth/coverage to consider. */
@MergeByAssertEquals
protected final int coverageCap;
/** The sample size used for theoretical het sensitivity. */
@NoMergingKeepsValue
protected final int theoreticalHetSensitivitySampleSize;
/**
* Create an instance of this metric that is not mergeable.
*/
代码示例来源:origin: com.github.broadinstitute/picard
/** Metrics for evaluating the performance of whole genome sequencing experiments. */
public static class WgsMetrics extends MergeableMetricBase {
/** The intervals over which this metric was computed. */
@MergingIsManual
protected IntervalList intervals;
/** Count of sites with a given depth of coverage. Excludes bases with quality below MINIMUM_BASE_QUALITY (default 20) */
@MergingIsManual
protected final Histogram<Integer> highQualityDepthHistogram;
/** Count of sites with a given depth of coverage. Includes all but quality 2 bases */
@MergingIsManual
protected final Histogram<Integer> unfilteredDepthHistogram;
/** The count of bases observed with a given base quality. */
@MergingIsManual
protected final Histogram<Integer> unfilteredBaseQHistogram;
/** The maximum depth/coverage to consider. */
@MergeByAssertEquals
protected final int coverageCap;
/** The sample size used for theoretical het sensitivity. */
@NoMergingKeepsValue
protected final int theoreticalHetSensitivitySampleSize;
/**
* Create an instance of this metric that is not mergeable.
*/
内容来源于网络,如有侵权,请联系作者删除!