Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several updates #302

Merged
merged 3 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 9 additions & 4 deletions pegasus/plotting/plot_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ def compo_plot(
bottom: Optional[float] = 0.15,
wspace: Optional[float] = 0.3,
hspace: Optional[float] = 0.15,
xticklabels_rotation: Optional[float] = 90.0,
yticklabels_rotation: Optional[float] = 0.0,
return_fig: Optional[bool] = False,
dpi: Optional[float] = 300.0,
**kwargs,
Expand Down Expand Up @@ -836,6 +838,10 @@ def compo_plot(
This parameter sets the width between panels and also the figure's right margin as a fraction of panel's width (wspace * panel_size[0]).
hspace: ``float``, optional (defualt: ``0.15``)
This parameter sets the height between panels and also the figure's top margin as a fraction of panel's height (hspace * panel_size[1]).
xticklabels_rotation: Optional[float] = 90.0,
Rotation of x-axis tick labels.
yticklabels_rotation: Optional[float] = 0.0,
Rotation of y-axis tick labels.
return_fig: ``bool``, optional, default: ``False``
Return a ``Figure`` object if ``True``; return ``None`` otherwise.
dpi: ``float``, optional, default: ``300.0``
Expand Down Expand Up @@ -904,14 +910,13 @@ def compo_plot(
ax.grid(False)
if not switch_axes:
ax.set_xlabel(groupby_label)
ax.set_xticklabels(ax.get_xticklabels(), rotation=xticklabels_rotation, ha='center')
ax.set_ylabel("Percentage")
else:
ax.set_xlabel("Percentage")
ax.set_ylabel(groupby_label)
ax.legend(loc="center left", bbox_to_anchor=(1.05, 0.5))

if len(max(df.index.astype(str), key=len)) >= 5:
ax.set_xticklabels(ax.get_xticklabels(), rotation=-45, ha='left')
ax.set_yticklabels(ax.get_yticklabels(), rotation=yticklabels_rotation, ha='center')
ax.legend(loc="center left", bbox_to_anchor=(1.05, 0.5))

return fig if return_fig else None

Expand Down
8 changes: 3 additions & 5 deletions pegasus/tools/pseudobulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def get_pseudobulk_count(X, df, attr, bulk_list):

@timer(logger=logger)
def pseudobulk(
data: MultimodalData,
data: Union[MultimodalData, UnimodalData],
groupby: str,
attrs: Optional[Union[List[str], str]] = None,
mat_key: str = "counts",
condition: Optional[str] = None,
) -> UnimodalData:
) -> MultimodalData:
"""Generate Pseudo-bulk count matrices.

Parameters
Expand Down Expand Up @@ -157,9 +157,7 @@ def deseq2(
compute_all: bool = False,
n_jobs: int = -1,
) -> None:
"""Perform Differential Expression (DE) Analysis using DESeq2 on pseduobulk data. This function calls R package DESeq2, requiring DESeq2 in R installed.

DE analysis will be performed on all pseudo-bulk matrices in pseudobulk.
"""Perform Differential Expression (DE) Analysis using DESeq2 on pseduobulk data.

Parameters
----------
Expand Down
Loading