Skip to content

Commit

Permalink
Merge pull request #23 from abearab/dev
Browse files Browse the repository at this point in the history
update plot_top_DEG_violinplot function
  • Loading branch information
abearab authored Jan 7, 2025
2 parents ce87ac5 + 47ff25c commit efc3376
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "scez"
version = "0.1.1"
version = "0.1.2"
authors = [
"Abe Arab <abarbiology@gmail.com>"
]
Expand Down
7 changes: 4 additions & 3 deletions scez/diffexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ def plot_volcano(df, title=None, labels=None, n_genes=False, side='both',
plt.show()


def plot_top_DEG_violinplot(adata, df, title=None, labels=None, n_genes=False, side='both', font_scale=1, figsize=(10, 4), **kwargs):
def plot_top_DEG_violinplot(adata, df, layer=None, title=None, labels=None, n_genes=False, side='both', font_scale=1, figsize=(10, 4), **kwargs):

label_font_size = 9 * font_scale
title_font_size = 10 * font_scale

Expand Down Expand Up @@ -167,11 +168,11 @@ def plot_top_DEG_violinplot(adata, df, title=None, labels=None, n_genes=False, s
selected_genes = df.nlargest(n_genes, '-log10(pvalue)')

# Filter the single-cell dataset for the selected genes
subset_adata = adata[:, selected_genes.index]
subset_adata = adata[:, selected_genes.index].copy()
subset_adata.var.index = subset_adata.var.index.str.split('_').str[0]

# Convert the subset of adata to a DataFrame
subset_df = subset_adata.to_df()
subset_df = subset_adata.to_df(layer=layer)

# Merge the DataFrame with .obs to include the 'sample' information
merged_df = pd.merge(subset_df, adata.obs[['sample']], left_index=True, right_index=True)
Expand Down

0 comments on commit efc3376

Please sign in to comment.