def draw_hist(self, fhand): scores = self._scores titles = ['aaaa'] * len(scores) plots_per_chart = 3 num_cols = 2 if len(scores) > plots_per_chart else 1 plot = HistogramPlotter(scores.values(), ylabel='Num. SNPs', xlabel='Coverage', titles=titles, kind=LINE, distrib_labels=scores.keys(), num_cols=num_cols, plots_per_chart=plots_per_chart) for axe in plot.axes: axe.axvline(self._coverage_threshold) plot.write_figure(fhand)
def test_histogram_plotter(self): values = [1, 2, 3, 1, 2, 3, 2, 3, 2, 3, 2, 1, 4] counter = IntCounter(values) counters = [counter] histo_ploter = HistogramPlotter(counters) assert len(histo_ploter.axes) == len(counters) fhand = NamedTemporaryFile(suffix='.png') histo_ploter.write_figure(fhand) # raw_input(fhand.name) # Add more intcounters counters.append(IntCounter(values)) counters.append(IntCounter(values)) histo_ploter = HistogramPlotter(counters, distrib_labels=['1', '2', '3']) assert len(histo_ploter.axes) == len(counters)
def draw_hist(self, fhand): counters = self._scores.values() samples = self._scores.keys() titles = ['Genotype quality distribution'] * len(counters) plots_per_chart = 3 num_cols = 1 if len(counters) <= plots_per_chart else 2 plot = HistogramPlotter(counters, distrib_labels=samples, xlabel='Genotype quality', num_cols=num_cols, ylabel='num genotypes', titles=titles, plots_per_chart=plots_per_chart) for axe in plot.axes: axe.axvline(self._min_qual, linewidth=2, c='#FF8D00') plot.write_figure(fhand)
def draw_hist(self, fhand): counters = self._scores.values() samples = self._scores.keys() titles = ["Genotype quality distribution"] * len(counters) plots_per_chart = 3 num_cols = 1 if len(counters) <= plots_per_chart else 2 plot = HistogramPlotter( counters, distrib_labels=samples, xlabel="Genotype quality", num_cols=num_cols, ylabel="num genotypes", titles=titles, plots_per_chart=plots_per_chart, ) for axe in plot.axes: axe.axvline(self._min_qual, linewidth=2, c="#FF8D00") plot.write_figure(fhand)