<commit_before>'''
Created on 22 Jan 2016

@author: steve
'''
#Graph module
from pylab import * #@UnusedWildImport
import matplotlib.pyplot as plt # @Reimport


def den_plot(x_ref, 
        y_fwd_smoothed, y_rvs_smoothed, nt, fileFig, 
        fileName, onscreen, x_label, pub = False):
    """
    Single sRNA length den map plot:
    x-axis - reference
    y-axis - RPMR
    21,22,24 nt plots in default colours
    """
    plt.plot(x_ref,y_fwd_smoothed, color=nt_colour(nt), 
             label='{0} nt'.format(nt))
    plt.plot(x_ref,y_rvs_smoothed, color=nt_colour(nt))
    axhline(y=0)
    if pub:
        plt.tick_params(
        axis='both',          # changes apply to the x-axis
        which='both',      # both major and minor ticks are affected
        bottom='on',      # ticks along the bottom edge are off
        top='off',
        right='on',
        left='on',         # ticks along the top edge are off
        labelbottom='off',
        labelleft = 'off',
        labelright = 'off',
        labelsize=15) # labels along the bottom edge are off
        clear_frame() 
    else:
        xlabel(x_label)
        ylabel('Reads per million reads')
        plt.legend(loc='upper left',borderaxespad=0)
    fig1 = plt.gcf()
    if onscreen:
        plt.show()
    if fileFig:
        fig1.savefig(fileName, format='pdf')
    plt.close(fig1)


def den_multi_plot_3(x_ref, 
        y_fwd_smoothed_21, y_rvs_smoothed_21, 
        y_fwd_smoothed_22, y_rvs_smoothed_22, 
        y_fwd_smoothed_24, y_rvs_smoothed_24, fileFig,
        fileName, onscreen, x_label, plot_y_lim,
        pub = False):
    
    """
    21,22 and 24 nt sRNA length den map plot:
    x-axis - reference
    y-axis - RPMR
    21,22,24 nt plots in default colours
    """

    plt.plot(x_ref,y_fwd_smoothed_21, color='#00CC00',label='21 nt')
    plt.plot(x_ref,y_rvs_smoothed_21, color='#00CC00')
    plt.plot(x_ref,y_fwd_smoothed_22, color='#FF3399', label='22 nt')
    plt.plot(x_ref,y_rvs_smoothed_22, color='#FF3399')
    plt.plot(x_ref,y_fwd_smoothed_24, color='#3333FF', label='24 nt')
    plt.plot(x_ref,y_rvs_smoothed_24, color='#3333FF')
    axhline(y=0)
    if pub:
        plt.tick_params(
            axis='both',          # changes apply to the x-axis
            which='both',      # both major and minor ticks are affected
            bottom='on',      # ticks along the bottom edge are off
            top='off',
            right='on',
            left='on',         # ticks along the top edge are off
            labelbottom='off',
            labelleft = 'off',
            labelright = 'off',
            labelsize=15) # labels along the bottom edge are off
        clear_frame() 

    else:     #no_publication
        xlabel(x_label)
        ylabel('Reads per million reads')
        plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=3, mode="expand", borderaxespad=0.)
        plt.rc('font',family='Arial')
        plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=3, mode="expand", borderaxespad=0., fontsize=20)    
    if plot_y_lim !=0:
        ylim(-plot_y_lim, plot_y_lim)
    fig1 = plt.gcf()
    
    if onscreen:
        plt.show()
    if fileFig:
        fig1.savefig(fileName, format='pdf')
    plt.close(fig1)


