Skip to content

Commit

Permalink
🎨 pass on parameter for min set, docstrings
Browse files Browse the repository at this point in the history
resolve things discussed with Alberto.
  • Loading branch information
enryH committed Dec 2, 2024
1 parent 6a7db73 commit 142b778
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions acore/enrichment_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,12 @@ def _annotate_features(
Annotate features as foreground or background based on their presence in the
foreground and background lists.
:param features: pandas dataframe with features and their annotations.
:param features: pandas.Series with features and their annotations.
:param in_foreground: list of features identifiers in the foreground.
:type in_foreground: set or list-like
:param in_background: list of features identifiers in the background.
:type in_background: set or list-like
:return: pandas dataframe with a new column 'group' containing 'foreground' or 'background'.
:return: pandas.Series containing 'foreground' or 'background'.
missing values are preserved.
Example::
Expand All @@ -276,6 +276,7 @@ def run_regulation_enrichment(
reject_col: str = "rejected",
group_col: str = "group",
method: str = "fisher",
min_detected_in_set: int = 2,
correction: str = "fdr_bh",
correction_alpha: float = 0.05,
) -> pd.DataFrame:
Expand Down Expand Up @@ -336,6 +337,7 @@ def run_regulation_enrichment(
identifier_col=identifier,
method=method,
correction=correction,
min_detected_in_set=min_detected_in_set,
correction_alpha=correction_alpha,
)

Expand All @@ -348,7 +350,7 @@ def run_enrichment(
background_id: str,
foreground_pop: int,
background_pop: int,
min_detected_in_set: int = 1,
min_detected_in_set: int = 2,
annotation_col: str = "annotation",
group_col: str = "group",
identifier_col: str = "identifier",
Expand Down
1 change: 1 addition & 0 deletions tests/test_enrichment.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def test_run_regulation_enrichment():
actual = ea.run_regulation_enrichment(
regulation_data=regulation_res,
annotation=annotation,
min_detected_in_set=1,
)

expected = pd.DataFrame(
Expand Down

0 comments on commit 142b778

Please sign in to comment.