Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 827029a

Browse files
committed
Fix "real data" test (not sure about scale).
1 parent 325de84 commit 827029a

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

diffxpy/testing/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,7 @@ def continuous_1d(
21322132
as_numeric = list(as_numeric)
21332133

21342134
gene_names = parse_gene_names(data, gene_names)
2135-
sample_description = parse_sample_description(data, sample_description)
2135+
sample_description = parse_sample_description(data, sample_description).copy() # need copy to reset values.
21362136

21372137
# Check that continuous factor is contained in sample description and is numeric.
21382138
if continuous not in sample_description.columns:

diffxpy/unit_test/test_acc_glm_all_numpy_temp.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import logging
2-
import anndata
32
import numpy as np
4-
import scipy.sparse
53
import unittest
6-
4+
import scanpy as sc
75
import batchglm.api as glm
86
import diffxpy.api as de
97

@@ -23,20 +21,23 @@ def test_full_nb(self):
2321
logger.error("TestAccuracyGlmNb.test_full_nb()")
2422

2523
np.random.seed(1)
26-
adata = anndata.read_h5ad("/Users/david.fischer/Desktop/test.h5ad")
27-
TF = "Ascl1"
24+
adata = sc.datasets.pbmc3k()
25+
tf = "MALAT1"
26+
ind = adata.var.index.get_loc(tf)
27+
log_cd4 = sc.pp.log1p(adata[:, tf].X.todense())
28+
adata.obs[tf + "_log"] = log_cd4
2829
temp = de.test.continuous_1d(
29-
data=adata[:, :10],
30-
formula_loc="~ 1 +" + TF + "_log", # + " + log_sf",
31-
formula_scale="~ 1 +" + TF + "_log", # + " + log_sf",
32-
factor_loc_totest=TF + "_log",
33-
continuous=TF + "_log",
34-
as_numeric=[TF + "_log"], # "log_sf"],
30+
data=adata[:, (ind - 5):(ind + 5)],
31+
formula_loc="~ 1 +" + tf + "_log", # + " + log_sf",
32+
formula_scale="~ 1",
33+
factor_loc_totest=tf + "_log",
34+
continuous=tf + "_log",
35+
as_numeric=[tf + "_log"], # "log_sf"],
3536
df=4,
3637
quick_scale=False,
3738
init_a="all_zero",
3839
size_factors=None,
39-
noise_model="poisson",
40+
noise_model="nb",
4041
backend="numpy"
4142
)
4243
_ = temp.summary()

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ sphinx_rtd_theme
1313
jinja2
1414
docutils
1515
sparse==0.9.1
16+
scanpy

0 commit comments

Comments
 (0)