From 64c23dd028e7c58837861ad807f5b5998fec40fe Mon Sep 17 00:00:00 2001 From: Boris MUZELLEC Date: Mon, 4 Nov 2024 15:27:21 +0100 Subject: [PATCH 1/3] refactor: stop using deprecated pandas DataFrameGroupBy.grouper --- pydeseq2/utils.py | 4 +--- pyproject.toml | 3 +-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pydeseq2/utils.py b/pydeseq2/utils.py index 95d93ac1..0626db3a 100644 --- a/pydeseq2/utils.py +++ b/pydeseq2/utils.py @@ -1114,9 +1114,7 @@ def robust_method_of_moments_disp( filtered_counts = normed_counts[three_or_more.values, :] filtered_design = design_matrix.loc[three_or_more, :] cell_id = pd.Series( - filtered_design.groupby( - filtered_design.columns.values.tolist() - ).grouper.group_info[0], + filtered_design.groupby(filtered_design.columns.values.tolist()).ngroup(), index=filtered_design.index, ) v = trimmed_cell_variance(filtered_counts, cell_id) diff --git a/pyproject.toml b/pyproject.toml index e30e39a8..91b786e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,5 +49,4 @@ filterwarnings = [ "error", '''ignore:\s*Pyarrow will become a required dependency of pandas:DeprecationWarning''', # ignore Pyarrow deprecation warnings - "ignore::FutureWarning", # Ignore AnnData FutureWarning about implicit conversion -] +] \ No newline at end of file From 4caadefaebff79c77f93aef73837bc4ba69f2671 Mon Sep 17 00:00:00 2001 From: Boris MUZELLEC Date: Mon, 4 Nov 2024 15:29:41 +0100 Subject: [PATCH 2/3] refactor: use rcond=None in lstsq to take FutureWarning into account --- pydeseq2/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydeseq2/utils.py b/pydeseq2/utils.py index 0626db3a..65b6e381 100644 --- a/pydeseq2/utils.py +++ b/pydeseq2/utils.py @@ -1594,7 +1594,7 @@ def lowess( [np.sum(weights * features), np.sum(weights * features * features)], ] ) - beta = np.linalg.lstsq(A, b)[0] + beta = np.linalg.lstsq(A, b, rcond=None)[0] yest[i] = beta[0] + beta[1] * features[i] residuals = targets - yest From 50248ffdaa596c08df36425eb4c192328184e757 Mon Sep 17 00:00:00 2001 From: Boris MUZELLEC Date: Mon, 4 Nov 2024 15:42:41 +0100 Subject: [PATCH 3/3] test: leave remaining FutureWarnings to future PRs --- pyproject.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 91b786e2..eecde408 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,4 +49,6 @@ filterwarnings = [ "error", '''ignore:\s*Pyarrow will become a required dependency of pandas:DeprecationWarning''', # ignore Pyarrow deprecation warnings + '''ignore:\s*A value is trying to be set on a copy of a DataFrame:FutureWarning''', + '''ignore:\s*Setting an item of incompatible dtype:FutureWarning''', ] \ No newline at end of file