Skip to content

Commit 526c9d3

Browse files
committed
Fixed conflicts
1 parent 5570c36 commit 526c9d3

27 files changed

Lines changed: 87 additions & 70 deletions

src/decoupler/_datatype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
import pandas as pd
33
from anndata import AnnData
44

5-
DataType = AnnData | pd.DataFrame | tuple(np.ndarray, np.ndarray, np.ndarray)
5+
DataType = AnnData | pd.DataFrame | tuple[np.ndarray, np.ndarray, np.ndarray]

src/decoupler/bm/_pp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def _filter(
4343
net: pd.DataFrame,
4444
sfilt: bool,
4545
verbose: bool,
46-
) -> tuple(AnnData, pd.DataFrame):
46+
) -> tuple[AnnData, pd.DataFrame]:
4747
# Remove experiments without sources in net
4848
srcs = net["source"].unique()
4949
prts = set()

src/decoupler/bm/_run.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def _testsign(
3030
def _tensor_scores(
3131
adata: AnnData,
3232
thr: float,
33-
) -> tuple(np.ndarray, np.ndarray, np.ndarray, np.ndarray, list):
33+
) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, list]:
3434
# Get unique methods
3535
has_test = {m.name: m.test for m in _methods}
3636
has_test = has_test | {"consensus": True}
@@ -79,7 +79,7 @@ def _mask_grps(
7979
obs: pd.DataFrame,
8080
groupby: None | list,
8181
verbose: float,
82-
) -> tuple(list, list, list):
82+
) -> tuple[list, list, list]:
8383
if groupby is not None:
8484
# Init empty lsts
8585
msks = []
@@ -139,9 +139,9 @@ def _metric_scores(
139139
verbose: bool,
140140
**kwargs,
141141
) -> None:
142-
assert isinstance(metrics, str | list) or metrics is None, "metrics must be str or list"
143-
if isinstance(metrics, None):
144-
metrics = ["auc", "fscore", "qrank"]
142+
assert isinstance(metrics, str | list) or metrics is None, 'metrics must be str or list'
143+
if metrics is None:
144+
metrics = ['auc', 'fscore', 'qrank']
145145
elif isinstance(metrics, str):
146146
metrics = [metrics]
147147
if runby == "expr":

src/decoupler/bm/metric/_auc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def _binary_clf_curve(
77
y_true: np.ndarray,
88
y_score: np.ndarray,
9-
) -> tuple(np.ndarray, np.ndarray, np.ndarray):
9+
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
1010
# Sort scores
1111
idx = np.flip(np.argsort(y_score))
1212
y_score = y_score[idx]
@@ -78,7 +78,7 @@ def auc(
7878
y_true: np.ndarray,
7979
y_score: np.ndarray,
8080
pi0: float = 0.5,
81-
) -> tuple(float, float):
81+
) -> tuple[float, float]:
8282
"""Area Under the Curve."""
8383
# Normalize to make comparable
8484
norm = np.nanmax(np.abs(y_score), axis=1)

src/decoupler/bm/metric/_fscore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def fscore(
77
y_true: np.ndarray,
88
y_score: np.ndarray,
9-
) -> tuple(float, float, float):
9+
) -> tuple[float, float, float]:
1010
"""F-beta score"""
1111
# Validate
1212
_validate_bool(y_true=y_true, y_score=y_score)

src/decoupler/bm/metric/_qrank.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def qrank(
88
y_true: np.ndarray,
99
y_score: np.ndarray,
10-
) -> tuple(float, float):
10+
) -> tuple[float, float]:
1111
"""1 - quantile normalized rank"""
1212
_validate_bool(y_true=y_true, y_score=y_score)
1313
y_rank = sts.rankdata(y_score, axis=1, nan_policy="omit", method="average")

src/decoupler/ds/_toy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def toy(
2727
pstime: bool = False,
2828
seed: int = 42,
2929
verbose: bool = False,
30-
) -> tuple(AnnData, pd.DataFrame):
30+
) -> tuple[AnnData, pd.DataFrame]:
3131
"""
3232
Generate a toy adata and net for testing.
3333

src/decoupler/mt/_aucell.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _func_aucell(
6161
offsets: np.ndarray,
6262
n_up: int | float | None = None,
6363
verbose: bool = False,
64-
) -> tuple(np.ndarray, None):
64+
) -> tuple[np.ndarray, None]:
6565
r"""
6666
Area Under the Curve for set enrichment within single cells (AUCell) :cite:`aucell`.
6767

src/decoupler/mt/_consensus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def _mean_zscores(
6262
def consensus(
6363
result: dict | AnnData,
6464
verbose: bool = False,
65-
) -> tuple(pd.DataFrame, pd.DataFrame) | None:
65+
) -> tuple[pd.DataFrame, pd.DataFrame] | None:
6666
r"""
6767
Consensus score across methods.
6868

src/decoupler/mt/_gsea.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _esrank(
4040
rnks: np.ndarray,
4141
set_msk: np.ndarray,
4242
dec: float,
43-
) -> tuple(float, int, np.ndarray):
43+
) -> tuple[float, int, np.ndarray]:
4444
# Init empty
4545
mx_value = 0.0
4646
cum_sum = 0.0
@@ -86,7 +86,7 @@ def _nesrank(
8686
set_msk: np.ndarray,
8787
dec: float,
8888
es: float,
89-
) -> tuple(float, float):
89+
) -> tuple[float, float]:
9090
# Keep old set_msk upstream
9191
set_msk = set_msk.copy()
9292
# Compute null
@@ -122,7 +122,7 @@ def _stsgsea(
122122
starts: np.ndarray,
123123
offsets: np.ndarray,
124124
ridx: np.ndarray,
125-
) -> tuple(np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray):
125+
) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]:
126126
# Sort features
127127
idx = np.argsort(-row)
128128
row = row[idx]
@@ -157,7 +157,7 @@ def _func_gsea(
157157
times: int | float = 1000,
158158
seed: int | float = 42,
159159
verbose: bool = False,
160-
) -> tuple(np.ndarray, np.ndarray):
160+
) -> tuple[np.ndarray, np.ndarray]:
161161
r"""
162162
Gene Set Enrichment Analysis (GSEA) :cite:`gsea`.
163163

0 commit comments

Comments
 (0)