Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handles, labels = ax.get_legend_handles_labels()
if idf.opt['outputAs'] == 'html':
#TODO: show legend properly (see mpld3 bug #274)
#leg = fig.legend(handles, labels, loc='upper right', fancybox=True, fontsize=10, title='')
leg = axes[0].legend(handles, labels, loc='upper right', fancybox=True, fontsize=10, title='', prop={'size': 8})
else:
leg = plt.figlegend(handles, labels, loc='upper right', fancybox=True,
fontsize=font_size, title='', prop={'size': font_size-3})
leg.draggable()
fig.subplots_adjust(hspace=2)
fig.set_tight_layout(True)
if idf.opt['outputAs'] == 'html':
plugins.clear(fig)
plugins.connect(fig, plugins.Reset(), plugins.BoxZoom(), plugins.Zoom(enabled=False),
plugins.MousePosition(fontsize=14, fmt=".5g"))
figures.append(mpld3.fig_to_html(fig))
elif idf.opt['outputAs'] == 'interactive':
plt.show(block=False)
elif idf.opt['outputAs'] == 'pdf':
pp.savefig(plt.gcf())
elif idf.opt['outputAs'] == 'tikz':
from matplotlib2tikz import save as tikz_save
tikz_save('{}_{}_{}.tex'.format(filename,
group['dataset'][0]['title'].replace('_','-'), ds // idf.model.num_dofs),
figureheight = '\\figureheight', figurewidth = '\\figurewidth', show_info=False)
if idf.opt['outputAs'] == 'html':
path = os.path.dirname(os.path.abspath(__file__))
template_environment = Environment(autoescape=False,
loader=FileSystemLoader(os.path.join(path, '../output')),
Statistics for scaffolds in genome.
highlight_scaffold_ids : d[scaffold_id] -> color
Scaffolds in genome to highlight.
link_scaffold_ids : list of scaffold pairs
Pairs of scaffolds to link together.
mean_coverage : list of float
Mean coverage profile of genome.
cov_percs : iterable
Coverage percentile values to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
axes_hist = self.fig.add_subplot(121)
axes_scatter = self.fig.add_subplot(122)
self.plot_on_axes(self.fig, genome_scaffold_stats,
highlight_scaffold_ids,
link_scaffold_ids,
mean_coverage, cov_percs,
axes_hist, axes_scatter, True)
self.fig.tight_layout(pad=1, w_pad=1)
self.draw()
Statistics for scaffolds in genome.
highlight_scaffold_ids : d[scaffold_id] -> color
Scaffolds in genome to highlight.
link_scaffold_ids : list of scaffold pairs
Pairs of scaffolds to link together.
mean_gc : float
Mean GC of genome.
mean_coverage : list of float
Mean coverage profile of genome.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
axis = self.fig.add_subplot(111)
scatter, _, _, _ = self.plot_on_axes(self.fig, genome_scaffold_stats,
highlight_scaffold_ids, link_scaffold_ids,
mean_gc, mean_coverage,
axis, True)
mpld3.plugins.connect(self.fig, LinkedBrush(scatter))
self.fig.tight_layout(pad=1, w_pad=1)
self.draw()
Scaffolds in genome to highlight.
link_scaffold_ids : list of scaffold pairs
Pairs of scaffolds to link together.
mean_gc : float
Mean GC of genome.
gc_dist : d[gc][length][percentile] -> critical value
GC distribution.
percentiles_to_plot : iterable
Percentile values to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
axes_hist = self.fig.add_subplot(121)
axes_scatter = self.fig.add_subplot(122)
self.plot_on_axes(self.fig, genome_scaffold_stats,
highlight_scaffold_ids,
link_scaffold_ids,
mean_gc, gc_dist, percentiles_to_plot,
axes_hist, axes_scatter, True)
self.fig.tight_layout(pad=1, w_pad=1)
self.draw()
Scaffolds in genome to highlight.
link_scaffold_ids : list of scaffold pairs
Pairs of scaffolds to link together.
mean_signature : float
Mean tetranucleotide signature of genome.
td_dist : d[length][percentile] -> critical value
TD distribution.
percentiles_to_plot : iterable
Percentile values to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
axes_hist = self.fig.add_subplot(121)
axes_scatter = self.fig.add_subplot(122)
self.plot_on_axes(self.fig,
genome_scaffold_stats,
highlight_scaffold_ids,
link_scaffold_ids,
mean_signature, td_dist, percentiles_to_plot,
axes_hist, axes_scatter, True)
self.fig.tight_layout(pad=1, w_pad=1)
self.draw()
GC distribution.
td_dist : d[length][percentile] -> critical value
TD distribution.
gc_perc : float
GC percentile value to mark on plot.
td_perc : float
TD percentile value to mark on plot.
cov_perc : float
Mean percent deviation to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
# create subplots depending on availability of coverage information
if len(genome_stats.mean_coverage) >= 1:
# note: the ordering here is specific and ensures
# proper linked brushing
axes_gc_dist = self.fig.add_subplot(241)
axes_tetra_dist = self.fig.add_subplot(242)
axes_coverage_dist = self.fig.add_subplot(243)
axes_td_cov = self.fig.add_subplot(246)
axes_pc1_cov = self.fig.add_subplot(247)
axes_tetra_pc1_pc3 = self.fig.add_subplot(248)
axes_gc_coverage = self.fig.add_subplot(245)
axes_tetra_pc1_pc2 = self.fig.add_subplot(244)
Statistics for scaffolds in genome.
highlight_scaffold_ids : d[scaffold_id] -> color
Scaffolds in genome to highlight.
link_scaffold_ids : list of scaffold pairs
Pairs of scaffolds to link together.
mean_coverage : float
Mean coverage profile of genome.
cov_corrs : iterable
Coverage correlation values to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width, self.options.height)
axes_hist = self.fig.add_subplot(121)
axes_scatter = self.fig.add_subplot(122)
self.plot_on_axes(self.fig, genome_scaffold_stats,
highlight_scaffold_ids,
link_scaffold_ids,
mean_coverage, cov_corrs,
axes_hist, axes_scatter, True)
self.fig.tight_layout(pad=1, w_pad=1)
self.draw()
GC distribution.
td_dist : d[length][percentile] -> critical value
TD distribution.
gc_perc : float
GC percentile value to mark on plot.
td_perc : float
TD percentile value to mark on plot.
cov_perc : float
Mean percent deviation to mark on plot.
"""
# Set size of figure
self.fig.clear()
mpld3.plugins.clear(self.fig)
mpld3.plugins.connect(self.fig, mpld3.plugins.Reset(), mpld3.plugins.BoxZoom(), mpld3.plugins.Zoom())
mpld3.plugins.connect(self.fig, mpld3.plugins.MousePosition(fontsize=12, fmt='.1f'))
self.fig.set_size_inches(self.options.width*(2.0/3), self.options.height)
# create subplots depending on availability of coverage information
if len(genome_stats.mean_coverage) >= 1:
axes_hist_GC = self.fig.add_subplot(321)
axes_scatter_GC = self.fig.add_subplot(322)
axes_hist_TD = self.fig.add_subplot(323)
axes_scatter_TD = self.fig.add_subplot(324)
axes_hist_cov_perc = self.fig.add_subplot(325)
axes_scatter_cov_perc = self.fig.add_subplot(326)
else:
axes_hist_GC = self.fig.add_subplot(221)
axes_scatter_GC = self.fig.add_subplot(222)
axes_hist_TD = self.fig.add_subplot(223)