コード例 #1
0
def atacseq_insert_metrics_hist_plot(df, **kwargs):
    """Plot qualimap global statistics.

    Args:
      df(:class:`~pandas.DataFrame`): data frame holding summary of qualimap results. The summary is provided by :meth:`snakemakelib.odo.picard.resource_insert_metrics`.
      kwargs(dict): keyword arguments

    Returns:
      :class:`bokeh.plotting.gridplot`: bokeh gridplot

    Examples:

    .. bokeh-plot::
        :source-position: above

        import pandas as pd
        from bokeh.plotting import show
        from snakemakelib_workflows.atacseq.app import atacseq_insert_metrics_hist_plot

        df = pd.DataFrame([['S1', 20, 2, 3],
                           ['S1', 21, 5, 4],
                           ['S1', 22, 15, 22],
                           ['S2', 20, 3, 1],
                           ['S2', 21, 4, 2],
                           ['S2', 22, 12, 10]],
                          columns=['SM','insert_size','All_Reads.fr_count', 'All_Reads.rf_count'])
        p = atacseq_insert_metrics_hist_plot(df)
        show(p)


    """
    fig = figure(width=400, height=400, title="Insert size distribution")
    fig.title.text_font_size = "10pt"
    all_reads = [x for x in list(df.columns) if x.startswith("All_Reads")]
    mlines(fig, df=df, x="insert_size",
           y=all_reads, legend=all_reads,
           color=colorbrewer(datalen = len(all_reads)), line_width=2)
    gp = facet_grid(fig, df=df, ncol=3,
                    groups=["SM"], width=300, height=300,
                    share_x_range=True, x='insert_size',
                    y=[x for x in all_reads])
    return gp
コード例 #2
0
def atacseq_insert_metrics_hist_plot(df, **kwargs):
    fig = figure(width=400, height=400, title="Insert size distribution", title_text_font_size="10pt")
    all_reads = [x for x in list(df.columns) if x.startswith("All_Reads")]
    mlines(
        fig,
        df=df,
        x="insert_size",
        y=all_reads,
        legend=all_reads,
        color=colorbrewer(datalen=len(all_reads)),
        line_width=2,
    )
    gp = facet_grid(
        fig,
        df=df,
        ncol=3,
        groups=["SM"],
        width=300,
        height=300,
        share_x_range=True,
        x="insert_size",
        y=[x for x in all_reads],
    )
    return gp