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(); }
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; }
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(); }
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; }
@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); }
@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); }