In [1]:
# For ipython inline ploting ploting
%matplotlib inline
# Larger display
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:90% !important; }</style>"))
# Import of required packages
import pandas as pd
# import all function from pyBioPlot
from pyBioPlot import *
In [2]:
help(volcano_plot)
In [3]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
volcano_plot(df, "b", "qval", FDR=0.01, X_cutoff=2, figsize=[10,5], xlim=[-10,10], ylim=[-1, 30], sig_pos_color="red", sig_neg_color="blue",
non_sig_color="green", xlabel="Beta factor Nucleus localization")
In [4]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
highlight_list = [
{"label":"mock", "alpha":0.5},
{"target_id":df.target_id[(df.tech_var >= 0.2)], "label":"variable samples", "alpha":0.5},
{"target_id":df.target_id[(df.tech_var >= 0.4)]},
{"target_id":df.target_id[(df.tech_var >= 0.7)], "color":"black", "label":"very highly variable samples", "marker":"<"}]
volcano_plot(df, "b", "qval", figsize=[10,5], xlim=[-10,10], ylim=[-1, 30], highlight_list= highlight_list,
alpha=0.25, highlight_FDR=0.05, FDR=0.05, fontsize=5)
In [3]:
help(MA_plot)
In [6]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
MA_plot(df, "mean_obs", "b", FDR=0.01, FDR_col="qval", figsize=[10,5], sig_pos_color="red", sig_neg_color="green", non_sig_color="0.8",
xlabel="Mean expression",
ylabel="Beta factor Nucleus localization")
In [7]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
hl = [
{"df":df[(df.b>2)], "label":"High nuclear", "color":"red","alpha":0.2},
{"label":"mock", "alpha":0.5},
{"target_id":df.target_id[(df.tech_var >= 0.2)]},
{"target_id":df.target_id[(df.tech_var >= 1)], "color":"black", "label":"very highly variable samples", "alpha":1, "marker":"<"}]
MA_plot(
df = df,
X= "mean_obs",
Y= "b",
FDR=0.01,
FDR_col="qval",
highlight_list=hl,
figsize=[10,5],
xlabel="Mean expression",
ylabel="Beta factor Nucleus localization",
alpha=0.5,
highlight_FDR=0.05)
In [4]:
help(density_plot)
In [9]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
density_plot(df, "b", figsize=[10,5], ylabel="Cumulative Beta value")
In [10]:
df = pd.read_table("./test_data/localizationnucleus_wald_test.tsv")
df2 = df[(df.mean_obs>10)]
hl = [
{"df":df2, "label":"High nuclear", "color":"blue","linestyle":':', "linewidth":4},
{"label":"mock", "alpha":0.5},
{"target_id":df.target_id[(df.tech_var >= 1.3)], "linestyle":'--'},
{"target_id":df.target_id[(df.tech_var >= 1.5)], "color":"red", "label":"very highly variable samples", "alpha":0.5, "marker":"<"}]
density_plot(df, "b", figsize=[10,5], ylabel="Cumulative Beta value", highlight_list= hl, cumulative = True, cut=5)
In [5]:
help(PCA_var_plot)
In [10]:
df = pd.read_table("./test_data/obs_normalised_filtered.tsv")
display(df.head())
PCA_var_plot(df, variable_col='target_id', sample_col="sample", value_col="tpm", plot_style="ggplot", color="cadetblue", alpha=0.8, fontsize=15)
Out[10]:
In [6]:
help(PCA)
In [13]:
df = pd.read_table("./test_data/obs_normalised_filtered.tsv")
a= PCA(df, variable_col='target_id', sample_col="sample", value_col="tpm", pcx=1, pcy=2, point_label=True, plot_style="ggplot", fontsize=15, color= "cadetblue", alpha=0.8, linewidths=5)
a
Out[13]:
In [10]:
help(PCA)
In [14]:
df = pd.read_table("./test_data/obs_normalised_filtered2.tsv")
a= PCA2(df, variable_col='target_id', sample_col="sample", value_col="tpm", pcx=1, pcy=2, point_label=True, plot_style="ggplot", fontsize=15, color= "cadetblue", alpha=0.8, linewidths=5)
a
Out[14]:
In [7]:
help(get_color_list)
In [17]:
a = get_color_list(n=3, gamma=2, colormap="brg")
for i in range(6):
print(next(a))
In [8]:
help(try_color_list)
In [19]:
try_color_list(n_color=3, n_values=6, colormap="brg")
In [20]:
try_color_list(n_color=10, n_values=20, gamma=0.1, colormap="jet")
In [21]:
try_color_list(n_color=10, n_values=20, gamma=1, colormap="jet")
In [22]:
try_color_list(n_color=10, n_values=20, gamma=4, colormap="jet")
In [9]:
help(plot_text)
In [24]:
plot_text("This is my awesome text")
In [25]:
plot_text("This is my awesome text", align="left", color="red", fontsize=20, fontweight="bold")