maxcombat 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maxcombat might be problematic. Click here for more details.
- {maxcombat-0.1.2/src/maxcombat.egg-info → maxcombat-0.1.3}/PKG-INFO +1 -1
- {maxcombat-0.1.2 → maxcombat-0.1.3}/pyproject.toml +11 -1
- {maxcombat-0.1.2 → maxcombat-0.1.3/src/maxcombat.egg-info}/PKG-INFO +1 -1
- {maxcombat-0.1.2 → maxcombat-0.1.3}/tests/test_cli.py +14 -8
- {maxcombat-0.1.2 → maxcombat-0.1.3}/LICENSE +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/README.md +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/setup.cfg +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat/__init__.py +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat/cli.py +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat/core.py +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat/utils.py +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat.egg-info/SOURCES.txt +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat.egg-info/dependency_links.txt +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat.egg-info/entry_points.txt +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat.egg-info/requires.txt +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/src/maxcombat.egg-info/top_level.txt +0 -0
- {maxcombat-0.1.2 → maxcombat-0.1.3}/tests/test_tutorial_data.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "maxcombat"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Scalable batch-effect correction largely based on reComBat"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -37,3 +37,13 @@ Repository = "https://github.com/OlivierCoen/maxcombat"
|
|
|
37
37
|
|
|
38
38
|
[tool.setuptools.packages.find]
|
|
39
39
|
where = ["src"]
|
|
40
|
+
include = ["maxcombat*"]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
testpaths = [
|
|
44
|
+
"tests",
|
|
45
|
+
]
|
|
46
|
+
markers = [
|
|
47
|
+
"cli: cli tests, used in bioconda CI",
|
|
48
|
+
"tutorial: tests aiming at reproducing results from the original reComBat, using tutorial data"
|
|
49
|
+
]
|
|
@@ -8,8 +8,8 @@ All input files are synthetic and written to tmp_path.
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
10
|
import json
|
|
11
|
+
import pytest
|
|
11
12
|
import subprocess
|
|
12
|
-
import sys
|
|
13
13
|
from pathlib import Path
|
|
14
14
|
|
|
15
15
|
import numpy as np
|
|
@@ -61,7 +61,8 @@ DEFAULT_BATCHES = {f"S{i:02d}": "batch1" for i in range(5)} | {
|
|
|
61
61
|
# Nominal case
|
|
62
62
|
# ----------------------------------------------------------------------
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
@pytest.mark.cli
|
|
65
|
+
@pytest.mark.cli
|
|
65
66
|
def test_cli_nominal_run(tmp_path):
|
|
66
67
|
"""A normal invocation corrects the data, drops the orphan sample and
|
|
67
68
|
writes both the Parquet output and the sidecar count files."""
|
|
@@ -100,6 +101,7 @@ def test_cli_nominal_run(tmp_path):
|
|
|
100
101
|
# ----------------------------------------------------------------------
|
|
101
102
|
|
|
102
103
|
|
|
104
|
+
@pytest.mark.cli
|
|
103
105
|
def test_cli_missing_sample_in_design_fails(tmp_path):
|
|
104
106
|
"""A sample present in the counts but absent from the design must abort
|
|
105
107
|
with a clear message and a non-zero exit code, without writing output."""
|
|
@@ -115,15 +117,17 @@ def test_cli_missing_sample_in_design_fails(tmp_path):
|
|
|
115
117
|
assert not out.exists()
|
|
116
118
|
|
|
117
119
|
|
|
120
|
+
@pytest.mark.cli
|
|
118
121
|
def test_cli_invalid_model_rejected_by_argparse(tmp_path):
|
|
119
122
|
"""An unknown --model value is rejected by argparse with exit code 2."""
|
|
120
123
|
counts, samples = _make_counts(tmp_path)
|
|
121
124
|
design = _make_design(tmp_path, samples, DEFAULT_BATCHES)
|
|
125
|
+
out = tmp_path / "corrected.csv"
|
|
122
126
|
|
|
123
127
|
proc, _stdout, stderr = run_cli(
|
|
124
128
|
"--counts", str(counts), "--design", str(design),
|
|
125
129
|
"--model", "svm", # not one of ALLOWED_MODELS
|
|
126
|
-
"--out", str(
|
|
130
|
+
"--out", str(out),
|
|
127
131
|
)
|
|
128
132
|
assert proc.returncode == 1
|
|
129
133
|
assert "Unknown model" in stderr
|
|
@@ -134,18 +138,20 @@ def test_cli_invalid_model_rejected_by_argparse(tmp_path):
|
|
|
134
138
|
# ----------------------------------------------------------------------
|
|
135
139
|
|
|
136
140
|
|
|
141
|
+
@pytest.mark.cli
|
|
137
142
|
def test_cli_with_covariates_and_reference_batch(tmp_path):
|
|
138
143
|
"""--x-covariates, --c-covariates and --reference-batch run end to end."""
|
|
139
144
|
counts, samples = _make_counts(tmp_path)
|
|
140
145
|
design = _make_design(tmp_path, samples, DEFAULT_BATCHES)
|
|
141
146
|
|
|
142
147
|
x_cov = tmp_path / "x.csv"
|
|
143
|
-
pl.DataFrame(
|
|
144
|
-
|
|
145
|
-
|
|
148
|
+
pl.DataFrame(
|
|
149
|
+
{"sample": samples,
|
|
150
|
+
"condition": ["treated" if i % 2 else "control" for i in range(10)]}
|
|
151
|
+
).write_csv(x_cov)
|
|
146
152
|
c_cov = tmp_path / "c.csv"
|
|
147
153
|
pl.DataFrame({"sample": samples, "rin": np.linspace(6, 9, 10)}).write_csv(c_cov)
|
|
148
|
-
out = tmp_path / "corrected.
|
|
154
|
+
out = tmp_path / "corrected.tsv"
|
|
149
155
|
|
|
150
156
|
proc, _stdout, stderr = run_cli(
|
|
151
157
|
"--counts", str(counts), "--design", str(design),
|
|
@@ -156,7 +162,7 @@ def test_cli_with_covariates_and_reference_batch(tmp_path):
|
|
|
156
162
|
)
|
|
157
163
|
assert proc.returncode == 0, f"CLI failed:\n{stderr}"
|
|
158
164
|
|
|
159
|
-
result = pl.
|
|
165
|
+
result = pl.read_csv(out, separator="\t")
|
|
160
166
|
values = result.drop("gene_id").to_numpy()
|
|
161
167
|
assert values.shape == (30, 10)
|
|
162
168
|
# reference batch must be returned unchanged
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|