Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions bioinfokit/visuz.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ def volcano(df="dataframe", lfc=None, pv=None, lfc_thr=(1, 1), pv_thr=(0.05, 0.0
# plot
assign_values = {col: i for i, col in enumerate(color)}
color_result_num = [assign_values[i] for i in df['color_add_axy']]
assert len(set(color_result_num)) == 3, \
'either significant or non-significant genes are missing; try to change lfc_thr or pv_thr to include ' \
'both significant and non-significant genes'
if len(set(color_result_num)) != 3:
warnings.warn('either significant or non-significant genes are missing; try to change lfc_thr or pv_thr to '
'include both significant and non-significant genes')
if theme == 'dark':
general.dark_bg()
plt.subplots(figsize=dim)
if plotlegend:
s = plt.scatter(df[lfc], df['logpv_add_axy'], c=color_result_num, cmap=ListedColormap(color), alpha=valpha,
s=dotsize, marker=markerdot)
assert len(legendlabels) == 3, 'legendlabels must be size of 3'
# assert len(legendlabels) == 3, 'legendlabels must be size of 3'
plt.legend(handles=s.legend_elements()[0], labels=legendlabels, loc=legendpos, bbox_to_anchor=legendanchor)
else:
plt.scatter(df[lfc], df['logpv_add_axy'], c=color_result_num, cmap=ListedColormap(color), alpha=valpha,
Expand Down Expand Up @@ -207,15 +207,16 @@ def involcano(df="dataframe", lfc="logFC", pv="p_values", lfc_thr=(1, 1), pv_thr
# plot
assign_values = {col: i for i, col in enumerate(color)}
color_result_num = [assign_values[i] for i in df['color_add_axy']]
assert len(set(color_result_num)) == 3, 'either significant or non-significant genes are missing; try to change lfc_thr or ' \
'pv_thr to include both significant and non-significant genes'
if len(set(color_result_num)) != 3:
warnings.warn('either significant or non-significant genes are missing; try to change lfc_thr or pv_thr to '
'include both significant and non-significant genes')
if theme == 'dark':
general.dark_bg()
plt.subplots(figsize=dim)
if plotlegend:
s = plt.scatter(df[lfc], df['logpv_add_axy'], c=color_result_num, cmap=ListedColormap(color), alpha=valpha,
s=dotsize, marker=markerdot)
assert len(legendlabels) == 3, 'legendlabels must be size of 3'
# assert len(legendlabels) == 3, 'legendlabels must be size of 3'
plt.legend(handles=s.legend_elements()[0], labels=legendlabels, loc=legendpos,
bbox_to_anchor=legendanchor)
else:
Expand Down Expand Up @@ -270,16 +271,16 @@ def ma(df="dataframe", lfc=None, ct_count=None, st_count=None, basemean=None, pv
# plot
assign_values = {col: i for i, col in enumerate(color)}
color_result_num = [assign_values[i] for i in df['color_add_axy']]
assert len(
set(color_result_num)) == 3, 'either significant or non-significant genes are missing; try to change lfc_thr' \
' to include both significant and non-significant genes'
if len(set(color_result_num)) != 3:
warnings.warn('either significant or non-significant genes are missing; try to change lfc_thr or pv_thr to '
'include both significant and non-significant genes')
if theme:
General.style_bg(theme)
plt.subplots(figsize=dim)
if plotlegend:
s = plt.scatter(df['A_add_axy'], df[lfc], c=color_result_num, cmap=ListedColormap(color),
alpha=valpha, s=dotsize, marker=markerdot)
assert len(legendlabels) == 3, 'legendlabels must be size of 3'
# assert len(legendlabels) == 3, 'legendlabels must be size of 3'
plt.legend(handles=s.legend_elements()[0], labels=legendlabels, loc=legendpos,
bbox_to_anchor=legendanchor)
else:
Expand Down