def cdp_plot(counts_by_ref, seq1, seq2, nt, onscreen, fileFig, fileName, pub):
    """
    Scatter plot of alignments to references<commit_msg>Attempt to fix bug that prevents mnt3dm plot<commit_after>'''
Created on 22 Jan 2016

@author: steve
'''
#Graph module
from pylab import * #@UnusedWildImport
import matplotlib.pyplot as plt # @Reimport


def den_plot(x_ref, 
        y_fwd_smoothed, y_rvs_smoothed, nt, fileFig, 
        fileName, onscreen, x_label, pub = False):
    """
    Single sRNA length den map plot:
    x-axis - reference
    y-axis - RPMR
    21,22,24 nt plots in default colours
    """
    plt.plot(x_ref,y_fwd_smoothed, color=nt_colour(nt), 
             label='{0} nt'.format(nt))
    plt.plot(x_ref,y_rvs_smoothed, color=nt_colour(nt))
    axhline(y=0)
    if pub:
        plt.tick_params(
        axis='both',          # changes apply to the x-axis
        which='both',      # both major and minor ticks are affected
        bottom='on',      # ticks along the bottom edge are off
        top='off',
        right='on',
        left='on',         # ticks along the top edge are off
        labelbottom='off',
        labelleft = 'off',
        labelright = 'off',
        labelsize=15) # labels along the bottom edge are off
        clear_frame() 
    else:
        xlabel(x_label)
        ylabel('Reads per million reads')
        plt.legend(loc='upper left',borderaxespad=0)
    fig1 = plt.gcf()
    if onscreen:
        plt.show()
    if fileFig:
        fig1.savefig(fileName, format='pdf')
    plt.close(fig1)


def den_multi_plot_3(x_ref, 
        y_fwd_smoothed_21, y_rvs_smoothed_21, 
        y_fwd_smoothed_22, y_rvs_smoothed_22, 
        y_fwd_smoothed_24, y_rvs_smoothed_24, fileFig,
        fileName, onscreen, x_label, plot_y_lim,
        pub = False):
    
    """
    21,22 and 24 nt sRNA length den map plot:
    x-axis - reference
    y-axis - RPMR
    21,22,24 nt plots in default colours
    """

    plt.plot(x_ref,y_fwd_smoothed_21, color='#00CC00',label='21 nt')
    plt.plot(x_ref,y_rvs_smoothed_21, color='#00CC00')
    plt.plot(x_ref,y_fwd_smoothed_22, color='#FF3399', label='22 nt')
    plt.plot(x_ref,y_rvs_smoothed_22, color='#FF3399')
    plt.plot(x_ref,y_fwd_smoothed_24, color='#3333FF', label='24 nt')
    plt.plot(x_ref,y_rvs_smoothed_24, color='#3333FF')
    axhline(y=0)
    if pub:
        plt.tick_params(
            axis='both',          # changes apply to the x-axis
            which='both',      # both major and minor ticks are affected
            bottom='on',      # ticks along the bottom edge are off
            top='off',
            right='on',
            left='on',         # ticks along the top edge are off
            labelbottom='off',
            labelleft = 'off',
            labelright = 'off',
            labelsize=15) # labels along the bottom edge are off
        clear_frame() 

    else:     #no_publication
        xlabel(x_label)
        ylabel('Reads per million reads')
        plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
           ncol=3, mode="expand", borderaxespad=0.)
        plt.rc('font',family='Arial')
#         plt.legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
#            ncol=3, mode="expand", borderaxespad=0., fontsize=20)    
    if plot_y_lim !=0:
        ylim(-plot_y_lim, plot_y_lim)
    fig1 = plt.gcf()
    
    if onscreen:
        plt.show()
    if fileFig:
        fig1.savefig(fileName, format='pdf')
    plt.close(fig1)


def cdp_plot(counts_by_ref, seq1, seq2, nt, onscreen, fileFig, fileName, pub):
    """
    Scatter plot of alignments to references
{'fraction_non_alphanumeric': 0.11912043104703655, 'fraction_numerical': 0.03509538371923693, 'mean_word_length': 2.369970559371933, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7505818', 'n_tokens_mistral': 2604, 'n_tokens_neox': 2412, 'n_words': 558}