本文整理了Java中htsjdk.samtools.util.Histogram.getMedian()
方法的一些代码示例,展示了Histogram.getMedian()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Histogram.getMedian()
方法的具体详情如下:
包路径:htsjdk.samtools.util.Histogram
类名称:Histogram
方法名:getMedian
[英]Gets the median absolute deviation of the distribution.
[中]获取分布的中位数绝对偏差。
代码示例来源: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: 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
metrics.MAX_INSERT_SIZE = (int) histogram.getMax();
metrics.MIN_INSERT_SIZE = (int) histogram.getMin();
metrics.MEDIAN_INSERT_SIZE = histogram.getMedian();
metrics.MODE_INSERT_SIZE = histogram.getMode();
metrics.MEDIAN_ABSOLUTE_DEVIATION = histogram.getMedianAbsoluteDeviation();
final double median = histogram.getMedian();
double covered = 0;
double low = median;
代码示例来源: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: com.github.broadinstitute/picard
metrics.MAX_INSERT_SIZE = (int) histogram.getMax();
metrics.MIN_INSERT_SIZE = (int) histogram.getMin();
metrics.MEDIAN_INSERT_SIZE = histogram.getMedian();
metrics.MODE_INSERT_SIZE = histogram.getMode();
metrics.MEDIAN_ABSOLUTE_DEVIATION = histogram.getMedianAbsoluteDeviation();
final double median = histogram.getMedian();
double covered = 0;
double low = median;
代码示例来源: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: broadinstitute/picard
MEAN_COVERAGE = highQualityDepthHistogram.getMean();
SD_COVERAGE = highQualityDepthHistogram.getStandardDeviation();
MEDIAN_COVERAGE = highQualityDepthHistogram.getMedian();
MAD_COVERAGE = highQualityDepthHistogram.getMedianAbsoluteDeviation();
代码示例来源:origin: samtools/htsjdk
@Test(dataProvider = "medianTestData")
public void testMedian(final int [] values, final double median) {
final Histogram<Integer> histo = new Histogram<>();
for (final int i : values) histo.increment(i);
Assert.assertEquals(histo.getMedian(), median);
}
代码示例来源:origin: com.github.broadinstitute/picard
MEAN_COVERAGE = highQualityDepthHistogram.getMean();
SD_COVERAGE = highQualityDepthHistogram.getStandardDeviation();
MEDIAN_COVERAGE = highQualityDepthHistogram.getMedian();
MAD_COVERAGE = highQualityDepthHistogram.getMedianAbsoluteDeviation();
代码示例来源: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: broadinstitute/picard
this.metrics.MEDIAN_CV_COVERAGE = cvs.getMedian();
this.metrics.MEDIAN_5PRIME_BIAS = fivePrimeSkews.getMedian();
this.metrics.MEDIAN_3PRIME_BIAS = threePrimeSkews.getMedian();
this.metrics.MEDIAN_5PRIME_TO_3PRIME_BIAS = fiveToThreeSkews.getMedian();
代码示例来源:origin: com.github.broadinstitute/picard
this.metrics.MEDIAN_CV_COVERAGE = cvs.getMedian();
this.metrics.MEDIAN_5PRIME_BIAS = fivePrimeSkews.getMedian();
this.metrics.MEDIAN_3PRIME_BIAS = threePrimeSkews.getMedian();
this.metrics.MEDIAN_5PRIME_TO_3PRIME_BIAS = fiveToThreeSkews.getMedian();
代码示例来源: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;
}
}
}
内容来源于网络,如有侵权,请联系作者删除!