@@ -194,9 +194,9 @@ def overlap(self, enq_set: set, set_id=None):
194
194
def test (
195
195
ref : RefSets ,
196
196
det : Union [_DifferentialExpressionTest , None ] = None ,
197
- pval : Union [np .array , None ] = None ,
197
+ scores : Union [np .array , None ] = None ,
198
198
gene_ids : Union [list , None ] = None ,
199
- de_threshold = 0.05 ,
199
+ threshold = 0.05 ,
200
200
incl_all_zero = False ,
201
201
all_ids = None ,
202
202
clean_ref = False ,
@@ -211,12 +211,14 @@ def test(
211
211
:param ref: The annotated gene sets against which enrichment is tested.
212
212
:param det: The differential expression results object which is tested
213
213
for enrichment in the gene sets.
214
- :param pval: Alternative to DETest, vector of p-values for differential expression.
214
+ :param scores: Alternative to DETest, vector of scores (scalar per gene) which are then
215
+ used to discretize gene list. This can for example be corrected p-values from a differential expression
216
+ test, in that case the parameter threshold would be a significance threshold.
215
217
:param gene_ids: If pval was supplied instead of DETest, use gene_ids to supply the
216
218
vector of gene identifiers (strings) that correspond to the p-values
217
219
which can be matched against the identifieres in the sets in RefSets.
218
- :param de_threshold: Significance threshold at which a differential test (a multiple-testing
219
- corrected p-value) is called siginficant. T
220
+ :param threshold: Threshold of parameter scores at which a gene is included as a hit: In the case
221
+ of differential test p-values in scores, threshold is the siginficance threshold.
220
222
:param incl_all_zero: Wehther to include genes in gene universe which were all zero.
221
223
:param all_ids: Set of all gene identifiers, this is used as the background set in the
222
224
hypergeometric test. Only supply this if not all genes were tested
@@ -228,9 +230,9 @@ def test(
228
230
return Enrich (
229
231
ref = ref ,
230
232
det = det ,
231
- pval = pval ,
233
+ scores = scores ,
232
234
gene_ids = gene_ids ,
233
- de_threshold = de_threshold ,
235
+ threshold = threshold ,
234
236
incl_all_zero = incl_all_zero ,
235
237
all_ids = all_ids ,
236
238
clean_ref = clean_ref ,
@@ -246,9 +248,9 @@ def __init__(
246
248
self ,
247
249
ref : RefSets ,
248
250
det : Union [_DifferentialExpressionTest , None ],
249
- pval : Union [np .array , None ],
251
+ scores : Union [np .array , None ],
250
252
gene_ids : Union [list , np .ndarray , None ],
251
- de_threshold ,
253
+ threshold ,
252
254
incl_all_zero ,
253
255
all_ids ,
254
256
clean_ref ,
@@ -269,8 +271,8 @@ def __init__(
269
271
idx_not_all_zero = np .where (np .logical_not (det .summary ()["zero_mean" ].values ))[0 ]
270
272
self ._qval_de = det .qval [idx_not_all_zero ]
271
273
self ._gene_ids = det .gene_ids [idx_not_all_zero ]
272
- elif pval is not None and gene_ids is not None :
273
- self ._qval_de = np .asarray (pval )
274
+ elif scores is not None and gene_ids is not None :
275
+ self ._qval_de = np .asarray (scores )
274
276
self ._gene_ids = gene_ids
275
277
else :
276
278
raise ValueError ('Supply either DETest or pval and gene_ids to Enrich().' )
@@ -286,7 +288,7 @@ def __init__(
286
288
self ._qval_de = self ._qval_de [idx_notnan ]
287
289
self ._gene_ids = self ._gene_ids [idx_notnan ]
288
290
289
- self ._significant_de = self ._qval_de <= de_threshold
291
+ self ._significant_de = self ._qval_de <= threshold
290
292
self ._significant_ids = set (self ._gene_ids [np .where (self ._significant_de )[0 ]])
291
293
if all_ids is not None :
292
294
self ._all_ids = set (all_ids )
0 commit comments