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

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

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

Histogram.getMeanBinSize介绍

[英]Calculates the mean bin size
[中]计算平均垃圾箱大小

代码示例

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

public void finish() {
  cytoConversionRate = nCytoTotal == 0 ? 0 : nCytoConverted / (double)nCytoTotal;
  nCpgSeen = (int)cpgTotal.getSumOfValues();
  nCpgConverted = (int)cpgConverted.getSumOfValues();
  cpgConversionRate = nCpgSeen == 0 ? 0 : nCpgConverted / (double)nCpgSeen;
  coverageMean = cpgTotal.getMeanBinSize();
  coverageMedian = (int)cpgTotal.getMedianBinSize();
}

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

private void onComplete() {
  final double meanClustersPerTile = tileToClusterHistogram.getMeanBinSize();
  metrics.MEAN_CLUSTERS_PER_TILE = Math.round(meanClustersPerTile);
  metrics.SD_CLUSTERS_PER_TILE = Math.round(tileToClusterHistogram.getStandardDeviationBinSize(meanClustersPerTile));
  final double meanPfClustersPerTile = tileToPfClusterHistogram.getMeanBinSize();
  metrics.MEAN_PF_CLUSTERS_PER_TILE = Math.round(meanPfClustersPerTile);
  metrics.SD_PF_CLUSTERS_PER_TILE = Math.round(tileToPfClusterHistogram.getStandardDeviationBinSize(meanPfClustersPerTile));
  final DecimalFormat decFormat = new DecimalFormat("#.##");
  final Histogram<Integer> laneToPctPfClusterHistogram = tileToPfClusterHistogram.divideByHistogram(tileToClusterHistogram);
  final double meanPctPfClustersPerTile = laneToPctPfClusterHistogram.getMeanBinSize();
  metrics.MEAN_PCT_PF_CLUSTERS_PER_TILE = (Double.isNaN(meanPctPfClustersPerTile) ? 0 : Double.valueOf(decFormat.format(meanPctPfClustersPerTile * 100)));
  metrics.SD_PCT_PF_CLUSTERS_PER_TILE = Double.valueOf(decFormat.format(laneToPctPfClusterHistogram.getStandardDeviationBinSize(meanPctPfClustersPerTile) * 100));
  metrics.TOTAL_CLUSTERS = (long) this.tileToClusterHistogram.getSumOfValues();
  metrics.PF_CLUSTERS = (long) this.tileToPfClusterHistogram.getSumOfValues();
  final ReadStructure readStructure = new ReadStructure(READ_STRUCTURE);
  int templateBaseCountPerCluster = 0;
  for (int i = 0; i < readStructure.templates.length(); i++) {
    templateBaseCountPerCluster += readStructure.templates.get(i).length;
  }
  metrics.TOTAL_READS = metrics.TOTAL_CLUSTERS * readStructure.templates.length();
  metrics.PF_READS = metrics.PF_CLUSTERS * readStructure.templates.length();
  metrics.TOTAL_BASES = metrics.TOTAL_CLUSTERS * templateBaseCountPerCluster;
  metrics.PF_BASES = metrics.PF_CLUSTERS * templateBaseCountPerCluster;
}

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

public void finish() {
  cytoConversionRate = nCytoTotal == 0 ? 0 : nCytoConverted / (double)nCytoTotal;
  nCpgSeen = (int)cpgTotal.getSumOfValues();
  nCpgConverted = (int)cpgConverted.getSumOfValues();
  cpgConversionRate = nCpgSeen == 0 ? 0 : nCpgConverted / (double)nCpgSeen;
  coverageMean = cpgTotal.getMeanBinSize();
  coverageMedian = (int)cpgTotal.getMedianBinSize();
}

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

private void onComplete() {
  final double meanClustersPerTile = tileToClusterHistogram.getMeanBinSize();
  metrics.MEAN_CLUSTERS_PER_TILE = Math.round(meanClustersPerTile);
  metrics.SD_CLUSTERS_PER_TILE = Math.round(tileToClusterHistogram.getStandardDeviationBinSize(meanClustersPerTile));
  final double meanPfClustersPerTile = tileToPfClusterHistogram.getMeanBinSize();
  metrics.MEAN_PF_CLUSTERS_PER_TILE = Math.round(meanPfClustersPerTile);
  metrics.SD_PF_CLUSTERS_PER_TILE = Math.round(tileToPfClusterHistogram.getStandardDeviationBinSize(meanPfClustersPerTile));
  final DecimalFormat decFormat = new DecimalFormat("#.##");
  final Histogram<Integer> laneToPctPfClusterHistogram = tileToPfClusterHistogram.divideByHistogram(tileToClusterHistogram);
  final double meanPctPfClustersPerTile = laneToPctPfClusterHistogram.getMeanBinSize();
  metrics.MEAN_PCT_PF_CLUSTERS_PER_TILE = (Double.isNaN(meanPctPfClustersPerTile) ? 0 : Double.valueOf(decFormat.format(meanPctPfClustersPerTile * 100)));
  metrics.SD_PCT_PF_CLUSTERS_PER_TILE = Double.valueOf(decFormat.format(laneToPctPfClusterHistogram.getStandardDeviationBinSize(meanPctPfClustersPerTile) * 100));
  metrics.TOTAL_CLUSTERS = (long) this.tileToClusterHistogram.getSumOfValues();
  metrics.PF_CLUSTERS = (long) this.tileToPfClusterHistogram.getSumOfValues();
  final ReadStructure readStructure = new ReadStructure(READ_STRUCTURE);
  int templateBaseCountPerCluster = 0;
  for (int i = 0; i < readStructure.templates.length(); i++) {
    templateBaseCountPerCluster += readStructure.templates.get(i).length;
  }
  metrics.TOTAL_READS = metrics.TOTAL_CLUSTERS * readStructure.templates.length();
  metrics.PF_READS = metrics.PF_CLUSTERS * readStructure.templates.length();
  metrics.TOTAL_BASES = metrics.TOTAL_CLUSTERS * templateBaseCountPerCluster;
  metrics.PF_BASES = metrics.PF_CLUSTERS * templateBaseCountPerCluster;
}

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

@Test
public void testGetMeanBinSize() {
  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.getMeanBinSize(), (2+3)/2.0, 0.000001);
}

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

@Test
public void testGetStandardDeviationBinSize() {
  final int[] is = {4,4,5,5,5};
  final Histogram<Integer> histo = new Histogram<>();
  for (final int i : is) histo.increment(i);
  final double std = Math.sqrt((pow(2.0-2.5, 2)+pow(3.0-2.5, 2.0))); //sample variance so dividing by 1
  Assert.assertEquals(histo.getStandardDeviationBinSize(histo.getMeanBinSize()), std, 0.000001);
}

相关文章