Skip to content

Commit

Permalink
🎨 more docstring updates
Browse files Browse the repository at this point in the history
  • Loading branch information
enryH committed Dec 4, 2024
1 parent 9c96af7 commit a6f21c9
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions acore/enrichment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ def run_fisher(
group2: list[int],
alternative: str = "two-sided",
) -> tuple[float, float]:
"""annotated not-annotated
group1 a b
group2 c d
------------------------------------
"""Run fisher's exact test on two groups using `scipy.stats.fisher_exact`.
Example::
# annotated not-annotated
# group1 a b
# group2 c d
group1 = [a, b]
group2 = [c, d]
odds, pvalue = stats.fisher_exact([[a, b], [c, d]])
odds, pvalue = stats.fisher_exact(group1=[a, b],
group2 =[c, d]
)
"""

odds, pvalue = stats.fisher_exact([group1, group2], alternative)
Expand Down Expand Up @@ -80,10 +83,10 @@ def run_site_regulation_enrichment(
reject_col="rejected",
group_col="group",
method="fisher",
regex=r"(\w+~.+)_\w\d+\-\w+", # ! add example to docstring of what this matches
regex="(\\w+~.+)_\\w\\d+\\-\\w+", # ! add example to docstring of what kind of string this matches
correction="fdr_bh",
):
r"""
"""
This function runs a simple enrichment analysis for significantly
regulated protein sites in a dataset.
Expand All @@ -97,7 +100,7 @@ def run_site_regulation_enrichment(
group identifiers.
:param str annotation_col: name of the column from annotation containing
annotation terms.
:param str reject_col: name of the column from regulatio_data containing
:param str reject_col: name of the column from regulation_data containing
boolean for rejected null hypothesis.
:param str group_col: column name for new column in annotation dataframe
determining if feature belongs to foreground or background.
Expand All @@ -117,7 +120,7 @@ def run_site_regulation_enrichment(
reject_col='rejected',
group_col='group',
method='fisher',
match="(\w+~.+)_\w\d+\-\w+"
match="(\\w+~.+)_\\w\\d+\\-\\w+"
)
"""
result = pd.DataFrame()
Expand Down Expand Up @@ -300,7 +303,7 @@ def run_regulation_enrichment(
(columns: 'annotation', 'identifier' (feature identifiers), and 'source').
:param str identifier: name of the column from annotation containing feature identifiers.
:param str annotation_col: name of the column from annotation containing annotation terms.
:param str reject_col: name of the column from regulatio_data containing boolean for
:param str reject_col: name of the column from `regulation_data` containing boolean for
rejected null hypothesis.
:param str group_col: column name for new column in annotation dataframe determining
if feature belongs to foreground or background.
Expand Down Expand Up @@ -487,7 +490,7 @@ def run_ssgsea(
max_size: int = 500,
scale: bool = False,
permutations: int = 0,
):
) -> dict[str, pd.DataFrame]:
"""
Project each sample within a data set onto a space of gene set enrichment scores using
the single sample gene set enrichment analysis (ssGSEA) projection methodology
Expand Down

0 comments on commit a6f21c9

Please sign in to comment.