Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix-deseq2
Browse files Browse the repository at this point in the history
  • Loading branch information
yihming committed Jun 5, 2024
2 parents 46872ed + eaeeee6 commit bda3a26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
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: Optional[str] = None,
condition: Optional[str] = None,
) -> UnimodalData:
) -> MultimodalData:
"""Generate Pseudo-bulk count matrices.
Parameters
Expand Down Expand Up @@ -172,9 +172,7 @@ def deseq2(
verbose: bool = True,
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

0 comments on commit bda3a26

Please sign in to comment.