)
    ax.set_title(f"Mann-Whitney rank test p-value={p:.2e}")

    ax.grid(axis="x", lw=0.1, color="#e1e1e1", zorder=0)
    plt.savefig(
        f"{RPATH}/ProteinTranscript_cyclops_boxplot.pdf",
        bbox_inches="tight",
        transparent=True,
    )
    plt.close("all")

    #
    g = "PSMC2"

    plot_df = pd.concat([
        gexp.loc[g].rename("gexp"),
        prot.loc[g].rename("prot"),
        cnv.loc[g].rename("cnv"),
    ], axis=1).sort_values("cnv", ascending=False)

    _, ax = plt.subplots(1, 1, figsize=(2.5, 2.0), dpi=600)

    GIPlot.gi_continuous_plot("gexp", "prot", "cnv", plot_df, ax=ax, mid_point_norm=False)

    plt.savefig(
        f"{RPATH}/ProteinTranscript_cyclops_omics_{g}.pdf",
        bbox_inches="tight",
        transparent=True,
    )
    plt.close("all")
Exemplo n.º 2
0
                           plot_reg=False,
                           pal=PALETTE_TTYPE)
ax.set_xlabel(f"Factor {f_x[1:]}")
ax.set_ylabel(f"Factor {f_y[1:]}")
plt.savefig(f"{RPATH}/MultiOmics_{f_x}_{f_y}_tissue_plot.pdf",
            bbox_inches="tight")
plt.savefig(f"{RPATH}/MultiOmics_{f_x}_{f_y}_tissue_plot.png",
            bbox_inches="tight",
            dpi=600)
plt.close("all")

# Continous annotation
for z in ["VIM_proteomics", "CDH1_proteomics"]:
    ax = GIPlot.gi_continuous_plot(f_x,
                                   f_y,
                                   z,
                                   plot_df,
                                   cbar_label=z.replace("_", " "))
    ax.set_xlabel(f"Factor {f_x[1:]}")
    ax.set_ylabel(f"Factor {f_y[1:]}")
    plt.savefig(f"{RPATH}/MultiOmics_{f_x}_{f_y}_continous_{z}.pdf",
                bbox_inches="tight")
    plt.savefig(
        f"{RPATH}/MultiOmics_{f_x}_{f_y}_continous_{z}.png",
        bbox_inches="tight",
        dpi=600,
    )
    plt.close("all")

# Export matrix
plot_df = pd.concat(
        cbar_pos=None,
        figsize=np.array(plot_df.shape) * 0.275,
    )

    plt.savefig(
        f"{RPATH}/ProteinTranscriptSample_cfeatures_clustermap.pdf",
        bbox_inches="tight",
        transparent=True,
    )
    plt.close("all")

    #
    for z_var in ["CopyNumberInstability", "ploidy"]:
        ax = GIPlot.gi_continuous_plot("prot_corr",
                                       "gexp_prot_corr",
                                       z_var,
                                       satt_corr,
                                       mid_point_norm=False)
        ax.set_xlabel("Sanger&CMRI\nProtein ~ Copy number (Pearson's R)")
        ax.set_ylabel("Sanger&CMRI\nProtein ~ Transcript (Pearson's R)")
        plt.savefig(
            f"{RPATH}/ProteinTranscriptSample_prot_gexp_regression_{z_var}.pdf",
            bbox_inches="tight",
        )
        plt.close("all")

    #
    x_var, y_var, z_var = "ploidy", "CopyNumberInstability", "size"
    ax = GIPlot.gi_continuous_plot(x_var,
                                   y_var,
                                   z_var,
        dtype_df_lm = sl_lm_fimpor[dtype]

        # Correlate feature weights
        fimpor_corr = pd.Series({
            p: two_vars_correlation(dtype_df[p], dtype_df_lm[p].abs())["corr"]
            for p in set(dtype_df_lm).intersection(dtype_df)
        })

        # Plot
        nassoc_df_fimpo = pd.concat(
            [nassoc_df, fimpor_corr.rename("feature")], axis=1)

        g = GIPlot.gi_continuous_plot(
            "nassoc",
            dtype,
            "feature",
            nassoc_df_fimpo,
            lowess=True,
            cbar_label="Feature importance correlation",
        )
        g.set_xlabel("Number of associations (LM)")
        g.set_ylabel(f"Score (ML {dtype})")

        plt.savefig(f"{RPATH}/SLinteractions_ml_nassoc_{dtype}_fimpo.pdf",
                    bbox_inches="tight")
        plt.close("all")

    # Volcano
    #
    plot_df = sl_lm.query("fdr < .1")

    s_transform = MinMaxScaler(feature_range=[1, 10])