def plot_go_terms_up(filename, ontologies, case_name, df): self._temp_df[case_name] = df.copy() self._plus[case_name] = sum(df.plus_minus == '+') self._minus[case_name] = sum(df.plus_minus == '-') pylab.savefig(f"{config.output_dir}/Panther_up_{case_name}.png") pylab.savefig(filename) pylab.close()
def plotter(filename, key): name = key.replace(" ", "_") pylab.ioff() histograms[key].plot(logy=False, lw=2, marker="o") pylab.title(name + "(%s)" % count) pylab.grid(True) pylab.savefig(filename) pylab.close() # need to close the figure otherwise warnings
def plot_go_terms_down(filename, ontologies, case_name, df): df = self.pe.plot_go_terms("down", ontologies=ontologies, compute_levels=self.enrichment_params['plot_compute_levels'], log=self.enrichment_params['plot_logx']) self._temp_df[case_name] = df.copy() self._plus[case_name] = sum(df.plus_minus == '+') self._minus[case_name] = sum(df.plus_minus == '-') pylab.savefig(f"{config.output_dir}/Panther_down_{case_name}.png") pylab.savefig(filename) pylab.close()
# plot coverage found by blasr, with random y distribution (to see if there are overlaps) ax = axarr[i * 2 + 1] list_contigs = plot_contigs(res_best_ref, ax, colors, mode="random") for area in genome_not_covered: ax.axvspan(area[0], area[1], alpha=0.1, color='k') ax.set_ylabel("Random") ax.set_xlabel("Reference genome position") ax.set_title(ref_found[i] + " : Random y") if save_not_covered: print(ref_found[i]) if len(genome_not_covered) > 0: df = pd.DataFrame(genome_not_covered) df.columns = ["start", "end"] df["reference"] = ref_found[i] df_not_covered_all = pd.concat([df_not_covered_all, df], ignore_index=True) #fig.subplots_adjust(bottom=0.1,top=0.9) fig.tight_layout() if save_plot: pylab.savefig(file_plot) else: pylab.show() pylab.close("all") if save_not_covered: df_not_covered_all.to_csv(filename_not_covered, index=None)
print("Create plots") #colors = ['m','r','y','g','b','c','k'] cmap = pylab.cm.get_cmap(colormap) #colors = [cmap(i) for i in np.linspace(0,1,len(list_analysis))] # positions of genome gen_pos = [[i, i + step - 1] for i in range(0, len_genome, step)] y_pos = list(np.linspace(0, 1, len(analysis_names) + 2)) if custom_colors: y_col = [colors[i] for i in range(len(analysis_names))] else: y_col = [cmap(i) for i in np.linspace(0, 1, len(analysis_names))] pylab.close('all') # create figure fig, axarr = pylab.subplots(len(gen_pos), 1, figsize=(int(step / 20000), int(len(gen_pos)) * 1.1)) for i in range(len(gen_pos)): subplot_variant_position(df_result, i, gen_pos, axarr, analysis_names, y_pos, y_col, be_repeats_concat) # add grey at the end (no genome) ax = axarr[-1] ax.axvspan(len_genome, gen_pos[-1][1], alpha=0.5, color='k') #fig.subplots_adjust(bottom=0.2)