def plot_peakgene_overlaps(combos, same_genes, write=False):
    'Visualize the results of peakgene_overlaps function in bargraph form.'
    df_out = peakgene_overlaps(combos, same_genes, normalize=False)
    (df_d, df_a) = (df_out[(df_out.index.str.split('_').str[(- 1)] == 'del')], df_out[(df_out.index.str.split('_').str[(- 1)] == 'amp')])
    for x in zip((df_d, df_a), ('Deletion Peak Memberships', 'Amplification Peak Memberships')):
        x[0].index = x[0].index.str.split('_').str[0]
        x[0].plot.bar(stacked=True, color=['#af8dc3', '#f7f7f7', '#7fbf7b'], linewidth=1, edgecolor='k')
        plt.gca().set_xticklabels(x[0].index, rotation=90)
        plt.title(x[1], fontsize=18)
        plt.gcf().set_size_inches(10, 8)
        sns.despine()
        plt.savefig((x[1].split(' ')[0] + '_peakMemberships.pdf'), bbox_inches='tight')
        plt.savefig((x[1].split(' ')[0] + '_peakMemberships.png'), bbox_inches='tight')
        plt.clf()
    if write:
        df_out.to_csv('VennStats_focalpeaks.tsv', sep='\t')
Visualize the results of peakgene_overlaps function in bargraph form.
def plot_peakgene_overlaps(combos, same_genes, write=False):
    
    df_out = peakgene_overlaps(combos, same_genes, normalize=False)
    (df_d, df_a) = (df_out[(df_out.index.str.split('_').str[(- 1)] == 'del')], df_out[(df_out.index.str.split('_').str[(- 1)] == 'amp')])
    for x in zip((df_d, df_a), ('Deletion Peak Memberships', 'Amplification Peak Memberships')):
        x[0].index = x[0].index.str.split('_').str[0]
        x[0].plot.bar(stacked=True, color=['#af8dc3', '#f7f7f7', '#7fbf7b'], linewidth=1, edgecolor='k')
        plt.gca().set_xticklabels(x[0].index, rotation=90)
        plt.title(x[1], fontsize=18)
        plt.gcf().set_size_inches(10, 8)
        sns.despine()
        plt.savefig((x[1].split(' ')[0] + '_peakMemberships.pdf'), bbox_inches='tight')
        plt.savefig((x[1].split(' ')[0] + '_peakMemberships.png'), bbox_inches='tight')
        plt.clf()
    if write:
        df_out.to_csv('VennStats_focalpeaks.tsv', sep='\t')